Skip to content

Commit 9077931

Browse files
committed
refactor: move internalReference into excludeRule
1 parent 4e3f7e0 commit 9077931

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

pkg/result/processors/base_rule.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,13 @@ type baseRule struct {
1717
path *regexp.Regexp
1818
pathExcept *regexp.Regexp
1919
linters []string
20-
21-
// For compatibility with exclude-use-default/include.
22-
internalReference string `mapstructure:"-"`
2320
}
2421

2522
// The usage of `regexp.MustCompile()` is safe here,
2623
// because the regular expressions are checked before inside [config.BaseRule.Validate].
2724
func newBaseRule(rule *config.BaseRule, prefix string) baseRule {
2825
base := baseRule{
29-
linters: rule.Linters,
30-
internalReference: rule.InternalReference,
26+
linters: rule.Linters,
3127
}
3228

3329
if rule.Text != "" {

pkg/result/processors/exclusion_rules.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,16 @@ func (p *ExclusionRules) Finish() {
109109

110110
type excludeRule struct {
111111
baseRule
112+
113+
// For compatibility with exclude-use-default/include.
114+
internalReference string `mapstructure:"-"`
112115
}
113116

114117
func newExcludeRule(rule *config.ExcludeRule, prefix string) excludeRule {
115-
return excludeRule{baseRule: newBaseRule(&rule.BaseRule, prefix)}
118+
return excludeRule{
119+
baseRule: newBaseRule(&rule.BaseRule, prefix),
120+
internalReference: rule.InternalReference,
121+
}
116122
}
117123

118124
func (e excludeRule) String() string {

0 commit comments

Comments
 (0)