1
0
Fork 0
mirror of https://github.com/miniflux/v2.git synced 2025-08-31 18:31:01 +00:00

Enable go-critic linter and fix various issues detected

This commit is contained in:
Frédéric Guillot 2024-03-17 13:26:51 -07:00
parent f6404290ba
commit b1e73fafdf
34 changed files with 126 additions and 109 deletions

View file

@ -45,11 +45,12 @@ func (c *candidate) String() string {
id, _ := c.selection.Attr("id")
class, _ := c.selection.Attr("class")
if id != "" && class != "" {
switch {
case id != "" && class != "":
return fmt.Sprintf("%s#%s.%s => %f", c.Node().DataAtom, id, class, c.score)
} else if id != "" {
case id != "":
return fmt.Sprintf("%s#%s => %f", c.Node().DataAtom, id, c.score)
} else if class != "" {
case class != "":
return fmt.Sprintf("%s.%s => %f", c.Node().DataAtom, class, c.score)
}
@ -222,7 +223,7 @@ func getCandidates(document *goquery.Document) candidateList {
// should have a relatively small link density (5% or less) and be mostly
// unaffected by this operation
for _, candidate := range candidates {
candidate.score = candidate.score * (1 - getLinkDensity(candidate.selection))
candidate.score *= (1 - getLinkDensity(candidate.selection))
}
return candidates