fix: linter fix.

This commit is contained in:
Alexandre Pujol 2025-04-05 00:01:27 +02:00
parent d00f204cc5
commit 07b7f5c13d
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
4 changed files with 5 additions and 6 deletions

View file

@ -11,3 +11,5 @@ linters:
exclusions: exclusions:
paths: paths:
- pkg/paths - pkg/paths
- tests/cmd/

View file

@ -111,7 +111,7 @@ func formatFile(kind kind, profile string) (string, error) {
for idx, rules := range rulesByParagraph { for idx, rules := range rulesByParagraph {
aa.IndentationLevel = getIndentationLevel(paragraphs[idx]) aa.IndentationLevel = getIndentationLevel(paragraphs[idx])
rules = rules.Merge().Sort().Format() rules = rules.Merge().Sort().Format()
profile = strings.Replace(profile, paragraphs[idx], rules.String()+"\n", -1) profile = strings.ReplaceAll(profile, paragraphs[idx], rules.String()+"\n")
} }
return profile, nil return profile, nil
} }

View file

@ -212,7 +212,7 @@ func (r *File) addLine(other Rule) bool {
letterJ := getLetterIn(fileAlphabet, other.(*File).Path) letterJ := getLetterIn(fileAlphabet, other.(*File).Path)
groupI, ok1 := fileAlphabetGroups[letterI] groupI, ok1 := fileAlphabetGroups[letterI]
groupJ, ok2 := fileAlphabetGroups[letterJ] groupJ, ok2 := fileAlphabetGroups[letterJ]
return letterI != letterJ && !(ok1 && ok2 && groupI == groupJ) return letterI != letterJ && (!ok1 || !ok2 || groupI != groupJ)
} }
type Link struct { type Link struct {

View file

@ -286,10 +286,7 @@ func parseRule(str string) rule {
res := make(rule, 0, len(str)/2) res := make(rule, 0, len(str)/2)
tokens := tokenizeRule(str) tokens := tokenizeRule(str)
inAare := false inAare := len(tokens) > 0 && (isAARE(tokens[0]) || tokens[0] == tokOWNER)
if len(tokens) > 0 && (isAARE(tokens[0]) || tokens[0] == tokOWNER) {
inAare = true
}
for idx, token := range tokens { for idx, token := range tokens {
switch { switch {
case token == tokEQUAL, token == tokPLUS+tokEQUAL, token == tokLESS+tokEQUAL: // Variable & Rlimit case token == tokEQUAL, token == tokPLUS+tokEQUAL, token == tokLESS+tokEQUAL: // Variable & Rlimit