From 73fa2ad1221d800138929b6f75c285641b2ca95d Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Sun, 3 Nov 2024 22:27:06 +0000 Subject: [PATCH] Setup rubocop --- .github/workflows/ci.yml | 15 ++++++++++++- .rubocop.yml | 46 ++++++++++++++++++++++++++++++++++++++++ Gemfile | 1 + 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 .rubocop.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 852882a..2d3e58e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,6 +11,18 @@ on: env: RSPEC_CI: true jobs: + rubocop: + name: Rubocop + runs-on: 'ubuntu-20.04' + steps: + - uses: actions/checkout@v4 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: '3.3' + - run: script/update_rubygems_and_install_bundler + - run: bundle install + - run: bundle exec rubocop -c .rubocop.yml + test: name: Ruby ${{ matrix.ruby }} ${{ matrix.name_extra || '' }} runs-on: ${{ matrix.os || 'ubuntu-20.04' }} @@ -51,5 +63,6 @@ jobs: bundler: ${{ matrix.bundler || 2 }} ruby-version: ${{ matrix.ruby }} - run: script/update_rubygems_and_install_bundler - - run: bundle install --binstubs --standalone + - run: bundle install --standalone + - run: bundle binstubs --all - run: script/test_all diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..86c8ba4 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,46 @@ +AllCops: + NewCops: enable + SuggestExtensions: false + +Metrics/BlockLength: + Enabled: true + Exclude: + - spec/**/*_spec.rb + +Layout/LineLength: + Max: 120 + +Lint/NestedMethodDefinition: + Exclude: + - lib/rspec/its.rb + +Lint/SendWithMixinArgument: + Exclude: + - lib/rspec/its.rb + +Metrics/AbcSize: + Exclude: + - lib/rspec/its.rb + +Metrics/MethodLength: + Max: 25 + +Naming/PredicateName: + Exclude: + - lib/rspec/its.rb + +Style/CaseEquality: + Exclude: + - lib/rspec/its/subject.rb + +Style/SignalException: + Exclude: + - features/**/*.rb + +Style/SpecialGlobalVars: + Exclude: + - rspec-its.gemspec + +# We don't care about single vs double quotes. +Style/StringLiterals: + Enabled: false diff --git a/Gemfile b/Gemfile index 36a5694..d9d4871 100644 --- a/Gemfile +++ b/Gemfile @@ -24,3 +24,4 @@ gem 'cucumber', '>= 1.3.8' gem 'ffi', '~> 1.17.0' gem 'matrix', '~> 0.4.2' gem 'rake', '~> 13.2.0' +gem 'rubocop', '~> 1.68.0'