Skip to content

Commit

Permalink
Integration updates (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmh authored Apr 24, 2023
1 parent 0f05b91 commit 5cfa06f
Show file tree
Hide file tree
Showing 10 changed files with 64 additions and 25 deletions.
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.8
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Namely Ruby Whiff
# :nose: Namely Ruby Whiff

Namely Ruby Whiff is a Ruby gem that contains common Rubocop configurations to use in your Ruby projects. New tools will be added over time, the next being ruby critic.

Expand All @@ -7,7 +7,7 @@ Namely Ruby Whiff is a Ruby gem that contains common Rubocop configurations to u
To install Namely Ruby Whiff, simply add it to your Gemfile:

```ruby
gem 'namely-ruby-whiff'
gem 'namely_ruby_whiff', git: 'https://github.com/namely/namely_ruby_whiff.git', branch: 'master', require: false
```

And then run `bundle install`.
Expand All @@ -34,3 +34,28 @@ The gem also includes `rubocop-changes` a tool to apply Rubocop to only the file
```bash
bundle exec rubocop-changes
```

## Caveats

When adding an additional file to a rule for exclusion, the excluded files from the base config also have to be added to the local config. For example:

```
# in the base config from this gem
Lint/RescueException:
Exclude:
- 'app/lib/koala/evaluator.rb'
# in your local project's config
## this will no longer exclude the koala file from base
Lint/RescueException:
Exclude:
- 'app/my_weird_file.rb'
## this will work as intended
Lint/RescueException:
Exclude:
- 'app/lib/koala/evaluator.rb'
- 'app/my_weird_file.rb'
```
6 changes: 5 additions & 1 deletion config/rubocop-rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@ inherit_from:

AllCops:
Exclude:
- 'bin/**/*'
- 'db/**/*'
TargetRubyVersion: 2.6
- 'gen/**/*'
- 'protorepo/**/*'
# rubocop checks .ruby-version for version
# TargetRubyVersion: 2.6
5 changes: 5 additions & 0 deletions config/rubocop/layout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ Layout/FirstMethodArgumentLineBreak:

Layout/MultilineAssignmentLayout:
Enabled: true
EnforcedStyle: new_line

Layout/LineLength:
Max: 120

Layout/SpaceInsideStringInterpolation:
Enabled: true
EnforcedStyle: no_space
7 changes: 3 additions & 4 deletions config/rubocop/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ Lint/ShadowedException:
Lint/RescueException:
Exclude:
- 'app/lib/koala/evaluator.rb'
- 'app/services/net_suite/gl_org_units_service.rb'

Lint/UnifiedInteger:
Exclude:
- 'app/models/type_for_field.rb'
## New Cops
Lint/NonDeterministicRequireOrder:
Enabled: true
2 changes: 0 additions & 2 deletions config/rubocop/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ Metrics/BlockLength:
Max: 40
Exclude:
- 'config/routes.rb'
- 'spec/factories.rb'
- 'spec/**/*_spec.rb'
- 'app/workers/net_suite_export_job.rb'

Metrics/ClassLength:
Max: 300
Expand Down
9 changes: 9 additions & 0 deletions config/rubocop/rails.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,12 @@ Rails/SaveBang:

Rails/SkipsModelValidations:
Enabled: false

## New Cops
Rails/FilePath:
Enabled: true
EnforcedStyle: arguments

RSpec/EmptyLineAfterExample:
Enabled: true
AllowConsecutiveOneLiners: true
17 changes: 13 additions & 4 deletions config/rubocop/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,18 @@ RSpec/MultipleExpectations:
RSpec/NestedGroups:
Max: 5

RSpec/LetSetup:
Exclude:
- 'spec/mailers/gl_sync_mailer_spec.rb'

RSpec/NamedSubject:
Enabled: false

## New cops
RSpec/RepeatedExampleGroupDescription:
Enabled: false

RSpec/RepeatedExampleGroupBody:
Enabled: false

RSpec/EmptyLineAfterExample:
Enabled: true

RSpec/LeakyConstantDeclaration:
Enabled: true
11 changes: 0 additions & 11 deletions config/rubocop/style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,13 @@ Style/ClassVars:

Style/DateTime:
Enabled: true
Exclude:
- 'app/workers/sync_job.rb'

Style/Documentation:
Enabled: false

Style/EachWithObject:
Exclude:
- 'app/models/namely_importer.rb'

Style/FrozenStringLiteralComment:
Exclude:
- 'app/lib/koala/evaluator.rb'
- 'spec/features/**/*_spec.rb'

Style/GuardClause:
MinBodyLength: 4
Expand All @@ -37,9 +30,5 @@ Style/MissingRespondToMissing:
Style/MultilineMethodSignature:
Enabled: true

Style/MutableConstant:
Exclude:
- 'app/models/net_suite/constants.rb'

Style/Send:
Enabled: true
2 changes: 1 addition & 1 deletion namely_ruby_whiff.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |spec|
spec.name = 'namely_ruby_whiff'
spec.version = '0.0.2'
spec.version = '0.0.3.1'
spec.summary = 'A set of configurations to support high quality Ruby code.'
spec.authors = ['[email protected]']
spec.files = []
Expand Down

0 comments on commit 5cfa06f

Please sign in to comment.