Skip to content

Commit

Permalink
Ignore symlinks in rule/dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
prymitive committed Apr 2, 2024
1 parent d72401d commit ea85cae
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 0 additions & 2 deletions cmd/pint/tests/0172_rule_dependency_symlink_delete.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ pint.ok -l error --offline --no-color ci
cmp stderr ../stderr.txt

-- stderr.txt --
rules2/record.yml ~> rules1/record.yml:4-5 (deleted) Warning: Metric generated by this rule is used by 1 other rule(s). (rule/dependency)

-- src/alert.yml --
groups:
- name: g1
Expand Down
1 change: 1 addition & 0 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

- Fixed false positives from [rule/duplicate](checks/rule/duplicate.md) check
when running `pint ci` on files that are both edited and renamed in the same PR.
- [rule/dependency](checks/rule/dependency.md) will no longer report removed symlinks.

## v0.57.3

Expand Down
7 changes: 6 additions & 1 deletion internal/checks/rule_dependency.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ func (c RuleDependencyCheck) Reporter() string {
return RuleDependencyCheckName
}

func (c RuleDependencyCheck) Check(_ context.Context, _ discovery.Path, rule parser.Rule, entries []discovery.Entry) (problems []Problem) {
func (c RuleDependencyCheck) Check(_ context.Context, path discovery.Path, rule parser.Rule, entries []discovery.Entry) (problems []Problem) {
if path.Name != path.SymlinkTarget {
// Don't reported symlinks that are being removed.
return problems
}

var broken []*brokenDependency
var dep *brokenDependency
for _, entry := range entries {
Expand Down

0 comments on commit ea85cae

Please sign in to comment.