-
Notifications
You must be signed in to change notification settings - Fork 21
/
.rubocop.yml
190 lines (153 loc) · 3.5 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
inherit_mode:
merge:
- Exclude
inherit_from: .rubocop_todo.yml
inherit_gem:
rubocop-govuk:
# Avoid the 'default' config as it disables lots of useful metrics
# - config/default.yml
- config/layout.yml
- config/naming.yml
- config/style.yml
- config/rake.yml
- config/rails.yml
- config/rspec.yml
require:
- rubocop-capybara
- rubocop-factory_bot
- rubocop-performance
- rubocop-rails
- rubocop-rspec
- rubocop-rspec_rails
AllCops:
NewCops: enable
UseCache: true
Exclude:
- "bin/**"
- "config.ru"
- "tmp/**/*"
- "db/schema.rb"
- "db/migrate/2017*"
- "db/migrate/2018*"
- "db/migrate/2019*"
- "db/migrate/2020*"
- "db/migrate/2021*"
- "db/migrate/2022*"
- "db/migrate/2023*"
- "db/migrate/202401*"
- "db/migrate/202402*"
- "db/migrate/202403*"
- "db/migrate/202404*"
- "db/migrate/202405*"
- "db/migrate/202406*"
- "db/migrate/202407*"
- "db/migrate/202408*"
- "vendor/**/*"
- "node_modules/**/*"
DisplayCopNames:
Enabled: true
ExtraDetails:
Enabled: true
DisplayStyleGuide:
Enabled: true
##
# Team Style conventions
Layout/LineEndStringConcatenationIndentation:
Enabled: false
Layout/FirstArrayElementIndentation:
EnforcedStyle: consistent
Layout/FirstHashElementIndentation:
EnforcedStyle: consistent
Layout/LineLength:
Enabled: false
Layout/MultilineMethodCallIndentation:
Enabled: false
Lint/Debugger:
DebuggerMethods:
Capybara:
- saop
- save_and_open_page
- save_and_open_screenshot
Lint/UselessMethodDefinition:
Exclude:
- "app/controllers/**/*_controller.rb"
# List as per https://docs.rubocop.org/rubocop/cops_naming.html#namingmethodparametername
# plus `as`.
Naming/MethodParameterName:
AllowedNames:
- as
- at
- by
- db
- id
- in
- io
- ip
- of
- on
- os
- pp
- to
Naming/PredicateName:
ForbiddenPrefixes:
- is_
Style/BlockDelimiters:
EnforcedStyle: braces_for_chaining
Style/ClassAndModuleChildren:
Enabled: false
Style/Documentation:
Enabled: false
Style/FrozenStringLiteralComment:
EnforcedStyle: never
Style/IfUnlessModifier:
Enabled: false
Style/StringLiterals:
EnforcedStyle: double_quotes
Style/TrailingCommaInArguments:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInArrayLiteral:
EnforcedStyleForMultiline: comma
Style/TrailingCommaInHashLiteral:
EnforcedStyleForMultiline: comma
Layout/AccessModifierIndentation:
EnforcedStyle: indent
Style/HashSyntax:
EnforcedStyle: ruby19
EnforcedShorthandSyntax: either
# This is incompatible with our other migration checks
Rails/BulkChangeTable:
Enabled: false
##
# Tech Debt
# TODO: `rubocop-govuk` previously had all these metrics disabled as they are "just heuristics".
# They're not brilliant metrics, but they *can* point to some degree of accidental complexity.
# We should consider slowly moving closer to the default settings.
Metrics/AbcSize:
Max: 31 # Default 17
Exclude:
- "config/**/*"
- "spec/**/*"
Metrics/BlockLength:
Exclude:
- "config/**/*"
- "spec/**/*"
Metrics/CyclomaticComplexity:
Max: 18 # Default 7
Exclude:
- "spec/**/*"
Metrics/MethodLength:
Max: 18 # Default 10
Exclude:
- "config/**/*"
- "spec/**/*"
Metrics/ModuleLength:
Max: 130 # Default 100
Exclude:
- "app/helpers/**/*"
- "spec/**/*"
Metrics/ParameterLists:
Max: 7 # Default 5
Metrics/PerceivedComplexity:
Max: 18 # Default 8
Exclude:
- "spec/**/*"