rubocop-govuk 3.10.0 → 3.11.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +9 -0
- data/config/capybara.yml +5 -0
- data/config/default.yml +0 -4
- data/config/layout.yml +0 -3
- data/config/metrics.yml +0 -4
- data/config/naming.yml +4 -3
- data/config/rails.yml +11 -14
- data/config/rspec.yml +37 -0
- data/config/style.yml +9 -26
- metadata +4 -3
- data/config/bundler.yml +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c913a7eee4164badca90121c68221e58784c2a982b9d77edc95a2efb40307e1b
|
4
|
+
data.tar.gz: 970496645c0749dcae4fcf588f3579ded14a5819cb4d17e0e9fc303cae15b0bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b98cb3980e29b44f0aaeddd15977ace72241019aae4b01ad7c037e1bab32b23cad77dafc7e4a39cd88a2bbc3eeb67c7739b899ca1413edbd962bb2383f5c4b56
|
7
|
+
data.tar.gz: 218ff2564b26902b9f12e472fbe780678cc93b41ea360fa71d913de9ac665651332df109ae5d5f519e2f32dbb653aa9247ad0dda4d29cd4f900745cd03a1f4d6
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
+
# 3.11.0
|
2
|
+
|
3
|
+
- Add optional config for RSpec Cops (#75)
|
4
|
+
- Enable Style/Next (#74)
|
5
|
+
- Partially enable Rails/SkipsModelValidations (#74)
|
6
|
+
- Partially enable Rails/Output (#74)
|
7
|
+
- Enable Rails/HasAndBelongsToMany (#74)
|
8
|
+
- Enable Bundler/DuplicatedGem (#74)
|
9
|
+
|
1
10
|
# 3.10.0
|
2
11
|
|
3
12
|
* Enable Style/NegatedIf (#71)
|
data/config/capybara.yml
ADDED
data/config/default.yml
CHANGED
@@ -10,19 +10,15 @@ AllCops:
|
|
10
10
|
- 'node_modules/**/*'
|
11
11
|
|
12
12
|
DisplayCopNames:
|
13
|
-
Description: 'Display cop names in offense messages'
|
14
13
|
Enabled: true
|
15
14
|
|
16
15
|
ExtraDetails:
|
17
|
-
Description: 'Display extra details in offense messages.'
|
18
16
|
Enabled: true
|
19
17
|
|
20
18
|
DisplayStyleGuide:
|
21
|
-
Description: 'Display style guide URLs in offense messages.'
|
22
19
|
Enabled: true
|
23
20
|
|
24
21
|
inherit_from:
|
25
|
-
- bundler.yml
|
26
22
|
- layout.yml
|
27
23
|
- metrics.yml
|
28
24
|
- naming.yml
|
data/config/layout.yml
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
# "Use empty lines between defs and to break up a method into logical paragraphs."
|
3
3
|
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#general
|
4
4
|
Layout/EmptyLineBetweenDefs:
|
5
|
-
Description: Use empty lines between defs.
|
6
5
|
Enabled: true
|
7
6
|
AllowAdjacentOneLineDefs: false
|
8
7
|
|
@@ -12,7 +11,6 @@ Layout/EmptyLineBetweenDefs:
|
|
12
11
|
# names form the test descriptions. Keeping test descriptions under a
|
13
12
|
# certain length can force them to become cryptic."
|
14
13
|
Layout/LineLength:
|
15
|
-
Description: Limit lines to 80 characters.
|
16
14
|
Enabled: false
|
17
15
|
|
18
16
|
# We have two styles of method call in our apps:
|
@@ -33,7 +31,6 @@ Layout/MultilineMethodCallIndentation:
|
|
33
31
|
# "Outdent private etc"
|
34
32
|
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#classes
|
35
33
|
Layout/AccessModifierIndentation:
|
36
|
-
Description: Check indentation of private/protected visibility modifiers.
|
37
34
|
Enabled: true
|
38
35
|
EnforcedStyle: outdent
|
39
36
|
|
data/config/metrics.yml
CHANGED
@@ -46,7 +46,6 @@ Metrics/PerceivedComplexity:
|
|
46
46
|
# We should avoid cops that are based on heuristics, since
|
47
47
|
# it's not clear what action to take to fix an issue.
|
48
48
|
Metrics/BlockNesting:
|
49
|
-
Description: 'Avoid excessive block nesting'
|
50
49
|
Enabled: false
|
51
50
|
|
52
51
|
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
@@ -55,7 +54,6 @@ Metrics/BlockNesting:
|
|
55
54
|
# We should avoid cops that are based on heuristics, since
|
56
55
|
# it's not clear what action to take to fix an issue.
|
57
56
|
Metrics/CyclomaticComplexity:
|
58
|
-
Description: 'Avoid complex methods.'
|
59
57
|
Enabled: false
|
60
58
|
|
61
59
|
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
@@ -64,7 +62,6 @@ Metrics/CyclomaticComplexity:
|
|
64
62
|
# We should avoid cops that are based on heuristics, since
|
65
63
|
# it's not clear what action to take to fix an issue.
|
66
64
|
Metrics/MethodLength:
|
67
|
-
Description: 'Avoid methods longer than 10 lines of code.'
|
68
65
|
Enabled: false
|
69
66
|
|
70
67
|
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
@@ -73,5 +70,4 @@ Metrics/MethodLength:
|
|
73
70
|
# We should avoid cops that are based on heuristics, since
|
74
71
|
# it's not clear what action to take to fix an issue.
|
75
72
|
Metrics/ParameterLists:
|
76
|
-
Description: 'Avoid parameter lists longer than three or four parameters.'
|
77
73
|
Enabled: false
|
data/config/naming.yml
CHANGED
@@ -13,8 +13,9 @@
|
|
13
13
|
Naming/AccessorMethodName:
|
14
14
|
Enabled: false
|
15
15
|
|
16
|
-
#
|
17
|
-
#
|
16
|
+
# We should be free to decide on interfaces that make sense to us.
|
17
|
+
# At the time of writing, this Cop is not auto-correctable, and
|
18
|
+
# would generate a prohibitively high number of issues across our
|
19
|
+
# repos, which would require manual intervention.
|
18
20
|
Naming/PredicateName:
|
19
|
-
Description: 'Check the names of predicate methods.'
|
20
21
|
Enabled: false
|
data/config/rails.yml
CHANGED
@@ -13,20 +13,17 @@ AllCops:
|
|
13
13
|
Rails:
|
14
14
|
Enabled: true
|
15
15
|
|
16
|
-
#
|
17
|
-
#
|
18
|
-
Rails/HasAndBelongsToMany:
|
19
|
-
Description: 'Prefer has_many :through to has_and_belongs_to_many.'
|
20
|
-
Enabled: false
|
21
|
-
|
22
|
-
# Introduced in: c69a7eb3af955d6c4c0cf0c3cec8e9f330c74429
|
23
|
-
# TODO: unclear why this is here!
|
16
|
+
# We commonly print output in Ruby code that has been
|
17
|
+
# extracted from a Rake task in 'lib/'.
|
24
18
|
Rails/Output:
|
25
|
-
|
26
|
-
|
19
|
+
Exclude:
|
20
|
+
- 'lib/**/*.rb'
|
27
21
|
|
28
|
-
#
|
29
|
-
#
|
22
|
+
# It's unclear what remedial action to take for the total
|
23
|
+
# set of methods this Cop has issues with. For example, we
|
24
|
+
# use 'update_all' in many of our repos, for which there is
|
25
|
+
# no efficient alternative. Instead, we should only enable
|
26
|
+
# this Cop for methods that have a clear alternative.
|
30
27
|
Rails/SkipsModelValidations:
|
31
|
-
|
32
|
-
|
28
|
+
Blacklist:
|
29
|
+
- update_attribute
|
data/config/rspec.yml
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
require: rubocop-rspec
|
2
|
+
|
3
|
+
inherit_from:
|
4
|
+
- capybara.yml
|
5
|
+
|
6
|
+
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
7
|
+
#
|
8
|
+
# We should avoid cops that are based on heuristics, since
|
9
|
+
# it's not clear what action to take to fix an issue.
|
10
|
+
RSpec/ExampleLength:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# We have common cases, such as rake tasks, where we do not
|
14
|
+
# use a class to the describe the test.
|
15
|
+
RSpec/DescribeClass:
|
16
|
+
Enabled: false
|
17
|
+
|
18
|
+
# We accept multiple expectations (within reason), preferring
|
19
|
+
# them to running mulitple similar tests.
|
20
|
+
RSpec/MultipleExpectations:
|
21
|
+
Enabled: false
|
22
|
+
|
23
|
+
# Part of the GOV.UK feature style involves instance variables.
|
24
|
+
RSpec/InstanceVariable:
|
25
|
+
Exclude:
|
26
|
+
- 'spec/features/**/*.rb'
|
27
|
+
|
28
|
+
# In GOV.UK we quite often test that a class received a method.
|
29
|
+
RSpec/MessageSpies:
|
30
|
+
Enabled: false
|
31
|
+
|
32
|
+
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
33
|
+
#
|
34
|
+
# We should avoid cops that are based on heuristics, since
|
35
|
+
# it's not clear what action to take to fix an issue.
|
36
|
+
RSpec/NestedGroups:
|
37
|
+
Enabled: false
|
data/config/style.yml
CHANGED
@@ -5,21 +5,18 @@
|
|
5
5
|
# line statements to re-written makes it a harder
|
6
6
|
# to follow the branching logic."
|
7
7
|
Style/IfUnlessModifier:
|
8
|
-
Description: Favor modifier if/unless usage when you have a single-line body.
|
9
8
|
Enabled: false
|
10
9
|
|
11
10
|
# Part of the orignal GDS styleguide
|
12
11
|
# "Never chain do...end"
|
13
12
|
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#syntax
|
14
13
|
Style/MethodCalledOnDoEndBlock:
|
15
|
-
Description: Avoid chaining a method call on a do...end block.
|
16
14
|
Enabled: true
|
17
15
|
|
18
16
|
# Part of the orignal GDS styleguide
|
19
17
|
# "Omit the parentheses when the method doesn’t accept any arguments"
|
20
18
|
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#syntax
|
21
19
|
Style/MethodCallWithoutArgsParentheses:
|
22
|
-
Description: 'Do not use parentheses for method calls with no arguments.'
|
23
20
|
Enabled: true
|
24
21
|
|
25
22
|
# Part of the orignal GDS styleguide
|
@@ -116,10 +113,12 @@ Style/AsciiComments:
|
|
116
113
|
Style/BlockDelimiters:
|
117
114
|
EnforcedStyle: braces_for_chaining
|
118
115
|
|
119
|
-
#
|
120
|
-
#
|
116
|
+
# We have no concensus on this. Using the nested style is the
|
117
|
+
# default for generated Rails app (see 'config/application.rb').
|
118
|
+
# Using the compact style can help to reduce boilerplate within
|
119
|
+
# modules. At the time of writing, the auto-correct for this Cop
|
120
|
+
# is unsafe for moving to either style.
|
121
121
|
Style/ClassAndModuleChildren:
|
122
|
-
Description: 'Checks style of children classes and modules.'
|
123
122
|
Enabled: false
|
124
123
|
|
125
124
|
# Introduced in: c69a7eb3af955d6c4c0cf0c3cec8e9f330c74429
|
@@ -128,7 +127,6 @@ Style/ClassAndModuleChildren:
|
|
128
127
|
# more documentation is the potential for confusion if that
|
129
128
|
# documentation gets out-of-sync with the class/module.
|
130
129
|
Style/Documentation:
|
131
|
-
Description: 'Document classes and non-namespace modules.'
|
132
130
|
Enabled: false
|
133
131
|
|
134
132
|
# Introduced in: c69a7eb3af955d6c4c0cf0c3cec8e9f330c74429
|
@@ -138,13 +136,6 @@ Style/Documentation:
|
|
138
136
|
# "There are occasions where following this rule forces you to make the
|
139
137
|
# code less readable."
|
140
138
|
Style/GuardClause:
|
141
|
-
Description: 'Check for conditionals that can be replaced with guard clauses'
|
142
|
-
Enabled: false
|
143
|
-
|
144
|
-
# Introduced in: c69a7eb3af955d6c4c0cf0c3cec8e9f330c74429
|
145
|
-
# TODO: unclear why this is here!
|
146
|
-
Style/Next:
|
147
|
-
Description: 'Use `next` to skip iteration instead of a condition at the end.'
|
148
139
|
Enabled: false
|
149
140
|
|
150
141
|
# Analog of: 736b3d295f88b9ba6676fc168b823535582388c2
|
@@ -153,21 +144,13 @@ Style/Next:
|
|
153
144
|
# We should avoid cops that are based on heuristics, since
|
154
145
|
# it's not clear what action to take to fix an issue.
|
155
146
|
Style/RegexpLiteral:
|
156
|
-
Description: >-
|
157
|
-
Use %r for regular expressions matching more than
|
158
|
-
`MaxSlashes` '/' characters.
|
159
|
-
Use %r only for regular expressions matching more than
|
160
|
-
`MaxSlashes` '/' character.
|
161
147
|
Enabled: false
|
162
148
|
|
163
|
-
#
|
164
|
-
#
|
165
|
-
#
|
166
|
-
#
|
149
|
+
# Using safe navigation is less explicit than making a clear
|
150
|
+
# check for truthiness, as evidenced by its own safelist for
|
151
|
+
# certain methods. Safe navigation is also less visible and
|
152
|
+
# pollutes otherwise readable method calls.
|
167
153
|
Style/SafeNavigation:
|
168
|
-
Description: >-
|
169
|
-
This cop transforms usages of a method call safeguarded by a check for the
|
170
|
-
existance of the object to safe navigation (`&.`).
|
171
154
|
Enabled: false
|
172
155
|
|
173
156
|
# We should allow for single line empty methods, as this
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-govuk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Government Digital Service
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -90,13 +90,14 @@ files:
|
|
90
90
|
- CHANGELOG.md
|
91
91
|
- LICENSE.md
|
92
92
|
- README.md
|
93
|
-
- config/
|
93
|
+
- config/capybara.yml
|
94
94
|
- config/default.yml
|
95
95
|
- config/layout.yml
|
96
96
|
- config/metrics.yml
|
97
97
|
- config/naming.yml
|
98
98
|
- config/rails.yml
|
99
99
|
- config/rake.yml
|
100
|
+
- config/rspec.yml
|
100
101
|
- config/style.yml
|
101
102
|
homepage: https://github.com/alphagov/rubocop-govuk
|
102
103
|
licenses:
|
data/config/bundler.yml
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
# Introduced in: 278fc6e903834acfb37565795a196b85282560b0
|
2
|
-
# "A common pattern in our Gemfiles is to declare a gem
|
3
|
-
# differently if we're in a dev mode or not. For example
|
4
|
-
#
|
5
|
-
# if ENV['API_DEV']
|
6
|
-
# gem 'gds-api-adapters', path: '../gds-api-adapters'
|
7
|
-
# else
|
8
|
-
# gem 'gds-api-adapters', "~> 50.8.0"
|
9
|
-
# end"
|
10
|
-
# TODO: see if we can remove this (no longer valid??)
|
11
|
-
Bundler/DuplicatedGem:
|
12
|
-
Enabled: false
|