mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 21:15:35 +03:00
Use EnableAll in gometalinter config
This commit is contained in:
parent
d078851246
commit
a0157e39c6
3 changed files with 18 additions and 35 deletions
|
@ -16,24 +16,7 @@
|
|||
},
|
||||
"WarnUnmatchedDirective": true,
|
||||
|
||||
"DisableAll": true,
|
||||
"Enable": [
|
||||
"deadcode",
|
||||
"gocyclo",
|
||||
"gofmt",
|
||||
"goimports",
|
||||
"golint",
|
||||
"gosimple",
|
||||
"ineffassign",
|
||||
"interfacer",
|
||||
"lll",
|
||||
"misspell",
|
||||
"nakedret",
|
||||
"unconvert",
|
||||
"unparam",
|
||||
"unused",
|
||||
"vet"
|
||||
],
|
||||
"EnableAll": true,
|
||||
|
||||
"Cyclo": 20,
|
||||
"LineLength": 200
|
||||
|
|
|
@ -672,10 +672,10 @@ func (d *Dnsfilter) checkParental(host string) (Result, error) {
|
|||
}
|
||||
|
||||
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
|
||||
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
|
||||
host = strings.ToLower(strings.Trim(host, "."))
|
||||
|
||||
|
@ -787,43 +787,43 @@ func (d *Dnsfilter) AddRule(input string, filterListID int64) error {
|
|||
}
|
||||
|
||||
// Start parsing the rule
|
||||
rule := rule{
|
||||
r := rule{
|
||||
text: input, // will be modified
|
||||
originalText: input,
|
||||
listID: filterListID,
|
||||
}
|
||||
|
||||
// Mark rule as whitelist if it starts with @@
|
||||
if strings.HasPrefix(rule.text, "@@") {
|
||||
rule.isWhitelist = true
|
||||
rule.text = rule.text[2:]
|
||||
if strings.HasPrefix(r.text, "@@") {
|
||||
r.isWhitelist = true
|
||||
r.text = r.text[2:]
|
||||
}
|
||||
|
||||
err := rule.parseOptions()
|
||||
err := r.parseOptions()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
rule.extractShortcut()
|
||||
r.extractShortcut()
|
||||
|
||||
if !enableDelayedCompilation {
|
||||
err := rule.compile()
|
||||
err := r.compile()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
destination := d.blackList
|
||||
if rule.isImportant {
|
||||
if r.isImportant {
|
||||
destination = d.important
|
||||
} else if rule.isWhitelist {
|
||||
} else if r.isWhitelist {
|
||||
destination = d.whiteList
|
||||
}
|
||||
|
||||
d.storageMutex.Lock()
|
||||
d.storage[input] = true
|
||||
d.storageMutex.Unlock()
|
||||
destination.Add(&rule)
|
||||
destination.Add(&r)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -848,13 +848,13 @@ func (d *Dnsfilter) parseEtcHosts(input string, filterListID int64) bool {
|
|||
d.storageMutex.Unlock()
|
||||
|
||||
for _, host := range fields[1:] {
|
||||
rule := rule{
|
||||
r := rule{
|
||||
text: host,
|
||||
originalText: input,
|
||||
listID: filterListID,
|
||||
ip: addr,
|
||||
}
|
||||
d.blackList.Add(&rule)
|
||||
d.blackList.Add(&r)
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -90,10 +90,10 @@ func (p *periodicStats) Observe(name string, when time.Time, value float64) {
|
|||
{
|
||||
countname := name + "_count"
|
||||
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)
|
||||
value++
|
||||
currentValues[elapsed] = value
|
||||
v++
|
||||
currentValues[elapsed] = v
|
||||
p.Entries[countname] = currentValues
|
||||
}
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue