Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/add support for multiple makefiles #70

Merged
Merged
Prev Previous commit
Next Next commit
Implement FileName struct member for PhonyDeclared rule + tests
  • Loading branch information
trinitronx committed Apr 28, 2022
commit bef92033faa42c04cbd6d8493b4bbb925b8cd742
1 change: 1 addition & 0 deletions rules/phonydeclared/phonydeclared.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func (r *Phonydeclared) Run(makefile parser.Makefile, config rules.RuleConfig) r
ret = append(ret, rules.RuleViolation{
Rule: "phonydeclared",
Violation: fmt.Sprintf("Target %q should be declared PHONY.", rule.Target),
FileName: makefile.FileName,
LineNumber: rule.LineNumber,
})
}
Expand Down
5 changes: 5 additions & 0 deletions rules/phonydeclared/phonydeclared_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
func TestAllTargetsArePhony(t *testing.T) {

makefile := parser.Makefile{
FileName: "phony-declared-all-phony.mk",
Variables: []parser.Variable{parser.Variable{
Name: "PHONY",
Assignment: "all clean"}},
Expand All @@ -29,6 +30,7 @@ func TestAllTargetsArePhony(t *testing.T) {
func TestMissingOnePhonyTarget(t *testing.T) {

makefile := parser.Makefile{
FileName: "phony-declared-missing-one-phony.mk",
Variables: []parser.Variable{parser.Variable{
Name: "PHONY",
Assignment: "all"}},
Expand All @@ -42,4 +44,7 @@ func TestMissingOnePhonyTarget(t *testing.T) {

assert.Equal(t, len(ret), 1)

for i := range ret {
assert.Equal(t, "phony-declared-missing-one-phony.mk", ret[i].FileName)
}
}