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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8789235e049c26367bdf6a909d22646d76b44adb350fb35e777d2be40ec0e14a
4
- data.tar.gz: 1bd02af0c72f377ad0a7982681fe9bfdb8bc6e4550fdb6b756ee8e9840cba27b
3
+ metadata.gz: 4e6b4d9d18458e1ac591a9679d82f6ec6840e8f7b971792134610270a1697777
4
+ data.tar.gz: c8a1833019c24d48d8c5c5d55d36d1730a88f33effa0b10bdc63d7c7d470d70e
5
5
  SHA512:
6
- metadata.gz: 3839e46d7a89a4dbb7dcee0957be8d891a9e151d29485f06e8a53ab21a92af7a7a1a2d4c09da48030e6c95040956c6e4f92d380a663a57c02b48085fa189ff62
7
- data.tar.gz: ddcb0fec757eafe11d18b5c0146202fb3ea6a655087bf3c11534a3f556f85ccf76a945eca3a86683ba37197f9ca22a8fc1ad92049bdd0b7cfd4a80ff73125bdb
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 { |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.
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}"
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module DangerPackwerk
5
- VERSION = '0.1.1'
5
+ VERSION = '0.2.3'
6
6
  end
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.1.1
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-20 00:00:00.000000000 Z
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