Skip to content

Commit

Permalink
Split Ruby / Rails rubocop rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lewispb committed Dec 19, 2024
1 parent 308bc66 commit fa3b7d8
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ gem "rubocop-37signals", github: "basecamp/house-style", require: false
And create a boilerplate `.rubocop.yml` that inherits from `rubocop-37signals`:
```yaml
# 37signals house style
inherit_gem: { rubocop-37signals: rubocop.yml }
inherit_gem: { rubocop-37signals: rubocop-rails.yml }
```
App-specific config may follow, overriding the house style.
Expand Down
41 changes: 41 additions & 0 deletions rubocop-rails.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
inherit_from: rubocop-ruby.yml

require:
- rubocop-performance
- rubocop-rails
- rubocop-minitest

inherit_mode:
merge:
- Exclude

AllCops:
Exclude:
- "data/**/*"
- "db/*schema.rb"
- "log/**/*"
- "node_modules/**/*"
- "public/**/*"
- "storage/**/*"
- "tmp/**/*"
- "vendor/**/*"

Performance:
Exclude:
- "test/**/*"

# Prefer assert_not over assert !
Rails/AssertNot:
Include:
- "test/**/*"

# Prefer assert_not_x over refute_x
Rails/RefuteMethods:
Include:
- "test/**/*"

Performance/FlatMap:
Enabled: true

Performance/UnfreezeString:
Enabled: true
35 changes: 0 additions & 35 deletions rubocop.yml → rubocop-ruby.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,9 @@
require:
- rubocop-performance
- rubocop-rails
- rubocop-minitest

inherit_mode:
merge:
- Exclude

AllCops:
DisabledByDefault: true
Exclude:
- "data/**/*"
- "db/*schema.rb"
- "log/**/*"
- "node_modules/**/*"
- "public/**/*"
- "storage/**/*"
- "tmp/**/*"
- "vendor/**/*"

Performance:
Exclude:
- "test/**/*"

# Prefer assert_not over assert !
Rails/AssertNot:
Include:
- "test/**/*"

# Prefer assert_not_x over refute_x
Rails/RefuteMethods:
Include:
- "test/**/*"

# We generally prefer &&/|| but like low-precedence and/or in context
Style/AndOr:
Expand Down Expand Up @@ -238,10 +210,3 @@ Style/TrailingCommaInArrayLiteral:

Style/TrailingCommaInHashLiteral:
Enabled: true

Performance/FlatMap:
Enabled: true

Performance/UnfreezeString:
Enabled: true

0 comments on commit fa3b7d8

Please sign in to comment.