danger-packwerk 0.1.1 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/danger-packwerk/basic_reference_offense.rb +10 -1
- data/lib/danger-packwerk/version.rb +1 -1
- 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: 4e6b4d9d18458e1ac591a9679d82f6ec6840e8f7b971792134610270a1697777
|
4
|
+
data.tar.gz: c8a1833019c24d48d8c5c5d55d36d1730a88f33effa0b10bdc63d7c7d470d70e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4268804f4def280f10829d6c7832401f26cd1952ca72f92bf3cff9322f188ad03907711c9c3ee6798c852fd8e73f7b6bc1af0ce57a9adc94cf211f7565372b6
|
7
|
+
data.tar.gz: a70daaaa5deca67092e24f5e4923909371f143cdb82081e7c068f4668cfb205290b870448aa9634fb3c74612c11fad28bcd387b1d61c215e8401e3a06abcc207
|
@@ -78,7 +78,16 @@ module DangerPackwerk
|
|
78
78
|
# we need to group them. That is -- if `MyPrivateConstant` is both a dependency and a privacy violation AND it occurs in 10 files, that would represent 20 violations.
|
79
79
|
# Therefore we will group all of those 20 into one message to the user rather than providing 20 messages.
|
80
80
|
#
|
81
|
-
_line, class_name_line_number = deprecated_references_yml_pathname.readlines.each_with_index.find
|
81
|
+
_line, class_name_line_number = deprecated_references_yml_pathname.readlines.each_with_index.find do |line, _index|
|
82
|
+
# If you have a class `::MyClass`, then you can get a false match if another constant in the file
|
83
|
+
# is named `MyOtherClass::MyClassThing`. Therefore we include quotes in our match to ensure that we match
|
84
|
+
# the constant and only the constant.
|
85
|
+
# Right now `packwerk` `deprecated_references.yml` files typically use double quotes, but sometimes folks linters change this to single quotes.
|
86
|
+
# To be defensive, we match against either.
|
87
|
+
class_name_with_quote_boundaries = /["|']#{violation.class_name}["|']:/
|
88
|
+
line.match?(class_name_with_quote_boundaries)
|
89
|
+
end
|
90
|
+
|
82
91
|
if class_name_line_number.nil?
|
83
92
|
debug_info = { class_name: violation.class_name, to_package_name: violation.to_package_name, type: violation.type }
|
84
93
|
raise "Unable to find reference to violation #{debug_info} in #{deprecated_references_yml}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: danger-packwerk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.3
|
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-04-
|
11
|
+
date: 2022-04-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|