danger-packwerk 0.6.0 → 0.7.0
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: '0118c3bc15c4a681dc290f557549e24451cd5c3fda714c8a29637ad791f77cfb'
|
4
|
+
data.tar.gz: 716b2b0a13d4392cf8263abadca2620e241527c4874e25c93e9ad2b7baec57ee
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ac00cad5d9241aec516693df310a0b97afd8da2bc59f0234d005ab9bc9ae1d3d781fa6c591f9267f03919327ef6f57dc16e2ef6d494d98d8e43acd205c9ef530
|
7
|
+
data.tar.gz: 7043ca6402ac04d799dabe1ed8ddce3d4d239ebc6f818236e47b494faa9a5b3b52df1b6148e9a2d35e50788264c6735e70548a814ff12219cb080f2efbf953be
|
@@ -78,16 +78,21 @@ module DangerPackwerk
|
|
78
78
|
removed_violations += deleted_violations
|
79
79
|
end
|
80
80
|
|
81
|
+
# The format for git.renamed_files is a T::Array[{after: "some/path/new", before: "some/path/old"}]
|
82
|
+
renamed_files_before = git.renamed_files.map { |before_after_file| before_after_file[:before] }
|
83
|
+
renamed_files_after = git.renamed_files.map { |before_after_file| before_after_file[:after] }
|
84
|
+
|
81
85
|
git.modified_files.grep(DEPRECATED_REFERENCES_PATTERN).each do |modified_deprecated_references_yml_file|
|
86
|
+
# We skip over modified files if one of the modified files is a renamed `deprecated_references.yml` file.
|
87
|
+
# This allows us to rename packs while ignoring "new violations" in those renamed packs.
|
88
|
+
next if renamed_files_before.include?(modified_deprecated_references_yml_file)
|
89
|
+
|
82
90
|
head_commit_violations = BasicReferenceOffense.from(modified_deprecated_references_yml_file)
|
83
91
|
base_commit_violations = get_violations_before_patch_for(modified_deprecated_references_yml_file)
|
84
92
|
added_violations += head_commit_violations - base_commit_violations
|
85
93
|
removed_violations += base_commit_violations - head_commit_violations
|
86
94
|
end
|
87
95
|
|
88
|
-
# The format for git.renamed_files is a T::Array[{after: "some/path/new", before: "some/path/old"}]
|
89
|
-
renamed_files = git.renamed_files.map { |before_after_file| before_after_file[:after] }
|
90
|
-
|
91
96
|
#
|
92
97
|
# This implementation creates some false negatives:
|
93
98
|
# That is – it doesn't capture some cases:
|
@@ -106,11 +111,11 @@ module DangerPackwerk
|
|
106
111
|
|
107
112
|
added_violations.each do |violation|
|
108
113
|
filepath_that_defines_this_constant = Private.constant_resolver.resolve(violation.class_name)&.location
|
109
|
-
renamed_constants << violation.class_name if
|
114
|
+
renamed_constants << violation.class_name if renamed_files_after.include?(filepath_that_defines_this_constant)
|
110
115
|
end
|
111
116
|
|
112
117
|
relevant_added_violations = added_violations.reject do |violation|
|
113
|
-
|
118
|
+
renamed_files_after.include?(violation.file) || renamed_constants.include?(violation.class_name)
|
114
119
|
end
|
115
120
|
|
116
121
|
ViolationDiff.new(
|
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.7.0
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: danger-plugin-api
|