danger-packwerk 0.1.1 → 0.1.2
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 +9 -1
- data/lib/danger-packwerk/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6300323ecd2a3738dff019fa9d13477c01c4ef9f0c750780d25c22dea7087e56
|
4
|
+
data.tar.gz: b4d97e21514bc854ccea2117ca0b63a751a632a2ad4558fe2f5e7e64c382c11e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dbfa1eaea903b7ae2fed28832bb8797c9a594886baf4bad4e951ebf95d6859d19776a8affccb20623189987230a33046eac23ff2eb3a659f454f37c1fc30cdff
|
7
|
+
data.tar.gz: 0f0e32051b0f970eeac82fa5ba0e677441ffdbc8b9a2e9c1f94d6dcdbea5937df4ccfce69eea946a52ea7af54b7ff646d3d8b1c7356d55c488c1eb35f8224404
|
@@ -78,7 +78,15 @@ 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. Right now `packwerk` `deprecated_references.yml` files always use
|
85
|
+
# double quotes, so we check for that only. If the public API ever changes, this may need to change.
|
86
|
+
class_name_with_quote_boundaries = "\"#{violation.class_name}\":"
|
87
|
+
line.include?(class_name_with_quote_boundaries)
|
88
|
+
end
|
89
|
+
|
82
90
|
if class_name_line_number.nil?
|
83
91
|
debug_info = { class_name: violation.class_name, to_package_name: violation.to_package_name, type: violation.type }
|
84
92
|
raise "Unable to find reference to violation #{debug_info} in #{deprecated_references_yml}"
|