rubocop-govuk 4.1.0 → 4.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +22 -0
- data/CONTRIBUTING.md +78 -0
- data/README.md +15 -5
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00c4130e9d1debf97c4ffffd28018196c0e16bd5ddd86ad82c7867a0b40178fb
|
4
|
+
data.tar.gz: '0296f435ac866e149f62ec26df19c02e06288ea993d49d4c04020889a6904a62'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7003f98c88ddf30f65254b9a9aad897f982d4b0dec857bb8fa854d3de97ec40a2c8d92bd647a32d3309cbeb694a748c14cea8eaf7072a9a3fe29d048a5ba6b1
|
7
|
+
data.tar.gz: ada44a9f94b81285c3102bf3c785d5b78d38d24916ba8d15b76842e19e45901126d651cbdeb19be156d068068dc966ce89b37d3fbc263e9d28d16e5b3ee0b612
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,25 @@
|
|
1
|
+
# 4.4.0
|
2
|
+
|
3
|
+
- Update rubocop to 1.27.0
|
4
|
+
- Update rubocop-ast to 1.17.0
|
5
|
+
- Update rubocop-rails to 2.14.2
|
6
|
+
- Update rubocop-rspec to 2.10.0
|
7
|
+
- Drop support for Ruby 2.6
|
8
|
+
|
9
|
+
# 4.3.0
|
10
|
+
|
11
|
+
- Update rubocop to 1.25.0
|
12
|
+
- Update rubocop-ast to 1.15.1
|
13
|
+
- Update rubocop-rails to 2.13.2
|
14
|
+
- Update rubocop-rspec to 2.7.0
|
15
|
+
|
16
|
+
# 4.2.0
|
17
|
+
|
18
|
+
- Update rubocop to 1.23.0
|
19
|
+
- Update rubocop-ast to 1.13.0
|
20
|
+
- Update rubocop-rails to 2.12.4
|
21
|
+
- Update rubocop-rspec to 2.6.0
|
22
|
+
|
1
23
|
# 4.1.0
|
2
24
|
|
3
25
|
- Update rubocop to 1.21.0
|
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
|
-
|
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
|
-
##
|
46
|
-
|
47
|
-
Run `bundle exec rake`.
|
57
|
+
## Contributing
|
48
58
|
|
49
|
-
[
|
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.
|
4
|
+
version: 4.4.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:
|
11
|
+
date: 2022-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -30,42 +30,42 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.
|
33
|
+
version: 1.27.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.
|
40
|
+
version: 1.27.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.
|
47
|
+
version: 1.17.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: 1.
|
54
|
+
version: 1.17.0
|
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.
|
61
|
+
version: 2.14.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.
|
68
|
+
version: 2.14.2
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rubocop-rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -86,14 +86,14 @@ dependencies:
|
|
86
86
|
requirements:
|
87
87
|
- - '='
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 2.
|
89
|
+
version: 2.10.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.
|
96
|
+
version: 2.10.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
|
@@ -125,14 +126,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
126
|
requirements:
|
126
127
|
- - ">="
|
127
128
|
- !ruby/object:Gem::Version
|
128
|
-
version: '2.
|
129
|
+
version: '2.7'
|
129
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
130
131
|
requirements:
|
131
132
|
- - ">="
|
132
133
|
- !ruby/object:Gem::Version
|
133
134
|
version: '0'
|
134
135
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
136
|
+
rubygems_version: 3.3.11
|
136
137
|
signing_key:
|
137
138
|
specification_version: 4
|
138
139
|
summary: RuboCop GOV.UK
|