rubocop-govuk 3.13.0 → 3.17.1
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 +29 -0
- data/README.md +16 -12
- data/config/layout.yml +0 -7
- data/config/rails.yml +52 -0
- data/config/rspec.yml +10 -0
- data/config/style.yml +8 -19
- metadata +31 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ef0a8b1f526bdba1c8152abe1e2c64899667bae4333034e8fe522860a96fedc
|
4
|
+
data.tar.gz: ae376a5117e15ba9ce86e83524df9422c6211d56f3298a24344101ac5cfb24e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f8c2597c64a1842bb5e8c5a9a78fb7dac3b898865c3da60dfad238a0c022ff95bf32cb2f3bee1ffe2ab7e9897378c93670ced073d428613e4bc1267c9e662a5
|
7
|
+
data.tar.gz: 32b99fa71506c6314f783ae30b84f077ec56de20dc6a27f1530fb829581b7b0cbf7404d5cc70aaa1761792f60b886865f2736cddddb125c0ae3b1792a48a7ee9
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
# 3.17.1
|
2
|
+
|
3
|
+
- Pin rubocop-ast to 0.8.0
|
4
|
+
|
5
|
+
# 3.17.0
|
6
|
+
|
7
|
+
- Enable Rails/SaveBang
|
8
|
+
- Enable Style/DateTime
|
9
|
+
- Enforce strict Time.zone.now
|
10
|
+
- Bump rubocop to 0.87.1
|
11
|
+
- Bump rubocop-rspec to 1.42.0
|
12
|
+
|
13
|
+
# 3.16.0
|
14
|
+
|
15
|
+
- Bump and lock rubocop-rails to 2.6.0
|
16
|
+
- Bump and lock rubocop-rspec to 1.39.0
|
17
|
+
|
18
|
+
# 3.15.0
|
19
|
+
|
20
|
+
- Remove cops that are RuboCop defaults (#88)
|
21
|
+
- Disable Rails/DynamicFindBy
|
22
|
+
- Permit "and", "but" with RSpec/ContextWording
|
23
|
+
|
24
|
+
# 3.14.0
|
25
|
+
|
26
|
+
- Disable Rails/InverseOf
|
27
|
+
- Disable Rails/HasManyOrHasOneDependent
|
28
|
+
- Disable Rails/OutputSafety
|
29
|
+
|
1
30
|
# 3.13.0
|
2
31
|
|
3
32
|
- Disable Layout/FirstMethodArgumentLineBreak (#79)
|
data/README.md
CHANGED
@@ -11,35 +11,39 @@ Add `rubocop-govuk` to your Gemfile and then run `bundle install`:
|
|
11
11
|
gem 'rubocop-govuk'
|
12
12
|
```
|
13
13
|
|
14
|
-
|
14
|
+
Then inherit the default rules by adding the following in your project:
|
15
15
|
|
16
16
|
```yaml
|
17
17
|
# .rubocop.yml
|
18
18
|
inherit_gem:
|
19
19
|
rubocop-govuk:
|
20
20
|
- config/default.yml
|
21
|
+
|
22
|
+
inherit_mode:
|
23
|
+
merge:
|
24
|
+
- Exclude
|
21
25
|
```
|
22
26
|
|
23
|
-
|
27
|
+
You can also configure additional rules for Rails and RSpec:
|
24
28
|
|
25
29
|
```yaml
|
26
30
|
# .rubocop.yml
|
27
31
|
inherit_gem:
|
28
32
|
rubocop-govuk:
|
29
|
-
|
33
|
+
...
|
30
34
|
- config/rails.yml
|
31
|
-
|
32
|
-
inherit_mode:
|
33
|
-
merge:
|
34
|
-
- Exclude
|
35
35
|
```
|
36
36
|
|
37
|
-
|
37
|
+
```yaml
|
38
|
+
# .rubocop.yml
|
39
|
+
inherit_gem:
|
40
|
+
rubocop-govuk:
|
41
|
+
...
|
42
|
+
- config/rspec.yml
|
43
|
+
```
|
38
44
|
|
39
|
-
|
45
|
+
## Testing
|
40
46
|
|
41
|
-
|
42
|
-
bundle exec rubocop
|
43
|
-
```
|
47
|
+
Run `bundle exec rake`.
|
44
48
|
|
45
49
|
[guides]: https://github.com/alphagov/styleguides
|
data/config/layout.yml
CHANGED
@@ -1,10 +1,3 @@
|
|
1
|
-
# Part of the orignal GDS styleguide
|
2
|
-
# "Use empty lines between defs and to break up a method into logical paragraphs."
|
3
|
-
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#general
|
4
|
-
Layout/EmptyLineBetweenDefs:
|
5
|
-
Enabled: true
|
6
|
-
AllowAdjacentOneLineDefs: false
|
7
|
-
|
8
1
|
# https://github.com/alphagov/govuk-lint/pull/7
|
9
2
|
# "There are occasions where following this rule forces you to make the
|
10
3
|
# code less readable. This is particularly the case for tests where method
|
data/config/rails.yml
CHANGED
@@ -13,6 +13,17 @@ AllCops:
|
|
13
13
|
Rails:
|
14
14
|
Enabled: true
|
15
15
|
|
16
|
+
# We have custom find_by methods in several repos, which
|
17
|
+
# we're not going to rename. This Cop also raises false
|
18
|
+
# positives for find_by methods that are unrelated to model
|
19
|
+
# classes, as well as for repos using Mongoid. The value
|
20
|
+
# of the consistency this brings is limited, since we mostly
|
21
|
+
# use find_by(key: value) anyway.
|
22
|
+
#
|
23
|
+
# https://github.com/rubocop-hq/rubocop/issues/3758
|
24
|
+
Rails/DynamicFindBy:
|
25
|
+
Enabled: false
|
26
|
+
|
16
27
|
# We commonly print output in Ruby code that has been
|
17
28
|
# extracted from a Rake task in 'lib/'.
|
18
29
|
Rails/Output:
|
@@ -40,3 +51,44 @@ Rails/SkipsModelValidations:
|
|
40
51
|
# relationships are just # many-to-many, and that's it.
|
41
52
|
Rails/HasAndBelongsToMany:
|
42
53
|
Enabled: false
|
54
|
+
|
55
|
+
# While using 'inverse_of' can reduce DB queries, we have
|
56
|
+
# not found this to be a problem in practice. The advantage
|
57
|
+
# of turning this on would be that we make the inverse
|
58
|
+
# behaviour explicit everywhere ActiveRecord can't apply it
|
59
|
+
# automatically, but this is rarely a surprise for developers.
|
60
|
+
# We also don't want to add 'inverse_of: false' everywhere;
|
61
|
+
# at the time of writing, there is no auto-correct for this.
|
62
|
+
Rails/InverseOf:
|
63
|
+
Enabled: false
|
64
|
+
|
65
|
+
# This is incompatible with the more robust use of foreign
|
66
|
+
# key constraints, which provide the same behaviour.
|
67
|
+
#
|
68
|
+
# Example: https://github.com/alphagov/content-publisher/blob/f26d9b551842fdf2084159b5b7f1bb078da56936/db/schema.rb#L396
|
69
|
+
Rails/HasManyOrHasOneDependent:
|
70
|
+
Enabled: false
|
71
|
+
|
72
|
+
# We commonly want to render HTML without escaping it, which
|
73
|
+
# is what 'html_safe' is for. In many cases, the content we
|
74
|
+
# render has already been sanitised (e.g. through Govspeak),
|
75
|
+
# or is otherwise trusted e.g. from a content item. We trust
|
76
|
+
# that developers will use 'html_safe' responsibly, and prefer
|
77
|
+
# the default, escaped output otherwise. At the time of writing,
|
78
|
+
# this Cop is disabled in a lot of repos, indicating it offers
|
79
|
+
# little value to many developers.
|
80
|
+
Rails/OutputSafety:
|
81
|
+
Enabled: false
|
82
|
+
|
83
|
+
# We seldom check the return value of 'update' to see if
|
84
|
+
# the operation was successful. Since we assume success, we
|
85
|
+
# should raise an exception if this is not the case.
|
86
|
+
Rails/SaveBang:
|
87
|
+
Enabled: true
|
88
|
+
|
89
|
+
# We should avoid unnecessary ambiguity between 'Time.current'
|
90
|
+
# and 'Time.zone.now', where 'Time.current' behaves differently
|
91
|
+
# depending on application config. We should always be explicit
|
92
|
+
# about whether we mean 'Time[.zone].now'.
|
93
|
+
Rails/TimeZone:
|
94
|
+
EnforcedStyle: "strict"
|
data/config/rspec.yml
CHANGED
@@ -35,3 +35,13 @@ RSpec/MessageSpies:
|
|
35
35
|
# it's not clear what action to take to fix an issue.
|
36
36
|
RSpec/NestedGroups:
|
37
37
|
Enabled: false
|
38
|
+
|
39
|
+
# Nested contexts make more sense with "and" or "but", since
|
40
|
+
# they are a refinement of an outer context.
|
41
|
+
RSpec/ContextWording:
|
42
|
+
Prefixes:
|
43
|
+
- when
|
44
|
+
- with
|
45
|
+
- without
|
46
|
+
- and
|
47
|
+
- but
|
data/config/style.yml
CHANGED
@@ -13,20 +13,6 @@ Style/IfUnlessModifier:
|
|
13
13
|
Style/MethodCalledOnDoEndBlock:
|
14
14
|
Enabled: true
|
15
15
|
|
16
|
-
# Part of the orignal GDS styleguide
|
17
|
-
# "Omit the parentheses when the method doesn’t accept any arguments"
|
18
|
-
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#syntax
|
19
|
-
Style/MethodCallWithoutArgsParentheses:
|
20
|
-
Enabled: true
|
21
|
-
|
22
|
-
# Part of the orignal GDS styleguide
|
23
|
-
# "Use Ruby 1.9 syntax for symbolic hash keys.
|
24
|
-
# This includes method calls."
|
25
|
-
# https://github.com/alphagov/styleguides/blob/6395a10d41c3938f4c147cda443fd83f854c3e7a/ruby.md#collections
|
26
|
-
Style/HashSyntax:
|
27
|
-
Exclude:
|
28
|
-
- 'db/schema.rb'
|
29
|
-
|
30
16
|
# Part of the orignal GDS styleguide
|
31
17
|
# "Add a trailing comma to multi-line array [...]
|
32
18
|
# for clearer diffs with less line noise."
|
@@ -153,14 +139,17 @@ Style/RegexpLiteral:
|
|
153
139
|
Style/SafeNavigation:
|
154
140
|
Enabled: false
|
155
141
|
|
156
|
-
# We should allow for single line empty methods, as this
|
157
|
-
# is a convention for Rails controller actions.
|
158
|
-
Style/SingleLineMethods:
|
159
|
-
AllowIfMethodIsEmpty: true
|
160
|
-
|
161
142
|
# Introduced in: b171d652d3e434b74ddc621df3b5be24c49bc7e8
|
162
143
|
# This cop was added in preperation for a Ruby feature
|
163
144
|
# that is no longer likely to become part of the language.
|
164
145
|
# https://github.com/rubocop-hq/rubocop/issues/7197
|
165
146
|
Style/FrozenStringLiteralComment:
|
166
147
|
Enabled: false
|
148
|
+
|
149
|
+
# We should only use DateTime when it's necessary to account
|
150
|
+
# for ancient calendar changes. Otherwise, the arbitrary use
|
151
|
+
# of this class in place of Date or Time is confusing.
|
152
|
+
#
|
153
|
+
# https://rubystyle.guide/#no-datetime
|
154
|
+
Style/DateTime:
|
155
|
+
Enabled: true
|
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.17.1
|
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-
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,70 +16,84 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '13
|
19
|
+
version: '13'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '13
|
26
|
+
version: '13'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.87.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.87.1
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rubocop-ast
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.8.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 0.8.0
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
56
|
name: rubocop-rails
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
44
58
|
requirements:
|
45
|
-
- -
|
59
|
+
- - '='
|
46
60
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
61
|
+
version: 2.8.1
|
48
62
|
type: :runtime
|
49
63
|
prerelease: false
|
50
64
|
version_requirements: !ruby/object:Gem::Requirement
|
51
65
|
requirements:
|
52
|
-
- -
|
66
|
+
- - '='
|
53
67
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
68
|
+
version: 2.8.1
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: rubocop-rake
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
58
72
|
requirements:
|
59
|
-
- -
|
73
|
+
- - '='
|
60
74
|
- !ruby/object:Gem::Version
|
61
75
|
version: 0.5.1
|
62
76
|
type: :runtime
|
63
77
|
prerelease: false
|
64
78
|
version_requirements: !ruby/object:Gem::Requirement
|
65
79
|
requirements:
|
66
|
-
- -
|
80
|
+
- - '='
|
67
81
|
- !ruby/object:Gem::Version
|
68
82
|
version: 0.5.1
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: rubocop-rspec
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
|
-
- -
|
87
|
+
- - '='
|
74
88
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
89
|
+
version: 1.42.0
|
76
90
|
type: :runtime
|
77
91
|
prerelease: false
|
78
92
|
version_requirements: !ruby/object:Gem::Requirement
|
79
93
|
requirements:
|
80
|
-
- -
|
94
|
+
- - '='
|
81
95
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
96
|
+
version: 1.42.0
|
83
97
|
description: Shared RuboCop rules for Ruby projects in GOV.UK
|
84
98
|
email:
|
85
99
|
- govuk-dev@digital.cabinet-office.gov.uk
|
@@ -118,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
118
132
|
- !ruby/object:Gem::Version
|
119
133
|
version: '0'
|
120
134
|
requirements: []
|
121
|
-
rubygems_version: 3.1.
|
135
|
+
rubygems_version: 3.1.4
|
122
136
|
signing_key:
|
123
137
|
specification_version: 4
|
124
138
|
summary: RuboCop GOV.UK
|