rubocop-govuk 4.1.0 → 4.2.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 +7 -0
  3. data/CONTRIBUTING.md +78 -0
  4. data/README.md +5 -5
  5. metadata +12 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 414ff4213da8a8ea70821cb630647952e771f98d01279d790463a92bcf350ac2
4
- data.tar.gz: 7db52250855d45d7315911320daa0f659c2a0f646d708b5ad94f6ab21de052e1
3
+ metadata.gz: 347f72f459d1d27eed0cb6091f07a4bebd0a2d1dc43d915f64370349fb670dd1
4
+ data.tar.gz: c04dc7953ff4437d04d70c96fd63e092b4e1429fc77188012029f2ee4d758bd6
5
5
  SHA512:
6
- metadata.gz: ec499801f4cd3ebfa79c4bca8a996cdc5534d86e6cef016b4e0c6668ce1c4baf0115d797197cf693e1821dc428ac37249bda3629e83d6aebc80816229bb1b09f
7
- data.tar.gz: 5821f363ebc0ee793bc6cf9469b91dbdf3e4f6ca4d8de54e7ce5ab3811e5b59f9218beae08053e5fade8ca5b250163bb07bf37a080c35d17ce1370875ac3b15e
6
+ metadata.gz: 0e12b34da4a0cb1bec5649039495da937742339ecfeb15f49fe25553dd13f1b3bc6f45f79ff4aeb121b59639084fea577a7b394e15f7b97745fbcf520ff36e7e
7
+ data.tar.gz: b95261537420b8907a19056fad2b34e664d3f466c9a254401237429d44e3c5fcc01ab569b0f00f24fc67fe375dcd4d37ffb717e14532896e09aeb4690fb634b7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # 4.2.0
2
+
3
+ - Update rubocop to 1.23.0
4
+ - Update rubocop-ast to 1.13.0
5
+ - Update rubocop-rails to 2.12.4
6
+ - Update rubocop-rspec to 2.6.0
7
+
1
8
  # 4.1.0
2
9
 
3
10
  - 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
- 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
 
@@ -42,8 +44,6 @@ inherit_gem:
42
44
  - config/rspec.yml
43
45
  ```
44
46
 
45
- ## Testing
46
-
47
- Run `bundle exec rake`.
47
+ ## Contributing
48
48
 
49
- [guides]: https://github.com/alphagov/styleguides
49
+ 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.1.0
4
+ version: 4.2.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-09-16 00:00:00.000000000 Z
11
+ date: 2021-11-16 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.21.0
33
+ version: 1.23.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.21.0
40
+ version: 1.23.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.11.0
47
+ version: 1.13.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.11.0
54
+ version: 1.13.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.12.2
61
+ version: 2.12.4
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.12.2
68
+ version: 2.12.4
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.4.0
89
+ version: 2.6.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.4.0
96
+ version: 2.6.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
@@ -132,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
132
133
  - !ruby/object:Gem::Version
133
134
  version: '0'
134
135
  requirements: []
135
- rubygems_version: 3.2.27
136
+ rubygems_version: 3.2.31
136
137
  signing_key:
137
138
  specification_version: 4
138
139
  summary: RuboCop GOV.UK