rubocop-packs 0.0.15 → 0.0.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rubocop/packs/private.rb +2 -0
- data/lib/rubocop/packs.rb +25 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 36151891d908f1db1ea404ec0890094a874ad30cd49bafe4ba6be84cc07f3234
|
4
|
+
data.tar.gz: d9cd4893c8bc730407e7cc777947a03b0f52290ea11c98d84f74cbafbbb23d41
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9949c24590b6afe33471b75e71319ff6070e1b1040cb62652299f31af2fb9381603250e20e182b7ef0fdacd016e82282aea6c779e5ee242e17a23eac9a8e2459
|
7
|
+
data.tar.gz: ba7cf7c051c6f4e0306e8215e6e3d8cb33f9fb4095ce0634ddb79297a57cc9963323f74b1f69b88a74560f67dfe8342a27fde53d819b46e665a238c011bc6175
|
data/README.md
CHANGED
@@ -52,9 +52,9 @@ To add a per-pack `.rubocop.yml`, you just need to create a `packs/your_pack/.ru
|
|
52
52
|
inherit_from: '../../.rubocop.yml'
|
53
53
|
```
|
54
54
|
|
55
|
-
Note though that inherited paths are relative to your pack-level `.rubocop.yml`. To avoid that, you can rename your `.rubocop.yml` to `.
|
55
|
+
Note though that inherited paths are relative to your pack-level `.rubocop.yml`. To avoid that, you can rename your `.rubocop.yml` to `.base_rubocop.yml`, set `.rubocop.yml` to:
|
56
56
|
```
|
57
|
-
inherit_from: '.
|
57
|
+
inherit_from: '.base_rubocop.yml'
|
58
58
|
```
|
59
59
|
And then similarly change the `inherit_from` in `packs/your_pack/.rubocop.yml`.
|
60
60
|
|
data/lib/rubocop/packs.rb
CHANGED
@@ -64,6 +64,31 @@ module RuboCop
|
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
67
|
+
#
|
68
|
+
# Ideally, this is API that is available to us via `rubocop` itself.
|
69
|
+
# That is: the ability to preserve the location of `.rubocop_todo.yml` files and associate
|
70
|
+
# exclusions with the closest ancestor `.rubocop_todo.yml`
|
71
|
+
#
|
72
|
+
sig { params(packs: T::Array[ParsePackwerk::Package]).void }
|
73
|
+
def self.set_default_rubocop_yml(packs:)
|
74
|
+
packs.each do |pack|
|
75
|
+
rubocop_yml = Pathname.new(pack.directory.join('.rubocop.yml'))
|
76
|
+
rubocop_yml_hash = {}
|
77
|
+
rubocop_yml_hash['inherit_from'] = '../../.base_rubocop.yml'
|
78
|
+
config.required_pack_level_cops.each do |cop|
|
79
|
+
rubocop_yml_hash[cop] = { 'Enabled' => true }
|
80
|
+
end
|
81
|
+
|
82
|
+
formatted_yml = YAML.dump(rubocop_yml_hash).
|
83
|
+
# Remove the `---` header at the top of the file
|
84
|
+
gsub("---\n", '').
|
85
|
+
# Find lines of the form \nCopDepartment/CopName: and add a new line before it.
|
86
|
+
gsub(%r{^(\w+/\w+:)}, "\n\\1")
|
87
|
+
|
88
|
+
rubocop_yml.write(formatted_yml)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
67
92
|
sig { params(root_pathname: String).returns(String) }
|
68
93
|
# It would be great if rubocop (upstream) could take in a glob for `inherit_from`, which
|
69
94
|
# would allow us to delete this method and this additional complexity.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rubocop-packs
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gusto Engineers
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-11-
|
11
|
+
date: 2022-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|