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

refactor: fix typo in the field name of TestFileFilterRule #1086

Merged
merged 1 commit into from
Oct 29, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions test/file-filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ import (
)

type TestFileFilterRule struct {
WasApplyed bool
WasApplied bool
}

var _ lint.Rule = (*TestFileFilterRule)(nil)

func (*TestFileFilterRule) Name() string { return "test-file-filter" }
func (tfr *TestFileFilterRule) Apply(*lint.File, lint.Arguments) []lint.Failure {
tfr.WasApplyed = true
tfr.WasApplied = true
return nil
}

func TestFileExcludeFilterAtRuleLevel(t *testing.T) {
t.Run("is called if no excludes", func(t *testing.T) {
rule := &TestFileFilterRule{}
testRule(t, "file-to-exclude", rule, &lint.RuleConfig{})
if !rule.WasApplyed {
if !rule.WasApplied {
t.Fatal("should call rule if no excludes")
}
})
Expand All @@ -31,7 +31,7 @@ func TestFileExcludeFilterAtRuleLevel(t *testing.T) {
cfg := &lint.RuleConfig{Exclude: []string{"no-matched.go"}}
cfg.Initialize()
testRule(t, "file-to-exclude", rule, cfg)
if !rule.WasApplyed {
if !rule.WasApplied {
t.Fatal("should call rule if no excludes")
}
})
Expand All @@ -41,7 +41,7 @@ func TestFileExcludeFilterAtRuleLevel(t *testing.T) {
cfg := &lint.RuleConfig{Exclude: []string{"../testdata/file-to-exclude.go"}}
cfg.Initialize()
testRule(t, "file-to-exclude", rule, cfg)
if rule.WasApplyed {
if rule.WasApplied {
t.Fatal("should not call rule if excluded")
}
})
Expand Down