rubocop-govuk 4.0.0.pre.1 → 4.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -0
  3. data/CONTRIBUTING.md +78 -0
  4. data/README.md +15 -5
  5. metadata +24 -23
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 884a324d47c9f299b7cc0c72c2cb40b2bb61d5fae4385a14ac380da58d9585c6
4
- data.tar.gz: ee81a830fb4d49f7caf8df86161e7df83df2502c122f4512eed9e6403c9fc38b
3
+ metadata.gz: 289399d01ee5d1a8590059c2aee8bff35beae003f2619cdf14df5c82705e3eda
4
+ data.tar.gz: bf64e8af637d6f5740934461c7c5a1158431611f3200ea956ab15331261e3598
5
5
  SHA512:
6
- metadata.gz: ad5c46c656afc890833c05899851f0288529957d6d0f0b0f7f1b7a246a5c34b0d8cd1e7b02c98f330c96643a0f1ce667b2378a0037ca41da9bdc0b15cb61cee7
7
- data.tar.gz: 78732fc5680817d9cdacd6b27469d03bea5bfae201d1cf6cba568e1e716258d16ae302945bf23917e8fe026aaaf9fe3b0885d5d73c0d008d2240833c69b92cea
6
+ metadata.gz: 20b28eaec30fdef4836cc1a6c0bd0a33ea0c5a32840d1111664f33a122af8953e74581bb00ae1116dc06cb06c01ab2343b5335b3c4fca25764db3f71b2d1c2c1
7
+ data.tar.gz: baa0c089a591ea753464834a3b9cb0e9085ddc52582d31bb3addc2d40a987c4b176dd623e8ee9f9e7f095d5d83aab6010b5f20e94358137eebcb7ccc310a3bb7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,32 @@
1
+ # 4.3.0
2
+
3
+ - Update rubocop to 1.25.0
4
+ - Update rubocop-ast to 1.15.1
5
+ - Update rubocop-rails to 2.13.2
6
+ - Update rubocop-rspec to 2.7.0
7
+
8
+ # 4.2.0
9
+
10
+ - Update rubocop to 1.23.0
11
+ - Update rubocop-ast to 1.13.0
12
+ - Update rubocop-rails to 2.12.4
13
+ - Update rubocop-rspec to 2.6.0
14
+
15
+ # 4.1.0
16
+
17
+ - Update rubocop to 1.21.0
18
+ - Update rubocop-ast to 1.11.0
19
+ - Update rubocop-rails to 2.12.0
20
+ - Update rubocop-rspec to 2.4.0
21
+ - Update rubocop-rake to 0.6.0
22
+
23
+ # 4.0.0
24
+
25
+ - Update rubocop to 1.15.0
26
+ - Update rubocop-ast to 1.6.0
27
+ - Update rubocop-rails to 2.10.0
28
+ - Update rubocop-rspec to 2.3.0
29
+
1
30
  # 4.0.0.pre.1
2
31
 
3
32
  - Released as a pre-release to try surface any issues before wider rollout,
data/CONTRIBUTING.md ADDED
@@ -0,0 +1,78 @@
1
+ # Contributing
2
+
3
+ This guidance is intended for changes to:
4
+
5
+ - versions of dependencies for this repo (e.g. RuboCop itself); and
6
+ - the [extra config we have](https://github.com/alphagov/rubocop-govuk/tree/main/config) to support historical GOV.UK patterns.
7
+
8
+ All dependencies should be [locked to patch versions to avoid surprise upgrades](https://github.com/alphagov/rubocop-govuk/pull/154) in consumer repos.
9
+
10
+ ## Getting started
11
+
12
+ To install dependencies:
13
+
14
+ ```bash
15
+ bundle
16
+ ```
17
+
18
+ To lint the config / Rakefile:
19
+
20
+ ```bash
21
+ bundle exec rake
22
+ ```
23
+
24
+ RuboCop GOV.UK is a styleguide, so each rule in each YAML file should have a comment to explain why it's there. This is enforced by linting with [a custom `explain_yourself` rake task](https://github.com/alphagov/rubocop-govuk/blob/main/Rakefile).
25
+
26
+ ## Doing a release
27
+
28
+ ### 1. Check what the impact is going to be
29
+
30
+ Find out how much effort it will be to adopt your changes in typical GOV.UK repos. This could just be running `rubocop -A` to autocorrect new issues, or it could involve significant manual effort.
31
+
32
+ You can test changes locally by tweaking the Gemfile or `.gemspec` for the repo e.g.
33
+
34
+ ```
35
+ gem "rubocop-govuk", path: "/govuk/rubocop-govuk"
36
+ ```
37
+
38
+ This is a rough list of typical GOV.UK repos we recommend testing against:
39
+
40
+ - An old app e.g. Whitehall, Smart Answers
41
+ - A newer app e.g. Content Publisher, Email Alert API
42
+ - A non-Rails app e.g. Search API
43
+ - A gem e.g. GDS API Adapters
44
+
45
+ ### 2. Decide if the config needs to change
46
+
47
+ Ideally we should have none of our own config and follow RuboCop defaults:
48
+
49
+ - This is easier than making our own decisions.
50
+ - We don't want to diverge from the Ruby community.
51
+
52
+ However, we also want to make it easy for all GOV.UK repos to keep pace with RuboCop GOV.UK. This means we should **try to ensure all issues can be auto-corrected or are easy to fix manually**.
53
+
54
+ You should only change the config as a last resort. Examples of good changes:
55
+
56
+ - Disable a rule if it's based on heuristics ([example](https://github.com/alphagov/rubocop-govuk/blob/ce655779e45892db6ac00d6789c652ec2e506748/config/metrics.yml#L1-L10)).
57
+
58
+ - Change a rule to match a GOV.UK-wide pattern ([example](https://github.com/alphagov/rubocop-govuk/blob/ce655779e45892db6ac00d6789c652ec2e506748/config/rails.yml#L16-L25)).
59
+
60
+ - Change a rule if the effort to fix is *very* high ([example](https://github.com/alphagov/rubocop-govuk/blob/ce655779e45892db6ac00d6789c652ec2e506748/config/rspec.yml#L33-L35)).
61
+
62
+ Sometimes it's more appropriate to put config overrides in the `.rubocop.yml` file of consumer repos ([example](https://github.com/alphagov/content-store/blob/857275148323fc9536490aefc253c8a9e73a175a/.rubocop.yml#L10-L12)). Use this approach if the override is only necessary in a small number of repos.
63
+
64
+ ### 3. Consider making a pre-release version
65
+
66
+ This can be helpful if there are lots of changes where it's hard to assess the impact e.g. a major dependency upgrade. Use the pre-release version to gather feedback from maintainers of consumer repos, working with them to make any necessary adjustments here before releasing the next official version.
67
+
68
+ 👉 [Example of major release after testing a pre-release version](https://github.com/alphagov/rubocop-govuk/compare/v4.0.0.pre.1...v4.0.0).
69
+
70
+ ### 4. Make your CHANGELOG really helpful
71
+
72
+ The [CHANGELOG.md](CHANGELOG.md) is what maintainers of consumer repos will use to understand your changes. Tools like Dependabot will automatically include it in PR descriptions. A helpful changelog:
73
+
74
+ - Gives an overview of the change e.g. "Upgrade X to Y".
75
+
76
+ - Explains any actions to take e.g. "run `rubocop -A`".
77
+
78
+ - Advises on potential compatibility issues (TODO: example).
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # RuboCop GOV.UK
2
2
 
3
- This repository provides common RuboCop rules for use with GOV.UK Ruby projects to comply with our [style guides][guides].
3
+ Defines the linting rules for GDS Ruby applications, primarily those associated with GOV.UK.
4
+
5
+ GOV.UK has used a styleguide for many years, starting with rules in written form, which we then [automated with RuboCop](https://github.com/alphagov/styleguides/commit/cb589cdc4ba17f9c341f4db75900e554dd042672#diff-99f257b41e6471357be7e37c3a41d79045d11f7f0ae1000d6f7fc63b502273e7) and later [moved into this repo](https://github.com/alphagov/govuk-rfcs/blob/main/rfc-100-linting.md#proposal). A styleguide is a valuable asset: it keeps our code consistent and prevents stylistic squabbles. Everyone on GOV.UK is encouraged to use it in their Ruby projects and [contribute](CONTRIBUTING.md) to dependency upgrades and new releases, keeping pace with the rest of the Ruby community.
4
6
 
5
7
  ## Installation
6
8
 
@@ -22,6 +24,16 @@ inherit_gem:
22
24
  inherit_mode:
23
25
  merge:
24
26
  - Exclude
27
+
28
+ # **************************************************************
29
+ # TRY NOT TO ADD OVERRIDES IN THIS FILE
30
+ #
31
+ # This repo is configured to follow the RuboCop GOV.UK styleguide.
32
+ # Any rules you override here will cause this repo to diverge from
33
+ # the way we write code in all other GOV.UK repos.
34
+ #
35
+ # See https://github.com/alphagov/rubocop-govuk/blob/main/CONTRIBUTING.md
36
+ # **************************************************************
25
37
  ```
26
38
 
27
39
  You can also configure additional rules for Rails and RSpec:
@@ -42,8 +54,6 @@ inherit_gem:
42
54
  - config/rspec.yml
43
55
  ```
44
56
 
45
- ## Testing
46
-
47
- Run `bundle exec rake`.
57
+ ## Contributing
48
58
 
49
- [guides]: https://github.com/alphagov/styleguides
59
+ Rules in this repo are defined based on their compatibility with GOV.UK apps and their code conventions. Everyone else is welcome to use it and suggest changes - see [CONTRIBUTING.md](CONTRIBUTING.md) for more details.
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: 4.0.0.pre.1
4
+ version: 4.3.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: 2021-02-22 00:00:00.000000000 Z
11
+ date: 2022-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -28,72 +28,72 @@ dependencies:
28
28
  name: rubocop
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 1.10.0
33
+ version: 1.25.0
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: 1.10.0
40
+ version: 1.25.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop-ast
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
- version: 1.4.0
47
+ version: 1.15.1
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: 1.4.0
54
+ version: 1.15.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rubocop-rails
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: 2.9.1
61
+ version: 2.13.2
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
- version: 2.9.1
68
+ version: 2.13.2
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop-rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.5.1
75
+ version: 0.6.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: 0.5.1
82
+ version: 0.6.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rubocop-rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: 2.2.0
89
+ version: 2.7.0
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: 2.2.0
96
+ version: 2.7.0
97
97
  description: Shared RuboCop rules for Ruby projects in GOV.UK
98
98
  email:
99
99
  - govuk-dev@digital.cabinet-office.gov.uk
@@ -102,6 +102,7 @@ extensions: []
102
102
  extra_rdoc_files: []
103
103
  files:
104
104
  - CHANGELOG.md
105
+ - CONTRIBUTING.md
105
106
  - LICENSE.md
106
107
  - README.md
107
108
  - config/capybara.yml
@@ -128,11 +129,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
128
129
  version: '2.6'
129
130
  required_rubygems_version: !ruby/object:Gem::Requirement
130
131
  requirements:
131
- - - ">"
132
+ - - ">="
132
133
  - !ruby/object:Gem::Version
133
- version: 1.3.1
134
+ version: '0'
134
135
  requirements: []
135
- rubygems_version: 3.2.11
136
+ rubygems_version: 3.3.5
136
137
  signing_key:
137
138
  specification_version: 4
138
139
  summary: RuboCop GOV.UK