Skip to content

Commit 665bc99

Browse files
authored
Merge pull request #23 from tablexi/update_rubocop_defaults
Update rubocop defaults
2 parents b90833e + 8832ecf commit 665bc99

2 files changed

Lines changed: 53 additions & 43 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ For detailed instructions on the rubocop generator and its options, [check out t
6161

6262
### Generator: Unicorn
6363

64-
bundle exec rails g tablexi_dev:rubocop
64+
bundle exec rails g tablexi_dev:unicorn
6565

6666
The unicorn generator sets up a project's unicorn configuration files.
6767

lib/generators/tablexi_dev/rubocop_generator/files/dot_rubocop-txi.yml

Lines changed: 52 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,41 @@
33
# You should NOT make any changes to this file, as it will be overwritten
44
# the next time we update the tablexi_dev-generators gem and run
55
# `rails generate tablexi_dev:rubocop`
6+
#
7+
# Please keep cops in alphabetical order so they're easy to find/scan.
68
AllCops:
79
DisplayCopNames: true
810
Exclude:
9-
- "db/schema.rb" # You can't touch this
1011
- ".bundle/**/*" # Auto-generated
1112
- "bin/**/*" # Auto-generated
13+
- "db/schema.rb" # You can't touch this
1214
- "vendor/**/*" # We cannot solve the world's problems
1315
TargetRubyVersion: 2.4
1416
TargetRailsVersion: 5.1
15-
Rails:
16-
Enabled: true
17+
18+
Layout/EmptyLinesAroundBlockBody:
19+
Exclude:
20+
# These are naturally DSL-y, and so let's be lenient.
21+
- "lib/tasks/*.rake"
22+
- "spec/**/*"
23+
24+
Layout/EmptyLinesAroundClassBody:
25+
EnforcedStyle: empty_lines
26+
Exclude:
27+
- "db/**/*" # Migrations are compact by default, and it's not worth the wrestle.
28+
29+
Layout/EmptyLinesAroundModuleBody:
30+
EnforcedStyle: empty_lines
31+
32+
Layout/ExtraSpacing:
33+
Exclude:
34+
- "db/migrate/*" # Generated migrations often have extra spacing
35+
36+
Layout/SpaceBeforeFirstArg:
37+
Exclude:
38+
# We often add extra spaces for alignment in factories.
39+
- "db/migrate/*" # We often add extra spaces for alignment in migrations.
40+
- "spec/factories/**/*"
1741

1842
Lint/HandleExceptions:
1943
Exclude:
@@ -24,55 +48,52 @@ Metrics/AbcSize:
2448
Exclude:
2549
- "db/**/*" # Sometimes migrations are complex.
2650

51+
Metrics/BlockLength:
52+
Exclude:
53+
# These are naturally DSL-y, and so let's be lenient.
54+
- "config/routes.rb"
55+
- "db/seeds/**/*"
56+
- "spec/**/*"
57+
2758
Metrics/LineLength:
2859
Max: 120
60+
Exclude:
61+
- "config/initializers/**/*" # Some generated initializers are long.
2962

3063
Metrics/MethodLength:
3164
Max: 20
3265
Exclude:
3366
- "db/**/*" # Again, sometimes DB migrations are long.
3467

35-
Metrics/BlockLength:
36-
Exclude:
37-
# These are naturally DSL-y, and so let's be lenient.
38-
- "spec/**/*"
39-
- "config/routes.rb"
68+
Rails:
69+
Enabled: true
4070

41-
Style/ClassAndModuleChildren:
71+
Rails/ApplicationRecord:
4272
Exclude:
43-
- "app/controllers/**/*" # We generally use compact style here
73+
- "db/**/*" # Migrations should be isolated, models defined there should NOT inherit from ApplicationRecord
4474

45-
Style/Documentation:
75+
Rails/Output:
4676
Exclude:
47-
- "db/**/*" # No need to require migrations to be documented.
77+
- "db/seeds/**/*" # Allow `puts` from inside seed files
4878

49-
Layout/EmptyLinesAroundBlockBody:
50-
Exclude:
51-
# These are naturally DSL-y, and so let's be lenient.
52-
- "spec/**/*"
53-
- "lib/tasks/*.rake"
79+
Rails/UnknownEnv:
80+
Environments:
81+
- development
82+
- production
83+
- stage
84+
- test
5485

55-
Layout/EmptyLinesAroundClassBody:
56-
EnforcedStyle: empty_lines
86+
Style/ClassAndModuleChildren:
5787
Exclude:
58-
- "db/**/*" # Migrations are compact by default, and it's not worth the wrestle.
59-
60-
Layout/EmptyLinesAroundModuleBody:
61-
EnforcedStyle: empty_lines
88+
- "app/controllers/**/*" # We generally use compact style here
6289

63-
Layout/ExtraSpacing:
90+
Style/Documentation:
6491
Exclude:
65-
- "db/migrate/*" # Generated migrations often have extra spacing
92+
- "db/**/*" # No need to require migrations to be documented.
6693

6794
Style/SignalException:
6895
EnforcedStyle: only_raise
6996

70-
Layout/SpaceBeforeFirstArg:
71-
Exclude:
72-
# We often add extra spaces for alignment in factories.
73-
- "spec/factories/**/*"
74-
- "db/migrate/*" # We often add extra spaces for alignment in migrations.
75-
7697
Style/StringLiterals:
7798
EnforcedStyle: double_quotes
7899

@@ -87,14 +108,3 @@ Style/TrailingCommaInHashLiteral:
87108

88109
Style/TrivialAccessors:
89110
ExactNameMatch: true
90-
91-
Rails/UnknownEnv:
92-
Environments:
93-
- production
94-
- development
95-
- test
96-
- stage
97-
98-
Rails/ApplicationRecord:
99-
Exclude:
100-
- "db/**/*" # Migrations should be isolated, models defined there should NOT inherit from ApplicationRecord

0 commit comments

Comments
 (0)