Use EnableAll in gometalinter config
This commit is contained in:
parent
d078851246
commit
a0157e39c6
|
@ -16,24 +16,7 @@
|
||||||
},
|
},
|
||||||
"WarnUnmatchedDirective": true,
|
"WarnUnmatchedDirective": true,
|
||||||
|
|
||||||
"DisableAll": true,
|
"EnableAll": true,
|
||||||
"Enable": [
|
|
||||||
"deadcode",
|
|
||||||
"gocyclo",
|
|
||||||
"gofmt",
|
|
||||||
"goimports",
|
|
||||||
"golint",
|
|
||||||
"gosimple",
|
|
||||||
"ineffassign",
|
|
||||||
"interfacer",
|
|
||||||
"lll",
|
|
||||||
"misspell",
|
|
||||||
"nakedret",
|
|
||||||
"unconvert",
|
|
||||||
"unparam",
|
|
||||||
"unused",
|
|
||||||
"vet"
|
|
||||||
],
|
|
||||||
|
|
||||||
"Cyclo": 20,
|
"Cyclo": 20,
|
||||||
"LineLength": 200
|
"LineLength": 200
|
||||||
|
|
|
@ -672,10 +672,10 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
type formatHandler func(hashparam string) string
|
type formatHandler func(hashparam string) string
|
||||||
type handleBodyHandler func(body []byte, hashes map[string]bool) (Result, error)
|
type bodyHandler func(body []byte, hashes map[string]bool) (Result, error)
|
||||||
|
|
||||||
// real implementation of lookup/check
|
// real implementation of lookup/check
|
||||||
func (d *Dnsfilter) lookupCommon(host string, lookupstats *LookupStats, cache gcache.Cache, hashparamNeedSlash bool, format formatHandler, handleBody handleBodyHandler) (Result, error) {
|
func (d *Dnsfilter) lookupCommon(host string, lookupstats *LookupStats, cache gcache.Cache, hashparamNeedSlash bool, format formatHandler, handleBody bodyHandler) (Result, error) {
|
||||||
// if host ends with a dot, trim it
|
// if host ends with a dot, trim it
|
||||||
host = strings.ToLower(strings.Trim(host, "."))
|
host = strings.ToLower(strings.Trim(host, "."))
|
||||||
|
|
||||||
|
@ -787,43 +787,43 @@ func (d *Dnsfilter) AddRule(input string, filterListID int64) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start parsing the rule
|
// Start parsing the rule
|
||||||
rule := rule{
|
r := rule{
|
||||||
text: input, // will be modified
|
text: input, // will be modified
|
||||||
originalText: input,
|
originalText: input,
|
||||||
listID: filterListID,
|
listID: filterListID,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Mark rule as whitelist if it starts with @@
|
// Mark rule as whitelist if it starts with @@
|
||||||
if strings.HasPrefix(rule.text, "@@") {
|
if strings.HasPrefix(r.text, "@@") {
|
||||||
rule.isWhitelist = true
|
r.isWhitelist = true
|
||||||
rule.text = rule.text[2:]
|
r.text = r.text[2:]
|
||||||
}
|
}
|
||||||
|
|
||||||
err := rule.parseOptions()
|
err := r.parseOptions()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
rule.extractShortcut()
|
r.extractShortcut()
|
||||||
|
|
||||||
if !enableDelayedCompilation {
|
if !enableDelayedCompilation {
|
||||||
err := rule.compile()
|
err := r.compile()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
destination := d.blackList
|
destination := d.blackList
|
||||||
if rule.isImportant {
|
if r.isImportant {
|
||||||
destination = d.important
|
destination = d.important
|
||||||
} else if rule.isWhitelist {
|
} else if r.isWhitelist {
|
||||||
destination = d.whiteList
|
destination = d.whiteList
|
||||||
}
|
}
|
||||||
|
|
||||||
d.storageMutex.Lock()
|
d.storageMutex.Lock()
|
||||||
d.storage[input] = true
|
d.storage[input] = true
|
||||||
d.storageMutex.Unlock()
|
d.storageMutex.Unlock()
|
||||||
destination.Add(&rule)
|
destination.Add(&r)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -848,13 +848,13 @@ func (d *Dnsfilter) parseEtcHosts(input string, filterListID int64) bool {
|
||||||
d.storageMutex.Unlock()
|
d.storageMutex.Unlock()
|
||||||
|
|
||||||
for _, host := range fields[1:] {
|
for _, host := range fields[1:] {
|
||||||
rule := rule{
|
r := rule{
|
||||||
text: host,
|
text: host,
|
||||||
originalText: input,
|
originalText: input,
|
||||||
listID: filterListID,
|
listID: filterListID,
|
||||||
ip: addr,
|
ip: addr,
|
||||||
}
|
}
|
||||||
d.blackList.Add(&rule)
|
d.blackList.Add(&r)
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,10 +90,10 @@ func (p *periodicStats) Observe(name string, when time.Time, value float64) {
|
||||||
{
|
{
|
||||||
countname := name + "_count"
|
countname := name + "_count"
|
||||||
currentValues := p.Entries[countname]
|
currentValues := p.Entries[countname]
|
||||||
value := currentValues[elapsed]
|
v := currentValues[elapsed]
|
||||||
// log.Tracef("Will change p.Entries[%s][%d] from %v to %v", countname, elapsed, value, value+1)
|
// log.Tracef("Will change p.Entries[%s][%d] from %v to %v", countname, elapsed, value, value+1)
|
||||||
value++
|
v++
|
||||||
currentValues[elapsed] = value
|
currentValues[elapsed] = v
|
||||||
p.Entries[countname] = currentValues
|
p.Entries[countname] = currentValues
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue