rubocop-govuk 3.11.0 → 3.16.0

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: c913a7eee4164badca90121c68221e58784c2a982b9d77edc95a2efb40307e1b
4
- data.tar.gz: 970496645c0749dcae4fcf588f3579ded14a5819cb4d17e0e9fc303cae15b0bd
3
+ metadata.gz: bbde5e0b6a71966c3c76a712077229e4be9de9ab400a3ad54e43ce55a98d2920
4
+ data.tar.gz: f09db889982c986669ce7a6ab535f3d8011d2725ee65aa5aa92df451e2cb406a
5
5
  SHA512:
6
- metadata.gz: b98cb3980e29b44f0aaeddd15977ace72241019aae4b01ad7c037e1bab32b23cad77dafc7e4a39cd88a2bbc3eeb67c7739b899ca1413edbd962bb2383f5c4b56
7
- data.tar.gz: 218ff2564b26902b9f12e472fbe780678cc93b41ea360fa71d913de9ac665651332df109ae5d5f519e2f32dbb653aa9247ad0dda4d29cd4f900745cd03a1f4d6
6
+ metadata.gz: bed4ce6b4dc5eb4633258405831b182e72f495738b3152eca931623069a35cbf37322e3788da43c616960cfe1a668871ba41b26d9104e98416853d86ba03b83a
7
+ data.tar.gz: b299bbdb9ec85294230c07239cec79e256d39f3203257ba2fe6ae8ef1c2da53a64ea93911564d2de01b3c3174e5bb602949da656f27240b3c144f9c1f190fabd
@@ -1,3 +1,29 @@
1
+ # 3.16.0
2
+
3
+ - Bump and lock rubocop-rails to 2.6.0
4
+ - Bump and lock rubocop-rspec to 1.39.0
5
+
6
+ # 3.15.0
7
+
8
+ - Remove cops that are RuboCop defaults (#88)
9
+ - Disable Rails/DynamicFindBy
10
+ - Permit "and", "but" with RSpec/ContextWording
11
+
12
+ # 3.14.0
13
+
14
+ - Disable Rails/InverseOf
15
+ - Disable Rails/HasManyOrHasOneDependent
16
+ - Disable Rails/OutputSafety
17
+
18
+ # 3.13.0
19
+
20
+ - Disable Layout/FirstMethodArgumentLineBreak (#79)
21
+ - Disable Layout/MultilineMethodArgumentLineBreaks (#80)
22
+
23
+ # 3.12.0
24
+
25
+ - Disable Rails/HasAndBelongsToMany (#77)
26
+
1
27
  # 3.11.0
2
28
 
3
29
  - Add optional config for RSpec Cops (#75)
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
@@ -83,17 +76,3 @@ Layout/MultilineArrayLineBreaks:
83
76
  # and avoids wasting time tweaking an arbitrary layout.
84
77
  Layout/MultilineHashKeyLineBreaks:
85
78
  Enabled: true
86
-
87
- # We should be consistent: if some items of a method call are
88
- # on multiple lines, then all items should be. This works
89
- # better with the indentation Cops, produces clearer diffs,
90
- # and avoids wasting time tweaking an arbitrary layout.
91
- Layout/MultilineMethodArgumentLineBreaks:
92
- Enabled: true
93
-
94
- # We should put each argument of a method call on a new line,
95
- # if any are on new lines. This prevents unnecessary decisions
96
- # about which style to use; the multiline style also helps to
97
- # avoid excessively long lines.
98
- Layout/FirstMethodArgumentLineBreak:
99
- Enabled: true
@@ -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:
@@ -27,3 +38,44 @@ Rails/Output:
27
38
  Rails/SkipsModelValidations:
28
39
  Blacklist:
29
40
  - update_attribute
41
+
42
+ # While using has_many/through does have some advantages,
43
+ # it also requires a significant amount of boilerplate code:
44
+ #
45
+ # - An additional 'has_many :join_table' statement
46
+ # - An additional class for the join table (model)
47
+ #
48
+ # This Cop/rule appears to have been written with the
49
+ # assumption that all join tables have inherent meaning,
50
+ # we want to represent, which is not the case; sometimes
51
+ # relationships are just # many-to-many, and that's it.
52
+ Rails/HasAndBelongsToMany:
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
@@ -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,11 +139,6 @@ 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.
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.11.0
4
+ version: 3.16.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-19 00:00:00.000000000 Z
11
+ date: 2020-06-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -16,70 +16,70 @@ 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.85.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.85.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-rails
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: '2'
47
+ version: 2.6.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
- version: '2'
54
+ version: 2.6.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop-rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.5.1
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.5.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '1.28'
75
+ version: 1.39.0
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '1.28'
82
+ version: 1.39.0
83
83
  description: Shared RuboCop rules for Ruby projects in GOV.UK
84
84
  email:
85
85
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.1.3
121
+ rubygems_version: 3.1.4
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: RuboCop GOV.UK