-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0f05b91
Showing
10 changed files
with
230 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# 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. | ||
|
||
## Installation | ||
|
||
To install Namely Ruby Whiff, simply add it to your Gemfile: | ||
|
||
```ruby | ||
gem 'namely-ruby-whiff' | ||
``` | ||
|
||
And then run `bundle install`. | ||
|
||
Next, replace your project's `.rubocop.yml` file with the following, followed by any rules or configurations you want to add or override: | ||
|
||
```yaml | ||
inherit_gem: | ||
namely_ruby_whiff: config/rubocop-rails.yml | ||
``` | ||
For non-Rails projects, use the following file path instead: `config/rubocop-vanilla.yml`. | ||
|
||
## Usage | ||
|
||
Once you've installed the gem, you can run Rubocop with the following command to make sure it's finding the configs from the gem: | ||
|
||
```bash | ||
bundle exec rubocop | ||
``` | ||
|
||
The gem also includes `rubocop-changes` a tool to apply Rubocop to only the files that have changes in your branch. | ||
|
||
```bash | ||
bundle exec rubocop-changes | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require: | ||
- rubocop-rails | ||
|
||
inherit_from: | ||
- rubocop-vanilla.yml | ||
- rubocop/rails.yml | ||
|
||
AllCops: | ||
Exclude: | ||
- 'db/**/*' | ||
TargetRubyVersion: 2.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
require: | ||
- rubocop-rspec | ||
- rubocop-performance | ||
|
||
inherit_from: | ||
- rubocop/layout.yml | ||
- rubocop/lint.yml | ||
- rubocop/metrics.yml | ||
- rubocop/rspec.yml | ||
- rubocop/style.yml | ||
|
||
AllCops: | ||
Exclude: | ||
- 'bin/**/*' | ||
- 'gen/**/*' | ||
- 'protorepo/**/*' | ||
# rubocop checks .ruby-version for version | ||
# TargetRubyVersion: 2.6 | ||
|
||
Naming/MethodParameterName: | ||
AllowedNames: ['id', 'ms', 'to'] | ||
|
||
Performance/OpenStruct: | ||
Enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Layout/FirstHashElementLineBreak: | ||
Enabled: true | ||
|
||
Layout/FirstMethodArgumentLineBreak: | ||
Enabled: true | ||
|
||
Layout/MultilineAssignmentLayout: | ||
Enabled: true | ||
|
||
Layout/LineLength: | ||
Max: 120 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Lint: | ||
Severity: refactor | ||
|
||
Lint/NumberConversion: | ||
Enabled: true | ||
|
||
Lint/ShadowedException: | ||
Enabled: false | ||
|
||
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
Metrics/AbcSize: | ||
Max: 100 | ||
|
||
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 | ||
|
||
Metrics/CyclomaticComplexity: | ||
Max: 15 | ||
|
||
Metrics/MethodLength: | ||
Max: 60 | ||
|
||
Metrics/ModuleLength: | ||
Max: 300 | ||
|
||
Metrics/PerceivedComplexity: | ||
Max: 15 | ||
|
||
Metrics/ParameterLists: | ||
Max: 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
Rails: | ||
Enabled: true | ||
|
||
Rails/ActiveRecordAliases: | ||
Enabled: false | ||
|
||
Rails/ActiveRecordOverride: | ||
Enabled: false | ||
|
||
Rails/HasManyOrHasOneDependent: | ||
Enabled: false | ||
|
||
Rails/InverseOf: | ||
Enabled: false | ||
|
||
Rails/SaveBang: | ||
Enabled: false | ||
|
||
Rails/SkipsModelValidations: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
RSpec/AnyInstance: | ||
Enabled: false | ||
|
||
RSpec/ExampleLength: | ||
Max: 45 | ||
|
||
RSpec/MessageChain: | ||
Enabled: false | ||
|
||
RSpec/MessageSpies: | ||
Enabled: false | ||
|
||
RSpec/MultipleExpectations: | ||
Max: 13 | ||
|
||
RSpec/NestedGroups: | ||
Max: 5 | ||
|
||
RSpec/LetSetup: | ||
Exclude: | ||
- 'spec/mailers/gl_sync_mailer_spec.rb' | ||
|
||
RSpec/NamedSubject: | ||
Enabled: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
Style/ClassAndModuleChildren: | ||
Enabled: false | ||
|
||
Style/ClassVars: | ||
Exclude: | ||
- 'app/lib/koala/evaluator.rb' | ||
|
||
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 | ||
|
||
Style/MethodCalledOnDoEndBlock: | ||
Enabled: false | ||
|
||
Style/MethodMissingSuper: | ||
Enabled: false | ||
|
||
Style/MissingRespondToMissing: | ||
Enabled: false | ||
|
||
Style/MultilineMethodSignature: | ||
Enabled: true | ||
|
||
Style/MutableConstant: | ||
Exclude: | ||
- 'app/models/net_suite/constants.rb' | ||
|
||
Style/Send: | ||
Enabled: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Gem::Specification.new do |spec| | ||
spec.name = 'namely_ruby_whiff' | ||
spec.version = '0.0.2' | ||
spec.summary = 'A set of configurations to support high quality Ruby code.' | ||
spec.authors = ['[email protected]'] | ||
spec.files = [] | ||
spec.required_ruby_version = '>= 2.5.0' | ||
|
||
spec.add_dependency 'rubocop', '>= 0.72' | ||
spec.add_dependency 'rubocop-changes' | ||
spec.add_dependency 'rubocop-performance' | ||
spec.add_dependency 'rubocop-rails' | ||
spec.add_dependency 'rubocop-rspec' | ||
end |