rubocop-govuk 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 9f3cc703ef46580473e74ee44c4aefdb4c24e4dcb93591087e20d2b71ef03554
4
+ data.tar.gz: f9da7399e69c0296c83b885848aedf07147322ba1047535c03840aad3c05bec2
5
+ SHA512:
6
+ metadata.gz: 9d75c582f92b8a96a30402af2499e98c58e6717a5003078867cd5cb000443ffcb244c13266078c1790d1c02364d0dd7273561b74da67ab7d1bcbf61d85333c4b
7
+ data.tar.gz: 4e461a6d025a5e77ea6773bcce84b923ac23454763fb3badb74bf4bc517f69ddffd150be57dc96eb07885463cd448b8a42fdce8334e210ec97ce2f8e89d2890a
@@ -0,0 +1,23 @@
1
+ # 3.0.0
2
+
3
+ * Update Rubocop to 0.80.1
4
+ * This deletes the Style/BracesAroundHashParameters cop for future
5
+ Ruby 3 compatibility.
6
+ * Exclude `bin` directory and `db/schema.rb` from linter checks (#14)
7
+
8
+ # 2.0.0
9
+
10
+ * Use specific version for RuboCop
11
+ * Update RuboCop to 0.77
12
+
13
+ # 1.0.0
14
+
15
+ * Allow importing of Ruby and Rails rules seperately
16
+
17
+ # 0.2.0
18
+
19
+ * Disable the Style/FormatStringToken cop
20
+
21
+ # 0.1.0
22
+
23
+ * 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,22 @@
1
+ AllCops:
2
+ Excludes:
3
+ - 'bin/**'
4
+
5
+ DisplayCopNames:
6
+ Description: 'Display cop names in offense messages'
7
+ Enabled: true
8
+
9
+ ExtraDetails:
10
+ Description: 'Display extra details in offense messages.'
11
+ Enabled: true
12
+
13
+ DisplayStyleGuide:
14
+ Description: 'Display style guide URLs in offense messages.'
15
+ Enabled: true
16
+
17
+ inherit_from:
18
+ - gds-ruby-styleguide.yml
19
+ - other-lint.yml
20
+ - other-style.yml
21
+ - other-metrics.yml
22
+ - 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
+ Layout/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
+ AllowedMethods:
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,382 @@
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/CaseEquality:
62
+ Description: 'Avoid explicit use of the case equality operator(===).'
63
+ Enabled: false
64
+
65
+ Style/CharacterLiteral:
66
+ Description: 'Checks for uses of character literals.'
67
+ Enabled: false
68
+
69
+ Style/ClassAndModuleChildren:
70
+ Description: 'Checks style of children classes and modules.'
71
+ Enabled: false
72
+
73
+ Metrics/ClassLength:
74
+ Description: 'Avoid classes longer than 100 lines of code.'
75
+ Enabled: false
76
+
77
+ Style/CollectionMethods:
78
+ Description: 'Preferred collection methods.'
79
+ Enabled: false
80
+
81
+ Style/ColonMethodCall:
82
+ Description: 'Do not use :: for method call.'
83
+ Enabled: false
84
+
85
+ Style/CommentAnnotation:
86
+ Description: >-
87
+ Checks formatting of special comments
88
+ (TODO, FIXME, OPTIMIZE, HACK, REVIEW).
89
+ Enabled: false
90
+
91
+ Layout/CommentIndentation:
92
+ Description: 'Indentation of comments.'
93
+ Enabled: false
94
+
95
+ Metrics/CyclomaticComplexity:
96
+ Description: 'Avoid complex methods.'
97
+ Enabled: false
98
+
99
+ Style/PreferredHashMethods:
100
+ Description: 'Checks for use of deprecated Hash methods.'
101
+ Enabled: false
102
+
103
+ Style/Documentation:
104
+ Description: 'Document classes and non-namespace modules.'
105
+ Enabled: false
106
+
107
+ Layout/DotPosition:
108
+ Description: 'Checks the position of the dot in multi-line method calls.'
109
+ Enabled: false
110
+
111
+ Style/DoubleNegation:
112
+ Description: 'Checks for uses of double negation (!!).'
113
+ Enabled: false
114
+
115
+ Style/EachWithObject:
116
+ Description: 'Prefer `each_with_object` over `inject` or `reduce`.'
117
+ Enabled: false
118
+
119
+ Layout/EmptyLinesAroundAccessModifier:
120
+ Description: "Keep blank lines around access modifiers."
121
+ Enabled: true
122
+
123
+ Layout/EmptyLines:
124
+ Description: "Keeps track of empty lines around expression bodies."
125
+ Enabled: false
126
+
127
+ Style/EmptyLiteral:
128
+ Description: 'Prefer literals to Array.new/Hash.new/String.new.'
129
+ Enabled: false
130
+
131
+ Style/Encoding:
132
+ Description: 'Use UTF-8 as the source file encoding.'
133
+ Enabled: false
134
+
135
+ Style/EndBlock:
136
+ Description: 'Avoid the use of END blocks.'
137
+ Enabled: false
138
+
139
+ Style/EvenOdd:
140
+ Description: 'Favor the use of Fixnum#even? && Fixnum#odd?'
141
+ Enabled: false
142
+
143
+ Naming/FileName:
144
+ Description: 'Use snake_case for source file names.'
145
+ Enabled: false
146
+
147
+ Lint/FlipFlop:
148
+ Description: 'Checks for flip flops'
149
+ Enabled: false
150
+
151
+ Style/FormatString:
152
+ Description: 'Enforce the use of Kernel#sprintf, Kernel#format or String#%.'
153
+ Enabled: false
154
+
155
+ Style/GlobalVars:
156
+ Description: 'Do not introduce global variables.'
157
+ Enabled: false
158
+
159
+ Style/GuardClause:
160
+ Description: 'Check for conditionals that can be replaced with guard clauses'
161
+ Enabled: false
162
+
163
+ Style/IfWithSemicolon:
164
+ Description: 'Never use if x; .... Use the ternary operator instead.'
165
+ Enabled: false
166
+
167
+ Layout/FirstArrayElementIndentation:
168
+ Description: >-
169
+ Checks the indentation of the first element in an array
170
+ literal.
171
+ Enabled: false
172
+
173
+ Layout/FirstHashElementIndentation:
174
+ Description: 'Checks the indentation of the first key in a hash literal.'
175
+ Enabled: false
176
+
177
+ Style/Lambda:
178
+ Description: 'Use the new lambda literal syntax for single-line blocks.'
179
+ Enabled: false
180
+
181
+ Style/LambdaCall:
182
+ Description: 'Use lambda.call(...) instead of lambda.(...).'
183
+ Enabled: false
184
+
185
+ Layout/LeadingCommentSpace:
186
+ Description: 'Comments should start with a space.'
187
+ Enabled: false
188
+
189
+ Style/LineEndConcatenation:
190
+ Description: >-
191
+ Use \ instead of + or << to concatenate two string literals at
192
+ line end.
193
+ Enabled: false
194
+
195
+ Style/MethodDefParentheses:
196
+ Description: >-
197
+ Checks if the method definitions have or don't have
198
+ parentheses.
199
+ Enabled: false
200
+
201
+ Metrics/MethodLength:
202
+ Description: 'Avoid methods longer than 10 lines of code.'
203
+ Enabled: false
204
+
205
+ Style/ModuleFunction:
206
+ Description: 'Checks for usage of `extend self` in modules.'
207
+ Enabled: false
208
+
209
+ Layout/MultilineOperationIndentation:
210
+ EnforcedStyle: indented
211
+
212
+ Style/NegatedIf:
213
+ Description: >-
214
+ Favor unless over if for negative conditions
215
+ (or control flow or).
216
+ Enabled: false
217
+
218
+ Style/NegatedWhile:
219
+ Description: 'Favor until over while for negative conditions.'
220
+ Enabled: false
221
+
222
+ Style/Next:
223
+ Description: 'Use `next` to skip iteration instead of a condition at the end.'
224
+ Enabled: false
225
+
226
+ Style/NilComparison:
227
+ Description: 'Prefer x.nil? to x == nil.'
228
+ Enabled: false
229
+
230
+ Style/NonNilCheck:
231
+ Description: 'Checks for redundant nil checks.'
232
+ Enabled: false
233
+
234
+ Style/Not:
235
+ Description: 'Use ! instead of not.'
236
+ Enabled: false
237
+
238
+ Style/NumericLiterals:
239
+ Description: >-
240
+ Add underscores to large numeric literals to improve their
241
+ readability.
242
+ Enabled: false
243
+
244
+ Metrics/ParameterLists:
245
+ Description: 'Avoid parameter lists longer than three or four parameters.'
246
+ Enabled: false
247
+
248
+ Style/PercentLiteralDelimiters:
249
+ Description: 'Use `%`-literal delimiters consistently'
250
+ Enabled: false
251
+
252
+ Style/PerlBackrefs:
253
+ Description: 'Avoid Perl-style regex back references.'
254
+ Enabled: false
255
+
256
+ Naming/PredicateName:
257
+ Description: 'Check the names of predicate methods.'
258
+ Enabled: false
259
+
260
+ Style/Proc:
261
+ Description: 'Use proc instead of Proc.new.'
262
+ Enabled: false
263
+
264
+ Style/RaiseArgs:
265
+ Description: 'Checks the arguments passed to raise/fail.'
266
+ Enabled: false
267
+
268
+ Style/RedundantBegin:
269
+ Description: "Don't use begin blocks when they are not needed."
270
+ Enabled: false
271
+
272
+ Style/RedundantException:
273
+ Description: "Checks for an obsolete RuntimeException argument in raise/fail."
274
+ Enabled: false
275
+
276
+ Style/RedundantSelf:
277
+ Description: "Don't use self where it's not needed."
278
+ Enabled: false
279
+
280
+ Style/RegexpLiteral:
281
+ Description: >-
282
+ Use %r for regular expressions matching more than
283
+ `MaxSlashes` '/' characters.
284
+ Use %r only for regular expressions matching more than
285
+ `MaxSlashes` '/' character.
286
+ Enabled: false
287
+
288
+ Style/RescueModifier:
289
+ Description: 'Avoid using rescue in its modifier form.'
290
+ Enabled: false
291
+
292
+ Style/SafeNavigation:
293
+ Description: >-
294
+ This cop transforms usages of a method call safeguarded by a check for the
295
+ existance of the object to safe navigation (`&.`).
296
+ Enabled: false
297
+
298
+ Style/SelfAssignment:
299
+ Description: 'Checks for places where self-assignment shorthand should have been used.'
300
+ Enabled: false
301
+
302
+ Style/Semicolon:
303
+ Description: "Don't use semicolons to terminate expressions."
304
+ Enabled: false
305
+
306
+ Style/SignalException:
307
+ Description: 'Checks for proper usage of fail and raise.'
308
+ Enabled: false
309
+
310
+ Style/SingleLineBlockParams:
311
+ Description: 'Enforces the names of some block params.'
312
+ Enabled: false
313
+
314
+ Style/SingleLineMethods:
315
+ Description: 'Avoid single-line methods.'
316
+ Enabled: false
317
+
318
+ Layout/SpaceBeforeFirstArg:
319
+ Description: >-
320
+ Checks that exactly one space is used between a method name
321
+ and the first argument for method calls without parentheses.
322
+ Enabled: false
323
+
324
+ Layout/SpaceAroundKeyword:
325
+ Description: 'Use spaces after if/elsif/unless/while/until/case/when.'
326
+ Enabled: false
327
+
328
+ Layout/SpaceAfterNot:
329
+ Description: Tracks redundant space after the ! operator.
330
+ Enabled: false
331
+
332
+ Layout/SpaceBeforeComment:
333
+ Description: >-
334
+ Checks for missing space between code and a comment on the
335
+ same line.
336
+ Enabled: false
337
+
338
+ Layout/SpaceInsideBlockBraces:
339
+ Description: >-
340
+ Checks that block braces have or don't have surrounding space.
341
+ For blocks taking parameters, checks that the left brace has
342
+ or doesn't have trailing space.
343
+ Enabled: true
344
+
345
+ Layout/SpaceInsideHashLiteralBraces:
346
+ Description: "Use spaces inside hash literal braces - or don't."
347
+ Enabled: true
348
+
349
+ Style/SpecialGlobalVars:
350
+ Description: 'Avoid Perl-style global variables.'
351
+ Enabled: false
352
+
353
+ Style/RedundantCapitalW:
354
+ Description: 'Checks for %W when interpolation is not needed.'
355
+ Enabled: false
356
+
357
+ Style/CommandLiteral:
358
+ Description: 'Checks for %x when `` would do.'
359
+ Enabled: false
360
+
361
+ Style/VariableInterpolation:
362
+ Description: >-
363
+ Don't interpolate global, instance and class variables
364
+ directly in strings.
365
+ Enabled: false
366
+
367
+ Style/WhenThen:
368
+ Description: 'Use when x then ... for one-line cases.'
369
+ Enabled: false
370
+
371
+ Style/WhileUntilDo:
372
+ Description: 'Checks for redundant do after while or until.'
373
+ Enabled: false
374
+
375
+ Style/WhileUntilModifier:
376
+ Description: >-
377
+ Favor modifier while/until usage when you have a
378
+ single-line body.
379
+ Enabled: false
380
+
381
+ Style/FrozenStringLiteralComment:
382
+ Enabled: false
@@ -0,0 +1,45 @@
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
+ AllCops:
9
+ Exclude:
10
+ - 'db/schema.rb'
11
+
12
+ Rails:
13
+ Enabled: true
14
+
15
+ Rails/ActionFilter:
16
+ Description: 'Enforces consistent use of action filter methods.'
17
+ Enabled: false
18
+
19
+ Rails/Delegate:
20
+ Description: 'Prefer delegate method for delegations.'
21
+ Enabled: false
22
+
23
+ Rails/HasAndBelongsToMany:
24
+ Description: 'Prefer has_many :through to has_and_belongs_to_many.'
25
+ Enabled: false
26
+
27
+ Rails/Output:
28
+ Description: 'Checks for calls to puts, print, etc.'
29
+ Enabled: false
30
+
31
+ Rails/ReadWriteAttribute:
32
+ Description: 'Checks for read_attribute(:attr) and write_attribute(:attr, val).'
33
+ Enabled: false
34
+
35
+ Rails/ScopeArgs:
36
+ Description: 'Checks the arguments of ActiveRecord scopes.'
37
+ Enabled: false
38
+
39
+ Rails/Validation:
40
+ Description: 'Use sexy validations.'
41
+ Enabled: false
42
+
43
+ Rails/SkipsModelValidations:
44
+ Description: 'Avoid methods that skip model validations.'
45
+ 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: 3.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Government Digital Service
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-03-03 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: '13.0'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '13.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.80.1
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '='
39
+ - !ruby/object:Gem::Version
40
+ version: 0.80.1
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: []