rubocop-govuk 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c23b647abb912a4c141e4799fe35a39917d69d1b86d4c2528476ded0985809d
4
+ data.tar.gz: 05bce0f54a903602b544a1a41ecb5abce498443996f4b992ddc2c94c111f0086
5
+ SHA512:
6
+ metadata.gz: 8a06387e9544b0221f2098dbc4376515cbf9ab965cec5b31215a1cd52968fffc5afeae0c3511b27f2d41218f7b771de48cf2a70e2fec814de22b90ffefb5c4d5
7
+ data.tar.gz: a47f1a2d3bf1ac8191117aa5536e360369ad0761abfc5e6b95ba52ed801f89613315babf325c4ea25264fb859053117790daf3cbac18414960dcb7f6e4120c64
@@ -0,0 +1,16 @@
1
+ # 2.0.0
2
+
3
+ * Use specific version for RuboCop
4
+ * Update RuboCop to 0.77
5
+
6
+ # 1.0.0
7
+
8
+ * Allow importing of Ruby and Rails rules seperately
9
+
10
+ # 0.2.0
11
+
12
+ * Disable the Style/FormatStringToken cop
13
+
14
+ # 0.1.0
15
+
16
+ * Initial release with previous work from `govuk-lint`
@@ -0,0 +1,21 @@
1
+ The MIT License(MIT)
2
+
3
+ Copyright (C) 2015 Crown Copyright (Government Digital Service)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
6
+ this software and associated documentation files (the "Software"), to deal in
7
+ the Software without restriction, including without limitation the rights to
8
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9
+ of the Software, and to permit persons to whom the Software is furnished to do
10
+ so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,41 @@
1
+ # RuboCop GOV.UK
2
+
3
+ This repository provides common RuboCop rules for use with GOV.UK Ruby projects to comply with our [style guides][guides].
4
+
5
+ ## Installation
6
+
7
+ Add `rubocop-govuk` to your Gemfile and then run `bundle install`:
8
+
9
+ ```ruby
10
+ # Gemfile
11
+ gem 'rubocop-govuk'
12
+ ```
13
+
14
+ Inherit rules from the gem by adding the following to your project's RuboCop config:
15
+
16
+ ```yaml
17
+ # .rubocop.yml
18
+ inherit_gem:
19
+ rubocop-govuk:
20
+ - config/default.yml
21
+ ```
22
+
23
+ or if you also need Rails specific rules:
24
+
25
+ ```yaml
26
+ # .rubocop.yml
27
+ inherit_gem:
28
+ rubocop-govuk:
29
+ - config/default.yml
30
+ - config/rails.yml
31
+ ```
32
+
33
+ ## Usage
34
+
35
+ Run RuboCop:
36
+
37
+ ```sh
38
+ bundle exec rubocop
39
+ ```
40
+
41
+ [guides]: https://github.com/alphagov/styleguides
@@ -0,0 +1,19 @@
1
+ AllCops:
2
+ DisplayCopNames:
3
+ Description: 'Display cop names in offense messages'
4
+ Enabled: true
5
+
6
+ ExtraDetails:
7
+ Description: 'Display extra details in offense messages.'
8
+ Enabled: true
9
+
10
+ DisplayStyleGuide:
11
+ Description: 'Display style guide URLs in offense messages.'
12
+ Enabled: true
13
+
14
+ inherit_from:
15
+ - gds-ruby-styleguide.yml
16
+ - other-lint.yml
17
+ - other-style.yml
18
+ - other-metrics.yml
19
+ - other-excludes.yml
@@ -0,0 +1,337 @@
1
+ ############
2
+ ## General
3
+ ############
4
+
5
+ Layout/BlockAlignment:
6
+ Description: 'Align block ends correctly.'
7
+ Enabled: true
8
+
9
+ Layout/CaseIndentation:
10
+ Description: Indentation of when in a case/when/[else/]end.
11
+ Enabled: true
12
+ EnforcedStyle: case
13
+ SupportedStyles:
14
+ - case
15
+ - end
16
+ IndentOneStep: false
17
+
18
+ Layout/ClosingParenthesisIndentation:
19
+ Description: 'Checks the indentation of hanging closing parentheses.'
20
+ Enabled: false
21
+
22
+ Style/MutableConstant:
23
+ Description: 'Freeze mutable objects assigned to constants.'
24
+ Enabled: true
25
+
26
+ Lint/ElseLayout:
27
+ Description: 'Check for odd code arrangement in an else block.'
28
+ Enabled: true
29
+
30
+ # Supports --auto-correct
31
+ Layout/EmptyLineBetweenDefs:
32
+ Description: Use empty lines between defs.
33
+ Enabled: true
34
+ AllowAdjacentOneLineDefs: false
35
+
36
+ Layout/EmptyLines:
37
+ Description: "Don't use several empty lines in a row."
38
+ Enabled: true
39
+
40
+ Layout/EndAlignment:
41
+ Description: 'Align ends correctly.'
42
+ Enabled: true
43
+
44
+ Layout/EndOfLine:
45
+ Description: 'Use Unix-style line endings.'
46
+ Enabled: true
47
+
48
+ # Supports --auto-correct
49
+ Layout/IndentationWidth:
50
+ Description: Use 2 spaces for indentation.
51
+ Enabled: true
52
+
53
+ # Supports --auto-correct
54
+ Layout/IndentationConsistency:
55
+ Description: Keep indentation straight.
56
+ Enabled: true
57
+
58
+ Metrics/LineLength:
59
+ Description: Limit lines to 80 characters.
60
+ Enabled: false
61
+ Max: 80
62
+
63
+ # Supports --auto-correct
64
+ Layout/SpaceAroundOperators:
65
+ Description: Use spaces around operators.
66
+ Enabled: true
67
+
68
+ # Supports --auto-correct
69
+ Layout/SpaceBeforeBlockBraces:
70
+ Description: Checks that the left block brace has or doesn't have space before it.
71
+ Enabled: true
72
+ EnforcedStyle: space
73
+ SupportedStyles:
74
+ - space
75
+ - no_space
76
+
77
+ # Supports --auto-correct
78
+ Layout/SpaceAfterSemicolon:
79
+ Description: Use spaces after semicolons.
80
+ Enabled: true
81
+
82
+ # Supports --auto-correct
83
+ Layout/SpaceAfterColon:
84
+ Description: Use spaces after colons.
85
+ Enabled: true
86
+
87
+ # Supports --auto-correct
88
+ Layout/SpaceAfterComma:
89
+ Description: Use spaces after commas.
90
+ Enabled: true
91
+
92
+ # Supports --auto-correct
93
+ Layout/SpaceInsideReferenceBrackets:
94
+ Description: No spaces after array[ or before ].
95
+ Enabled: true
96
+
97
+ # Supports --auto-correct
98
+ Layout/SpaceInsideArrayLiteralBrackets:
99
+ Description: No spaces after array = [ or before ].
100
+ Enabled: true
101
+
102
+ # Supports --auto-correct
103
+ Layout/SpaceInsideParens:
104
+ Description: No spaces after ( or before ).
105
+ Enabled: true
106
+
107
+ Layout/Tab:
108
+ Description: No hard tabs.
109
+ Enabled: true
110
+
111
+ # Supports --auto-correct
112
+ Layout/TrailingWhitespace:
113
+ Description: Avoid trailing whitespace.
114
+ Enabled: true
115
+
116
+ # Supports --auto-correct
117
+ Layout/TrailingEmptyLines:
118
+ Description: Checks trailing blank lines and final newline.
119
+ Enabled: true
120
+ EnforcedStyle: final_newline
121
+ SupportedStyles:
122
+ - final_newline
123
+ - final_blank_line
124
+
125
+ ## Syntax
126
+
127
+ # Supports --auto-correct
128
+ Style/AndOr:
129
+ Description: Use &&/|| instead of and/or.
130
+ Enabled: true
131
+
132
+ # Supports --auto-correct
133
+ Style/DefWithParentheses:
134
+ Description: Use def with parentheses when there are arguments.
135
+ Enabled: true
136
+
137
+ Style/For:
138
+ Description: Checks use of for or each in multiline loops.
139
+ Enabled: true
140
+ EnforcedStyle: each
141
+ SupportedStyles:
142
+ - for
143
+ - each
144
+
145
+ Style/IfUnlessModifier:
146
+ Description: Favor modifier if/unless usage when you have a single-line body.
147
+ Enabled: false
148
+
149
+ Style/MethodCalledOnDoEndBlock:
150
+ Description: Avoid chaining a method call on a do...end block.
151
+ Enabled: true
152
+
153
+ Style/MethodCallWithoutArgsParentheses:
154
+ Description: 'Do not use parentheses for method calls with no arguments.'
155
+ Enabled: true
156
+
157
+ Style/MultilineBlockChain:
158
+ Description: Avoid multi-line chains of blocks.
159
+ Enabled: true
160
+
161
+ Style/MultilineIfThen:
162
+ Description: Never use then for multi-line if/unless.
163
+ Enabled: true
164
+
165
+ Style/MultilineTernaryOperator:
166
+ Description: 'Avoid multi-line ?: (the ternary operator); use if/unless instead.'
167
+ Enabled: true
168
+
169
+ Style/NestedTernaryOperator:
170
+ Description: Use one expression per branch in a ternary operator.
171
+ Enabled: true
172
+
173
+ Style/OneLineConditional:
174
+ Description: Favor the ternary operator(?:) over if/then/else/end constructs.
175
+ Enabled: true
176
+
177
+ # Supports --auto-correct
178
+ Style/ParenthesesAroundCondition:
179
+ Description: Don't use parentheses around the condition of an if/unless/while.
180
+ Enabled: true
181
+ AllowSafeAssignment: true
182
+
183
+ # Supports --auto-correct
184
+ Style/RedundantReturn:
185
+ Description: Don't use return where it's not required.
186
+ Enabled: true
187
+ AllowMultipleReturnValues: false
188
+
189
+ # Supports --auto-correct
190
+ Layout/SpaceAfterMethodName:
191
+ Description: Never put a space between a method name and the opening parenthesis in
192
+ a method definition.
193
+ Enabled: true
194
+
195
+ # Supports --auto-correct
196
+ Layout/SpaceAroundEqualsInParameterDefault:
197
+ Description: Checks that the equals signs in parameter default assignments have or
198
+ don't have surrounding space depending on configuration.
199
+ Enabled: true
200
+ EnforcedStyle: space
201
+ SupportedStyles:
202
+ - space
203
+ - no_space
204
+
205
+ Style/UnlessElse:
206
+ Description: Never use unless with else. Rewrite these with the positive case first.
207
+ Enabled: true
208
+
209
+ # Supports --auto-correct
210
+ Lint/UnusedBlockArgument:
211
+ Description: Checks for unused block arguments.
212
+ Enabled: true
213
+
214
+ ## Naming
215
+
216
+ Naming/ClassAndModuleCamelCase:
217
+ Description: Use CamelCase for classes and modules.
218
+ Enabled: true
219
+
220
+ # Supports --auto-correct
221
+ Style/ClassMethods:
222
+ Description: Use self when defining module/class methods.
223
+ Enabled: true
224
+
225
+ Style/ClassVars:
226
+ Description: Avoid the use of class variables.
227
+ Enabled: true
228
+
229
+ Naming/ConstantName:
230
+ Description: Constants should use SCREAMING_SNAKE_CASE.
231
+ Enabled: true
232
+
233
+ Naming/MethodName:
234
+ Description: Use the configured style when naming methods.
235
+ Enabled: true
236
+ EnforcedStyle: snake_case
237
+ SupportedStyles:
238
+ - snake_case
239
+ - camelCase
240
+
241
+ # Supports --auto-correct
242
+ Style/TrivialAccessors:
243
+ Description: Prefer attr_* methods to trivial readers/writers.
244
+ Enabled: true
245
+ ExactNameMatch: true
246
+ AllowPredicates: true
247
+ AllowDSLWriters: false
248
+ AllowedMethod:
249
+ - to_ary
250
+ - to_a
251
+ - to_c
252
+ - to_enum
253
+ - to_h
254
+ - to_hash
255
+ - to_i
256
+ - to_int
257
+ - to_io
258
+ - to_open
259
+ - to_path
260
+ - to_proc
261
+ - to_r
262
+ - to_regexp
263
+ - to_str
264
+ - to_s
265
+ - to_sym
266
+
267
+ Naming/VariableName:
268
+ Description: Use the configured style when naming variables.
269
+ Enabled: true
270
+ EnforcedStyle: snake_case
271
+ SupportedStyles:
272
+ - snake_case
273
+ - camelCase
274
+
275
+ ## Exceptions
276
+
277
+ # Supports --auto-correct
278
+ Lint/RescueException:
279
+ Description: Avoid rescuing the Exception class.
280
+ Enabled: true
281
+
282
+ ## Collections
283
+
284
+ # Supports --auto-correct
285
+ Layout/ArrayAlignment:
286
+ Description: Align the elements of an array literal if they span more than one line.
287
+ Enabled: true
288
+
289
+ # Supports --auto-correct
290
+ Style/HashSyntax:
291
+ Description: 'Prefer Ruby 1.9 hash syntax { a: 1, b: 2 } over 1.8 syntax { :a => 1,
292
+ :b => 2 }.'
293
+ Enabled: true
294
+ Exclude:
295
+ - 'db/schema.rb'
296
+
297
+ EnforcedStyle: ruby19
298
+ SupportedStyles:
299
+ - ruby19
300
+ - hash_rockets
301
+
302
+ Style/TrailingCommaInArrayLiteral:
303
+ Enabled: true
304
+ EnforcedStyleForMultiline: comma
305
+
306
+ Style/TrailingCommaInHashLiteral:
307
+ Enabled: true
308
+ EnforcedStyleForMultiline: comma
309
+
310
+ Style/TrailingCommaInArguments:
311
+ Enabled: true
312
+ EnforcedStyleForMultiline: comma
313
+
314
+ # Supports --auto-correct
315
+ Style/WordArray:
316
+ Description: Use %w or %W for arrays of words.
317
+ Enabled: true
318
+ MinSize: 0
319
+
320
+ Layout/MultilineMethodCallIndentation:
321
+ Enabled: false
322
+
323
+ ## Strings
324
+
325
+ # Supports --auto-correct
326
+ Lint/RedundantStringCoercion:
327
+ Description: Checks for Object#to_s usage in string interpolation.
328
+ Enabled: true
329
+
330
+ # Supports --auto-correct
331
+ Style/StringLiterals:
332
+ Description: Checks if uses of quotes match the configured preference.
333
+ Enabled: true
334
+ EnforcedStyle: double_quotes
335
+ SupportedStyles:
336
+ - single_quotes
337
+ - double_quotes
@@ -0,0 +1,16 @@
1
+ AllCops:
2
+ Exclude:
3
+ - db/schema.rb
4
+
5
+ Metrics/BlockLength:
6
+ Enabled: true
7
+ Exclude:
8
+ - test/**/*
9
+ - "**/spec/**/*"
10
+ ExcludedMethods: ["namespace"]
11
+
12
+ Bundler/DuplicatedGem:
13
+ Enabled: false
14
+
15
+ Style/FormatStringToken:
16
+ Enabled: false
@@ -0,0 +1,129 @@
1
+ Lint/AmbiguousOperator:
2
+ Description: >-
3
+ Checks for ambiguous operators in the first argument of a
4
+ method invocation without parentheses.
5
+ Enabled: true
6
+
7
+ Lint/AmbiguousRegexpLiteral:
8
+ Description: >-
9
+ Checks for ambiguous regexp literals in the first argument of
10
+ a method invocation without parenthesis.
11
+ Enabled: true
12
+
13
+ Lint/AssignmentInCondition:
14
+ Description: "Don't use assignment in conditions."
15
+ Enabled: true
16
+
17
+ Layout/ConditionPosition:
18
+ Description: 'Checks for condition placed in a confusing position relative to the keyword.'
19
+ Enabled: true
20
+
21
+ Lint/Debugger:
22
+ Description: 'Check for debugger calls.'
23
+ Enabled: true
24
+
25
+ Lint/DeprecatedClassMethods:
26
+ Description: 'Check for deprecated class method calls.'
27
+ Enabled: true
28
+
29
+ Lint/EmptyEnsure:
30
+ Description: 'Checks for empty ensure block.'
31
+ Enabled: true
32
+
33
+ Lint/EmptyInterpolation:
34
+ Description: 'Checks for empty string interpolation.'
35
+ Enabled: true
36
+
37
+ Lint/EndInMethod:
38
+ Description: 'END blocks should not be placed inside method definitions.'
39
+ Enabled: true
40
+
41
+ Lint/EnsureReturn:
42
+ Description: 'Never use return in an ensure block.'
43
+ Enabled: true
44
+
45
+ Security/Eval:
46
+ Description: 'The use of eval represents a serious security risk.'
47
+ Enabled: true
48
+
49
+ Lint/SuppressedException:
50
+ Description: "Don't suppress exception."
51
+ Enabled: true
52
+
53
+ Lint/LiteralAsCondition:
54
+ Description: 'Checks of literals used in conditions.'
55
+ Enabled: true
56
+
57
+ Lint/LiteralInInterpolation:
58
+ Description: 'Checks for literals used in interpolation.'
59
+ Enabled: true
60
+
61
+ Lint/Loop:
62
+ Description: >-
63
+ Use Kernel#loop with break rather than begin/end/until or
64
+ begin/end/while for post-loop tests.
65
+ Enabled: true
66
+
67
+ Lint/ParenthesesAsGroupedExpression:
68
+ Description: >-
69
+ Checks for method calls with a space before the opening
70
+ parenthesis.
71
+ Enabled: true
72
+
73
+ Lint/PercentStringArray:
74
+ Description: Checks for unwanted commas and quotes in %w/%W literals eg %w('foo', “bar”).
75
+ Enabled: true
76
+
77
+ Lint/RequireParentheses:
78
+ Description: >-
79
+ Use parentheses in the method call to avoid confusion
80
+ about precedence.
81
+ Enabled: true
82
+
83
+ Lint/ShadowingOuterLocalVariable:
84
+ Description: >-
85
+ Do not use the same name as outer local variable
86
+ for block arguments or block local variables.
87
+ Enabled: true
88
+
89
+ Layout/SpaceBeforeFirstArg:
90
+ Description: >-
91
+ Put a space between a method name and the first argument
92
+ in a method call without parentheses.
93
+ Enabled: true
94
+
95
+ Lint/UnderscorePrefixedVariableName:
96
+ Description: 'Do not use prefix `_` for a variable that is used.'
97
+ Enabled: true
98
+
99
+ Lint/UnusedMethodArgument:
100
+ Description: 'Checks for unused method arguments.'
101
+ Enabled: true
102
+
103
+ Lint/UnreachableCode:
104
+ Description: 'Unreachable code.'
105
+ Enabled: true
106
+
107
+ Lint/UselessAccessModifier:
108
+ Description: 'Checks for useless access modifiers.'
109
+ Enabled: true
110
+
111
+ Lint/UselessAssignment:
112
+ Description: 'Checks for useless assignment to a local variable.'
113
+ Enabled: true
114
+
115
+ Lint/UselessComparison:
116
+ Description: 'Checks for comparison of something with itself.'
117
+ Enabled: true
118
+
119
+ Lint/UselessElseWithoutRescue:
120
+ Description: 'Checks for useless `else` in `begin..end` without `rescue`.'
121
+ Enabled: true
122
+
123
+ Lint/UselessSetterCall:
124
+ Description: 'Checks for useless setter call to a local variable.'
125
+ Enabled: true
126
+
127
+ Lint/Void:
128
+ Description: 'Possible use of operator/literal/variable in void context.'
129
+ Enabled: true
@@ -0,0 +1,11 @@
1
+ Metrics/AbcSize:
2
+ Enabled: false
3
+
4
+ Metrics/ClassLength:
5
+ Enabled: false
6
+
7
+ Metrics/ModuleLength:
8
+ Enabled: false
9
+
10
+ Metrics/PerceivedComplexity:
11
+ Enabled: false
@@ -0,0 +1,386 @@
1
+ Layout/AccessModifierIndentation:
2
+ Description: Check indentation of private/protected visibility modifiers.
3
+ Enabled: true
4
+ EnforcedStyle: outdent
5
+
6
+ Naming/AccessorMethodName:
7
+ Description: Check the naming of accessor methods for get_/set_.
8
+ Enabled: false
9
+
10
+ Style/Alias:
11
+ Description: 'Use alias_method instead of alias.'
12
+ Enabled: false
13
+
14
+ Layout/HashAlignment:
15
+ Description: >-
16
+ Align the elements of a hash literal if they span more than
17
+ one line.
18
+ Enabled: false
19
+
20
+ Layout/ParameterAlignment:
21
+ Description: >-
22
+ Align the parameters of a method call if they span more
23
+ than one line.
24
+ Enabled: false
25
+
26
+ Style/ArrayJoin:
27
+ Description: 'Use Array#join instead of Array#*.'
28
+ Enabled: false
29
+
30
+ Style/AsciiComments:
31
+ Description: 'Use only ascii symbols in comments.'
32
+ Enabled: false
33
+
34
+ Naming/AsciiIdentifiers:
35
+ Description: 'Use only ascii symbols in identifiers.'
36
+ Enabled: false
37
+
38
+ Style/Attr:
39
+ Description: 'Checks for uses of Module#attr.'
40
+ Enabled: false
41
+
42
+ Style/BeginBlock:
43
+ Description: 'Avoid the use of BEGIN blocks.'
44
+ Enabled: false
45
+
46
+ Style/BlockComments:
47
+ Description: 'Do not use block comments.'
48
+ Enabled: false
49
+
50
+ Metrics/BlockNesting:
51
+ Description: 'Avoid excessive block nesting'
52
+ Enabled: false
53
+
54
+ Style/BlockDelimiters:
55
+ Description: >-
56
+ Avoid using {...} for multi-line blocks (multiline chaining is
57
+ always ugly).
58
+ Prefer {...} over do...end for single-line blocks.
59
+ Enabled: false
60
+
61
+ Style/BracesAroundHashParameters:
62
+ Description: 'Enforce braces style inside hash parameters.'
63
+ Enabled: true
64
+
65
+ Style/CaseEquality:
66
+ Description: 'Avoid explicit use of the case equality operator(===).'
67
+ Enabled: false
68
+
69
+ Style/CharacterLiteral:
70
+ Description: 'Checks for uses of character literals.'
71
+ Enabled: false
72
+
73
+ Style/ClassAndModuleChildren:
74
+ Description: 'Checks style of children classes and modules.'
75
+ Enabled: false
76
+
77
+ Metrics/ClassLength:
78
+ Description: 'Avoid classes longer than 100 lines of code.'
79
+ Enabled: false
80
+
81
+ Style/CollectionMethods:
82
+ Description: 'Preferred collection methods.'
83
+ Enabled: false
84
+
85
+ Style/ColonMethodCall:
86
+ Description: 'Do not use :: for method call.'
87
+ Enabled: false
88
+
89
+ Style/CommentAnnotation:
90
+ Description: >-
91
+ Checks formatting of special comments
92
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
93
+ Enabled: false
94
+
95
+ Layout/CommentIndentation:
96
+ Description: 'Indentation of comments.'
97
+ Enabled: false
98
+
99
+ Metrics/CyclomaticComplexity:
100
+ Description: 'Avoid complex methods.'
101
+ Enabled: false
102
+
103
+ Style/PreferredHashMethods:
104
+ Description: 'Checks for use of deprecated Hash methods.'
105
+ Enabled: false
106
+
107
+ Style/Documentation:
108
+ Description: 'Document classes and non-namespace modules.'
109
+ Enabled: false
110
+
111
+ Layout/DotPosition:
112
+ Description: 'Checks the position of the dot in multi-line method calls.'
113
+ Enabled: false
114
+
115
+ Style/DoubleNegation:
116
+ Description: 'Checks for uses of double negation (!!).'
117
+ Enabled: false
118
+
119
+ Style/EachWithObject:
120
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
121
+ Enabled: false
122
+
123
+ Layout/EmptyLinesAroundAccessModifier:
124
+ Description: "Keep blank lines around access modifiers."
125
+ Enabled: true
126
+
127
+ Layout/EmptyLines:
128
+ Description: "Keeps track of empty lines around expression bodies."
129
+ Enabled: false
130
+
131
+ Style/EmptyLiteral:
132
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
133
+ Enabled: false
134
+
135
+ Style/Encoding:
136
+ Description: 'Use UTF-8 as the source file encoding.'
137
+ Enabled: false
138
+
139
+ Style/EndBlock:
140
+ Description: 'Avoid the use of END blocks.'
141
+ Enabled: false
142
+
143
+ Style/EvenOdd:
144
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
145
+ Enabled: false
146
+
147
+ Naming/FileName:
148
+ Description: 'Use snake_case for source file names.'
149
+ Enabled: false
150
+
151
+ Lint/FlipFlop:
152
+ Description: 'Checks for flip flops'
153
+ Enabled: false
154
+
155
+ Style/FormatString:
156
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
157
+ Enabled: false
158
+
159
+ Style/GlobalVars:
160
+ Description: 'Do not introduce global variables.'
161
+ Enabled: false
162
+
163
+ Style/GuardClause:
164
+ Description: 'Check for conditionals that can be replaced with guard clauses'
165
+ Enabled: false
166
+
167
+ Style/IfWithSemicolon:
168
+ Description: 'Never use if x; .... Use the ternary operator instead.'
169
+ Enabled: false
170
+
171
+ Layout/FirstArrayElementIndentation:
172
+ Description: >-
173
+ Checks the indentation of the first element in an array
174
+ literal.
175
+ Enabled: false
176
+
177
+ Layout/FirstHashElementIndentation:
178
+ Description: 'Checks the indentation of the first key in a hash literal.'
179
+ Enabled: false
180
+
181
+ Style/Lambda:
182
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
183
+ Enabled: false
184
+
185
+ Style/LambdaCall:
186
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
187
+ Enabled: false
188
+
189
+ Layout/LeadingCommentSpace:
190
+ Description: 'Comments should start with a space.'
191
+ Enabled: false
192
+
193
+ Style/LineEndConcatenation:
194
+ Description: >-
195
+ Use \ instead of + or << to concatenate two string literals at
196
+ line end.
197
+ Enabled: false
198
+
199
+ Style/MethodDefParentheses:
200
+ Description: >-
201
+ Checks if the method definitions have or don't have
202
+ parentheses.
203
+ Enabled: false
204
+
205
+ Metrics/MethodLength:
206
+ Description: 'Avoid methods longer than 10 lines of code.'
207
+ Enabled: false
208
+
209
+ Style/ModuleFunction:
210
+ Description: 'Checks for usage of `extend self` in modules.'
211
+ Enabled: false
212
+
213
+ Layout/MultilineOperationIndentation:
214
+ EnforcedStyle: indented
215
+
216
+ Style/NegatedIf:
217
+ Description: >-
218
+ Favor unless over if for negative conditions
219
+ (or control flow or).
220
+ Enabled: false
221
+
222
+ Style/NegatedWhile:
223
+ Description: 'Favor until over while for negative conditions.'
224
+ Enabled: false
225
+
226
+ Style/Next:
227
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
228
+ Enabled: false
229
+
230
+ Style/NilComparison:
231
+ Description: 'Prefer x.nil? to x == nil.'
232
+ Enabled: false
233
+
234
+ Style/NonNilCheck:
235
+ Description: 'Checks for redundant nil checks.'
236
+ Enabled: false
237
+
238
+ Style/Not:
239
+ Description: 'Use ! instead of not.'
240
+ Enabled: false
241
+
242
+ Style/NumericLiterals:
243
+ Description: >-
244
+ Add underscores to large numeric literals to improve their
245
+ readability.
246
+ Enabled: false
247
+
248
+ Metrics/ParameterLists:
249
+ Description: 'Avoid parameter lists longer than three or four parameters.'
250
+ Enabled: false
251
+
252
+ Style/PercentLiteralDelimiters:
253
+ Description: 'Use `%`-literal delimiters consistently'
254
+ Enabled: false
255
+
256
+ Style/PerlBackrefs:
257
+ Description: 'Avoid Perl-style regex back references.'
258
+ Enabled: false
259
+
260
+ Naming/PredicateName:
261
+ Description: 'Check the names of predicate methods.'
262
+ Enabled: false
263
+
264
+ Style/Proc:
265
+ Description: 'Use proc instead of Proc.new.'
266
+ Enabled: false
267
+
268
+ Style/RaiseArgs:
269
+ Description: 'Checks the arguments passed to raise/fail.'
270
+ Enabled: false
271
+
272
+ Style/RedundantBegin:
273
+ Description: "Don't use begin blocks when they are not needed."
274
+ Enabled: false
275
+
276
+ Style/RedundantException:
277
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
278
+ Enabled: false
279
+
280
+ Style/RedundantSelf:
281
+ Description: "Don't use self where it's not needed."
282
+ Enabled: false
283
+
284
+ Style/RegexpLiteral:
285
+ Description: >-
286
+ Use %r for regular expressions matching more than
287
+ `MaxSlashes` '/' characters.
288
+ Use %r only for regular expressions matching more than
289
+ `MaxSlashes` '/' character.
290
+ Enabled: false
291
+
292
+ Style/RescueModifier:
293
+ Description: 'Avoid using rescue in its modifier form.'
294
+ Enabled: false
295
+
296
+ Style/SafeNavigation:
297
+ Description: >-
298
+ This cop transforms usages of a method call safeguarded by a check for the
299
+ existance of the object to safe navigation (`&.`).
300
+ Enabled: false
301
+
302
+ Style/SelfAssignment:
303
+ Description: 'Checks for places where self-assignment shorthand should have been used.'
304
+ Enabled: false
305
+
306
+ Style/Semicolon:
307
+ Description: "Don't use semicolons to terminate expressions."
308
+ Enabled: false
309
+
310
+ Style/SignalException:
311
+ Description: 'Checks for proper usage of fail and raise.'
312
+ Enabled: false
313
+
314
+ Style/SingleLineBlockParams:
315
+ Description: 'Enforces the names of some block params.'
316
+ Enabled: false
317
+
318
+ Style/SingleLineMethods:
319
+ Description: 'Avoid single-line methods.'
320
+ Enabled: false
321
+
322
+ Layout/SpaceBeforeFirstArg:
323
+ Description: >-
324
+ Checks that exactly one space is used between a method name
325
+ and the first argument for method calls without parentheses.
326
+ Enabled: false
327
+
328
+ Layout/SpaceAroundKeyword:
329
+ Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
330
+ Enabled: false
331
+
332
+ Layout/SpaceAfterNot:
333
+ Description: Tracks redundant space after the ! operator.
334
+ Enabled: false
335
+
336
+ Layout/SpaceBeforeComment:
337
+ Description: >-
338
+ Checks for missing space between code and a comment on the
339
+ same line.
340
+ Enabled: false
341
+
342
+ Layout/SpaceInsideBlockBraces:
343
+ Description: >-
344
+ Checks that block braces have or don't have surrounding space.
345
+ For blocks taking parameters, checks that the left brace has
346
+ or doesn't have trailing space.
347
+ Enabled: true
348
+
349
+ Layout/SpaceInsideHashLiteralBraces:
350
+ Description: "Use spaces inside hash literal braces - or don't."
351
+ Enabled: true
352
+
353
+ Style/SpecialGlobalVars:
354
+ Description: 'Avoid Perl-style global variables.'
355
+ Enabled: false
356
+
357
+ Style/RedundantCapitalW:
358
+ Description: 'Checks for %W when interpolation is not needed.'
359
+ Enabled: false
360
+
361
+ Style/CommandLiteral:
362
+ Description: 'Checks for %x when `` would do.'
363
+ Enabled: false
364
+
365
+ Style/VariableInterpolation:
366
+ Description: >-
367
+ Don't interpolate global, instance and class variables
368
+ directly in strings.
369
+ Enabled: false
370
+
371
+ Style/WhenThen:
372
+ Description: 'Use when x then ... for one-line cases.'
373
+ Enabled: false
374
+
375
+ Style/WhileUntilDo:
376
+ Description: 'Checks for redundant do after while or until.'
377
+ Enabled: false
378
+
379
+ Style/WhileUntilModifier:
380
+ Description: >-
381
+ Favor modifier while/until usage when you have a
382
+ single-line body.
383
+ Enabled: false
384
+
385
+ Style/FrozenStringLiteralComment:
386
+ Enabled: false
@@ -0,0 +1,41 @@
1
+ ##################### Rails ##################################
2
+
3
+ # By default Rails is switched off so this can be used by non-Rails apps,
4
+ # this can be enabled in a local .rubocop.yml file
5
+
6
+ require: rubocop-rails
7
+
8
+ Rails:
9
+ Enabled: true
10
+
11
+ Rails/ActionFilter:
12
+ Description: 'Enforces consistent use of action filter methods.'
13
+ Enabled: false
14
+
15
+ Rails/Delegate:
16
+ Description: 'Prefer delegate method for delegations.'
17
+ Enabled: false
18
+
19
+ Rails/HasAndBelongsToMany:
20
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
21
+ Enabled: false
22
+
23
+ Rails/Output:
24
+ Description: 'Checks for calls to puts, print, etc.'
25
+ Enabled: false
26
+
27
+ Rails/ReadWriteAttribute:
28
+ Description: 'Checks for read_attribute(:attr) and write_attribute(:attr, val).'
29
+ Enabled: false
30
+
31
+ Rails/ScopeArgs:
32
+ Description: 'Checks the arguments of ActiveRecord scopes.'
33
+ Enabled: false
34
+
35
+ Rails/Validation:
36
+ Description: 'Use sexy validations.'
37
+ Enabled: false
38
+
39
+ Rails/SkipsModelValidations:
40
+ Description: 'Avoid methods that skip model validations.'
41
+ Enabled: false
metadata ADDED
@@ -0,0 +1,109 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rubocop-govuk
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Government Digital Service
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2019-11-28 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '12.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '12.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rubocop
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '='
32
+ - !ruby/object:Gem::Version
33
+ version: '0.77'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: '0.77'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rubocop-rails
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rubocop-rspec
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '1.28'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '1.28'
69
+ description: Shared RuboCop rules for Ruby projects in GOV.UK
70
+ email:
71
+ - govuk-dev@digital.cabinet-office.gov.uk
72
+ executables: []
73
+ extensions: []
74
+ extra_rdoc_files: []
75
+ files:
76
+ - CHANGELOG.md
77
+ - LICENSE.md
78
+ - README.md
79
+ - config/default.yml
80
+ - config/gds-ruby-styleguide.yml
81
+ - config/other-excludes.yml
82
+ - config/other-lint.yml
83
+ - config/other-metrics.yml
84
+ - config/other-style.yml
85
+ - config/rails.yml
86
+ homepage: https://github.com/alphagov/rubocop-govuk
87
+ licenses:
88
+ - MIT
89
+ metadata: {}
90
+ post_install_message:
91
+ rdoc_options: []
92
+ require_paths:
93
+ - lib
94
+ required_ruby_version: !ruby/object:Gem::Requirement
95
+ requirements:
96
+ - - ">="
97
+ - !ruby/object:Gem::Version
98
+ version: '0'
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ requirements: []
105
+ rubygems_version: 3.0.3
106
+ signing_key:
107
+ specification_version: 4
108
+ summary: RuboCop GOV.UK
109
+ test_files: []