Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rubocop #57

Merged
merged 3 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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