rubocop-govuk 3.14.0 → 3.17.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 248e60260a8647aef347016c34f825328544408b2d6805dd19b82105570663f1
4
- data.tar.gz: 55966fee3db3a3c27aa56f087629c560dbfd47e6b31945885abce3569c98dc14
3
+ metadata.gz: b616c24ca10792345f9270f1eda98ba66a75a4d1672cf1a917db76596ec8ffd1
4
+ data.tar.gz: 672788da8bcbd07a06a544acb7b746a34cc697446d72c76cf7fd745ffc0e3454
5
5
  SHA512:
6
- metadata.gz: 927073b5c07e0efd223e2a9d3a1bfe726cbbb09f8592171178efb04f0462d025b25615c4164c856523e53f5746eb62c223225c0a5d6d942a1b4c51402e8d274c
7
- data.tar.gz: d3244ce4fdbbbcd3cbdb3e6ea5076dc84f9fcf662d624fec9b5486214ca2fb4125379d33a5c3b14cbeea4b75b5bedc0030441d77393f1586e0e73d631246aee6
6
+ metadata.gz: 2ea901cf52031d78896105a99c1792eb47c2c2d90ce8b14f3ac76c2767e74fed7b6570b309f1a429f5c6416eb51dee99aa90af1faa9b168748337e466f7bd7d0
7
+ data.tar.gz: 1a0373d4ad1b24899a92b916214cc0f8fc097ba1dd2b2962e44a193d28fb7f1c910df1bef8a48f62cb6baddd62a952cd2501decd6c3af9d8d0bbe7817ec8718c
@@ -1,3 +1,30 @@
1
+ # 3.17.2
2
+
3
+ - Rename Blacklist to ForbiddenMethods to fix rubocop-rails warnings
4
+
5
+ # 3.17.1
6
+
7
+ - Pin rubocop-ast to 0.8.0
8
+
9
+ # 3.17.0
10
+
11
+ - Enable Rails/SaveBang
12
+ - Enable Style/DateTime
13
+ - Enforce strict Time.zone.now
14
+ - Bump rubocop to 0.87.1
15
+ - Bump rubocop-rspec to 1.42.0
16
+
17
+ # 3.16.0
18
+
19
+ - Bump and lock rubocop-rails to 2.6.0
20
+ - Bump and lock rubocop-rspec to 1.39.0
21
+
22
+ # 3.15.0
23
+
24
+ - Remove cops that are RuboCop defaults (#88)
25
+ - Disable Rails/DynamicFindBy
26
+ - Permit "and", "but" with RSpec/ContextWording
27
+
1
28
  # 3.14.0
2
29
 
3
30
  - Disable Rails/InverseOf
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
- Inherit rules from the gem by adding the following to your project's RuboCop config:
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
- or if you also need Rails specific rules:
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
- - config/default.yml
33
+ ...
30
34
  - config/rails.yml
31
-
32
- inherit_mode:
33
- merge:
34
- - Exclude
35
35
  ```
36
36
 
37
- ## Usage
37
+ ```yaml
38
+ # .rubocop.yml
39
+ inherit_gem:
40
+ rubocop-govuk:
41
+ ...
42
+ - config/rspec.yml
43
+ ```
38
44
 
39
- Run RuboCop:
45
+ ## Testing
40
46
 
41
- ```sh
42
- bundle exec rubocop
43
- ```
47
+ Run `bundle exec rake`.
44
48
 
45
49
  [guides]: https://github.com/alphagov/styleguides
@@ -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
@@ -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:
@@ -25,7 +36,7 @@ Rails/Output:
25
36
  # no efficient alternative. Instead, we should only enable
26
37
  # this Cop for methods that have a clear alternative.
27
38
  Rails/SkipsModelValidations:
28
- Blacklist:
39
+ ForbiddenMethods:
29
40
  - update_attribute
30
41
 
31
42
  # While using has_many/through does have some advantages,
@@ -68,3 +79,16 @@ Rails/HasManyOrHasOneDependent:
68
79
  # little value to many developers.
69
80
  Rails/OutputSafety:
70
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"
@@ -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
@@ -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.14.0
4
+ version: 3.17.2
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-22 00:00:00.000000000 Z
11
+ date: 2020-10-14 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.0'
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.0'
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.83.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.83.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: '2'
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: '2'
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: '1.28'
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: '1.28'
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.3
135
+ rubygems_version: 3.1.4
122
136
  signing_key:
123
137
  specification_version: 4
124
138
  summary: RuboCop GOV.UK