From fa9245d7ecf9ddcf2a6f7f9b7dcb732fb99a5fde Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Fri, 8 Dec 2023 12:17:13 -0500 Subject: [PATCH] Added rubocop for style checking; added woodpecker CI config --- .rubocop.yml | 21 +++++++++++++++++++++ .woodpecker.yml | 19 +++++++++++++++++++ Gemfile | 4 ++++ Rakefile | 7 +++++++ 4 files changed, 51 insertions(+) create mode 100644 .rubocop.yml create mode 100644 .woodpecker.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..e4cc9e0 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,21 @@ +require: rubocop-sequel + +AllCops: + NewCops: enable + +Layout/EmptyLinesAroundClassBody: + EnforcedStyle: 'empty_lines_except_namespace' +Layout/EmptyLinesAroundModuleBody: + EnforcedStyle: 'empty_lines_except_namespace' +Metrics/ClassLength: + Max: 150 +Style/ClassVars: + Enabled: false +Style/GlobalVars: + Enabled: false +Style/MethodCallWithoutArgsParentheses: + Enabled: false +Style/MethodCallWithArgsParentheses: + Enabled: true +Style/RedundantReturn: + Enabled: false diff --git a/.woodpecker.yml b/.woodpecker.yml new file mode 100644 index 0000000..1684e18 --- /dev/null +++ b/.woodpecker.yml @@ -0,0 +1,19 @@ +pipeline: + style: + image: ruby:3.0 + commands: + - 'gem install rake' + - 'bundle config set --local path "vendor/bundle"' + - 'bundle install' + - 'rake test:rubocop' + + gitea_release: + image: plugins/gitea-release + settings: + api_key: + from_secret: gitea_api_key + base_url: https://git.metaunix.net + title: "${CI_COMMIT_TAG}" + when: + event: tag + diff --git a/Gemfile b/Gemfile index f98efc2..04f2a1e 100644 --- a/Gemfile +++ b/Gemfile @@ -10,4 +10,8 @@ gem 'sqlite3', '~> 1.6' group :development, :test do gem 'rerun' gem 'wdm', '>= 0.1.0' if Gem.win_platform? + + # rubocop and extensions for code style + gem 'rubocop' + gem 'rubocop-sequel' end diff --git a/Rakefile b/Rakefile index 62a84de..a7f4ca0 100644 --- a/Rakefile +++ b/Rakefile @@ -22,3 +22,10 @@ namespace :server do system('rerun --no-notify --exit --dir="src/" puma') end end + +namespace :test do + task :rubocop do + system("rubocop app/ server.rb scan.rb") + end +end +