-
Notifications
You must be signed in to change notification settings - Fork 3.7k
/
.rubocop.yml
195 lines (151 loc) · 4.37 KB
/
.rubocop.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
inherit_from: .rubocop_todo.yml
inherit_mode:
merge:
- Exclude
require:
- rubocop-capybara
- rubocop-factory_bot
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-rspec_rails
AllCops:
Exclude:
- 'bin/*'
- 'db/converters/*.rb'
- 'db/schema.rb'
NewCops: enable
TargetRubyVersion: 3.0
Rails:
Enabled: true
# We have duplication due to extra logic in the Gemfile
Bundler/DuplicatedGem:
Enabled: false
# Doesn't work well yet
Capybara/ClickLinkOrButtonStyle:
Enabled: false
# Restore old default
Capybara/NegationMatcher:
EnforcedStyle: not_to
Layout/BeginEndAlignment:
EnforcedStyleAlignWith: begin
# Place . on the previous line
Layout/DotPosition:
EnforcedStyle: trailing
# Spaces in strings with line continuations go at the beginning of the line.
Layout/LineContinuationLeadingSpace:
EnforcedStyle: leading
# Lenient line length that fits in pull requests
Layout/LineLength:
Max: 92
Layout/MultilineMethodCallBraceLayout:
EnforcedStyle: same_line
# Multi-line operations should be simply indented. Aligning them makes it even
# harder to keep a sane line length.
Layout/MultilineMethodCallIndentation:
EnforcedStyle: indented
# Multi-line operations should be simply indented. Aligning them makes it even
# harder to keep a sane line length.
Layout/MultilineOperationIndentation:
EnforcedStyle: indented
# Uniform block layout
Layout/SpaceBeforeBlockBraces:
EnforcedStyleForEmptyBraces: space
# Assume the programmer knows how bracketed block syntax works
Lint/AmbiguousBlockAssociation:
Enabled: false
# Allow if (foo = get_foo) style
Lint/AssignmentInCondition:
AllowSafeAssignment: true
# Suppress BlockLength for some files:
# - Spec describe blocks can be any length
# - Routes blocks can be any length
# - FactoryBot factory blocks can be any length
# - Gem specification blocks can be any length
Metrics/BlockLength:
Exclude:
- 'spec/**/*'
- '**/*.gemspec'
# Initial schema has a very large change method
Metrics/MethodLength:
Exclude:
- 'db/migrate/113_initial_schema.publify_core_engine.rb'
Performance/StartWith:
AutoCorrect: true
Performance/EndWith:
AutoCorrect: true
# Migrations should not use ApplicationRecord
Rails/ApplicationRecord:
Exclude:
- 'db/migrate/*'
# This cop has issues and is too database-specific
Rails/BulkChangeTable:
Enabled: false
# These tasks do not need environment
Rails/RakeEnvironment:
Exclude:
- 'lib/tasks/i18n.rake'
- 'lib/tasks/manifests.rake'
- 'lib/tasks/rspec.rake'
- 'lib/tasks/rubocop.rake'
# Migrations should not do validations in general?
Rails/SkipsModelValidations:
Exclude:
- 'db/migrate/*'
# Spec type inference is disabled, so this cop must be disabled too.
RSpecRails/InferredSpecType:
Enabled: false
# Allow the use of 'and' 'or' in control structures.
Style/AndOr:
EnforcedStyle: conditionals
Style/ClassAndModuleChildren:
Enabled: false
Style/CollectionMethods:
Enabled: true
# Documenting all classes is not common in Rails projects.
Style/Documentation:
Enabled: false
# This cop doesn't detect use of break yet
Style/EachWithObject:
Enabled: false
# Allows format strings with: format, sprintf or percent.
Style/FormatString:
Enabled: false
# Require at least two dependent lines before suggesting a guard clause
Style/GuardClause:
MinBodyLength: 2
# TODO: Re-enable?
Style/NumericPredicate:
Enabled: false
# Not all objects that implement #size implement #empty?
Style/ZeroLengthPredicate:
Enabled: false
# Restore previous RuboCop defaults
Style/PercentLiteralDelimiters:
PreferredDelimiters:
'%W': ()
'%w': ()
# Always use raise to raise exceptions
Style/SignalException:
EnforcedStyle: only_raise
# Allow meaningful names for single-line reduce etc.
Style/SingleLineBlockParams:
Enabled: false
# Prefer not to commit to need to interpolate
Style/StringLiterals:
EnforcedStyle: double_quotes
# Be consistent with non-interpolated strings
Style/StringLiteralsInInterpolation:
EnforcedStyle: double_quotes
# Prefer symbols to look like symbols
Style/SymbolArray:
EnforcedStyle: brackets
# Prefer consistent lines for multi-line arrays
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
# Prefer consistent lines for multi-line hashes
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
# Allow small arrays of words with quotes
Style/WordArray:
MinSize: 4