@@ -2,7 +2,6 @@ package talismanrc
2
2
3
3
import (
4
4
"os"
5
- "regexp"
6
5
"sort"
7
6
8
7
logr "github.com/sirupsen/logrus"
@@ -24,17 +23,6 @@ type TalismanRC struct {
24
23
Version string `yaml:"version"`
25
24
}
26
25
27
- type persistedRC struct {
28
- FileIgnoreConfig []FileIgnoreConfig `yaml:"fileignoreconfig,omitempty"`
29
- ScopeConfig []ScopeConfig `yaml:"scopeconfig,omitempty"`
30
- CustomPatterns []PatternString `yaml:"custom_patterns,omitempty"`
31
- CustomSeverities []CustomSeverityConfig `yaml:"custom_severities,omitempty"`
32
- AllowedPatterns []string `yaml:"allowed_patterns,omitempty"`
33
- Experimental ExperimentalConfig `yaml:"experimental,omitempty"`
34
- Threshold severity.Severity `yaml:"threshold,omitempty"`
35
- Version string `yaml:"version"`
36
- }
37
-
38
26
// SuggestRCFor returns the talismanRC file content corresponding to input ignore configs
39
27
func SuggestRCFor (configs []FileIgnoreConfig ) string {
40
28
tRC := TalismanRC {FileIgnoreConfig : configs , Version : DefaultRCVersion }
@@ -43,11 +31,6 @@ func SuggestRCFor(configs []FileIgnoreConfig) string {
43
31
return string (result )
44
32
}
45
33
46
- // AcceptsAll returns true if there are no rules specified
47
- func (tRC * TalismanRC ) AcceptsAll () bool {
48
- return len (tRC .effectiveRules ("any-detector" )) == 0
49
- }
50
-
51
34
// Accept answers true if the Addition.Path is configured to be checked by the detectors
52
35
func (tRC * TalismanRC ) Accept (addition gitrepo.Addition , detectorName string ) bool {
53
36
return ! tRC .Deny (addition , detectorName )
@@ -169,27 +152,6 @@ func (tRC *TalismanRC) effectiveRules(detectorName string) []string {
169
152
return result
170
153
}
171
154
172
- func fromPersistedRC (configFromTalismanRCFile * persistedRC ) * TalismanRC {
173
- tRC := TalismanRC {}
174
-
175
- tRC .Threshold = configFromTalismanRCFile .Threshold
176
- tRC .ScopeConfig = configFromTalismanRCFile .ScopeConfig
177
- tRC .Experimental = configFromTalismanRCFile .Experimental
178
- tRC .CustomPatterns = configFromTalismanRCFile .CustomPatterns
179
- tRC .CustomSeverities = configFromTalismanRCFile .CustomSeverities
180
- tRC .AllowedPatterns = make ([]* Pattern , len (configFromTalismanRCFile .AllowedPatterns ))
181
- for i , p := range configFromTalismanRCFile .AllowedPatterns {
182
- tRC .AllowedPatterns [i ] = & Pattern {regexp .MustCompile (p )}
183
- }
184
- tRC .Version = configFromTalismanRCFile .Version
185
-
186
- tRC .FileIgnoreConfig = configFromTalismanRCFile .FileIgnoreConfig
187
-
188
- return & tRC
189
- }
190
-
191
155
func Load () (* TalismanRC , error ) {
192
- configFromTalismanRCFile , err := readConfigFromRCFile (repoFileReader ())
193
- talismanRC := fromPersistedRC (configFromTalismanRCFile )
194
- return talismanRC , err
156
+ return readConfigFromRCFile (repoFileReader ())
195
157
}
0 commit comments