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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8789235e049c26367bdf6a909d22646d76b44adb350fb35e777d2be40ec0e14a
4
- data.tar.gz: 1bd02af0c72f377ad0a7982681fe9bfdb8bc6e4550fdb6b756ee8e9840cba27b
3
+ metadata.gz: 6300323ecd2a3738dff019fa9d13477c01c4ef9f0c750780d25c22dea7087e56
4
+ data.tar.gz: b4d97e21514bc854ccea2117ca0b63a751a632a2ad4558fe2f5e7e64c382c11e
5
5
  SHA512:
6
- metadata.gz: 3839e46d7a89a4dbb7dcee0957be8d891a9e151d29485f06e8a53ab21a92af7a7a1a2d4c09da48030e6c95040956c6e4f92d380a663a57c02b48085fa189ff62
7
- data.tar.gz: ddcb0fec757eafe11d18b5c0146202fb3ea6a655087bf3c11534a3f556f85ccf76a945eca3a86683ba37197f9ca22a8fc1ad92049bdd0b7cfd4a80ff73125bdb
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 { |line, _index| line.include?(violation.class_name) }
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}"
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DangerPackwerk
5
- VERSION = '0.1.1'
5
+ VERSION = '0.1.2'
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: danger-packwerk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gusto Engineers