package_protections 2.1.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f503d714980699ad618258d74bb41489328aedce9e8201bfc7e1a5a086e0bdf9
|
4
|
+
data.tar.gz: d3cc2f5d197322d29dff1b794f889bc74b2a79e431e8bf7b70ec1d4e81cfabd4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6198bc334e103a52eeac5110fab05a21a72b6ed22f33b7ef455b23cb6cbb93fea9ed0b9f2a9ff122ad80ddc587d21fdbb7b7398ed6aef94ad9ad5470666932da
|
7
|
+
data.tar.gz: c1fd8d5e56cd37b29304dd467effef8a8cb062ed059ffa434cfff6a4c1300a191612042457139b8715737b7b2a732b44b2d2a0b1c961e934773ae9e4da093544
|
@@ -128,6 +128,39 @@ module PackageProtections
|
|
128
128
|
protected_packages.map { |p| [p.name, protection.custom_cop_config(p)] }.to_h
|
129
129
|
end
|
130
130
|
end
|
131
|
+
|
132
|
+
sig { returns(T::Array[T::Hash[T.untyped, T.untyped]]) }
|
133
|
+
def self.rubocop_todo_ymls
|
134
|
+
@rubocop_todo_ymls = T.let(@rubocop_todo_ymls, T.nilable(T::Array[T::Hash[T.untyped, T.untyped]]))
|
135
|
+
@rubocop_todo_ymls ||= begin
|
136
|
+
todo_files = Pathname.glob('**/.rubocop_todo.yml')
|
137
|
+
todo_files.map do |todo_file|
|
138
|
+
YAML.load_file(todo_file)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
sig { void }
|
144
|
+
def self.bust_rubocop_todo_yml_cache
|
145
|
+
@rubocop_todo_ymls = nil
|
146
|
+
end
|
147
|
+
|
148
|
+
sig { params(rule: String).returns(T::Set[String]) }
|
149
|
+
def self.exclude_for_rule(rule)
|
150
|
+
excludes = T.let(Set.new, T::Set[String])
|
151
|
+
|
152
|
+
Private.rubocop_todo_ymls.each do |todo_yml|
|
153
|
+
config = todo_yml[rule]
|
154
|
+
next if config.nil?
|
155
|
+
|
156
|
+
exclude_list = config['Exclude']
|
157
|
+
next if exclude_list.nil?
|
158
|
+
|
159
|
+
excludes += exclude_list
|
160
|
+
end
|
161
|
+
|
162
|
+
excludes
|
163
|
+
end
|
131
164
|
end
|
132
165
|
|
133
166
|
private_constant :Private
|
@@ -71,20 +71,7 @@ module PackageProtections
|
|
71
71
|
|
72
72
|
sig { void }
|
73
73
|
def self.bust_rubocop_todo_yml_cache
|
74
|
-
|
75
|
-
end
|
76
|
-
|
77
|
-
sig { returns(T.untyped) }
|
78
|
-
def self.rubocop_todo_yml
|
79
|
-
@rubocop_todo_yml = T.let(@rubocop_todo_yml, T.untyped)
|
80
|
-
@rubocop_todo_yml ||= begin
|
81
|
-
todo_file = Pathname.new('.rubocop_todo.yml')
|
82
|
-
if todo_file.exist?
|
83
|
-
YAML.load_file(todo_file)
|
84
|
-
else
|
85
|
-
{}
|
86
|
-
end
|
87
|
-
end
|
74
|
+
Private.bust_rubocop_todo_yml_cache
|
88
75
|
end
|
89
76
|
|
90
77
|
sig do
|
@@ -93,7 +80,7 @@ module PackageProtections
|
|
93
80
|
).returns(T::Array[Offense])
|
94
81
|
end
|
95
82
|
def get_offenses_for_existing_violations(protected_packages)
|
96
|
-
exclude_list = exclude_for_rule(cop_name)
|
83
|
+
exclude_list = Private.exclude_for_rule(cop_name)
|
97
84
|
offenses = []
|
98
85
|
|
99
86
|
protected_packages.each do |package|
|
@@ -146,13 +133,5 @@ module PackageProtections
|
|
146
133
|
)
|
147
134
|
]
|
148
135
|
end
|
149
|
-
|
150
|
-
private
|
151
|
-
|
152
|
-
sig { params(rule: String).returns(T::Set[String]) }
|
153
|
-
def exclude_for_rule(rule)
|
154
|
-
rule_config = RubocopProtectionInterface.rubocop_todo_yml[rule] || {}
|
155
|
-
Set.new(rule_config['Exclude'] || [])
|
156
|
-
end
|
157
136
|
end
|
158
137
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: package_protections
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
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-09-
|
11
|
+
date: 2022-09-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|