Skip to content

Commit

Permalink
Merge pull request #57 from rspec/add-rubocop
Browse files Browse the repository at this point in the history
Add rubocop
  • Loading branch information
JonRowe authored Dec 10, 2023
2 parents ac34412 + 91f2caa commit e9cd834
Show file tree
Hide file tree
Showing 6 changed files with 407 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ concurrency:
cancel-in-progress: true

jobs:
rubocop:
name: Rubocop
runs-on: 'ubuntu-20.04'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
- run: script/update_rubygems_and_install_bundler
- run: bundle install --standalone
- run: bundle exec rubocop -c .rubocop.yml

test:
name: 'Ruby: ${{ matrix.ruby }}, Rails: ${{ matrix.env.RAILS_VERSION }}'
runs-on: ubuntu-20.04
Expand Down
64 changes: 64 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
inherit_from:
- .rubocop_rspec_base.yml

AllCops:
NewCops: enable
TargetRubyVersion: 2.0
SuggestExtensions: false
Exclude:
- bin/**/*
- tmp/**/*
- bundle/**/*

# TODO: Remove
Gemspec/DevelopmentDependencies:
Enabled: false

Gemspec/DeprecatedAttributeAssignment:
Enabled: false

Gemspec/RequiredRubyVersion:
Enabled: false

# TODO: Remove
Gemspec/RubyVersionGlobalsUsage:
Enabled: false

Layout/LineLength:
Max: 120

# Over time we'd like to get this down, but this is what we're at now.
Metrics/AbcSize:
Max: 28

# Over time we'd like to get this down, but this is what we're at now.
Metrics/BlockLength:
Max: 86
Exclude:
- spec/**/*

Metrics/ModuleLength:
Max: 140

# Over time we'd like to get this down, but this is what we're at now.
Metrics/PerceivedComplexity:
Max: 10

Naming/FileName:
Exclude:
- lib/rspec-activemodel-mocks.rb

Style/ClassAndModuleChildren:
Exclude:
- lib/rspec/active_model/mocks/mocks.rb

# Still support older Rubies
Style/ExpandPathArguments:
Enabled: false

Style/NumericLiterals:
Exclude:
- templates/sample/db/*

Style/OptionalBooleanParameter:
Enabled: false
Loading

0 comments on commit e9cd834

Please sign in to comment.