chore: update linter (#2183)

This commit is contained in:
Ludovic Fernandez 2024-05-09 21:31:20 +02:00 committed by GitHub
parent c61aeba3e2
commit bf10a46784
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 19 additions and 21 deletions

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
env:
GO_VERSION: stable
GOLANGCI_LINT_VERSION: v1.57.1
GOLANGCI_LINT_VERSION: v1.58.1
HUGO_VERSION: 0.117.0
CGO_ENABLED: 0
LEGO_E2E_TESTS: CI

View file

@ -99,16 +99,7 @@ linters-settings:
linters:
enable-all: true
disable:
- deadcode # deprecated
- exhaustivestruct # deprecated
- golint # deprecated
- ifshort # deprecated
- interfacer # deprecated
- maligned # deprecated
- nosnakecase # deprecated
- scopelint # deprecated
- structcheck # deprecated
- varcheck # deprecated
- gomnd # deprecated
- cyclop # duplicate of gocyclo
- sqlclosecheck # not relevant (SQL)
- rowserrcheck # not relevant (SQL)
@ -118,13 +109,13 @@ linters:
- dupl # not relevant
- prealloc # too many false-positive
- bodyclose # too many false-positive
- gomnd
- mnd
- testpackage # not relevant
- tparallel # not relevant
- paralleltest # not relevant
- nestif # too many false-positive
- wrapcheck
- goerr113 # not relevant
- err113 # not relevant
- nlreturn # not relevant
- wsl # not relevant
- exhaustive # not relevant
@ -145,6 +136,7 @@ linters:
- musttag # false-positive https://github.com/junk1tm/musttag/issues/17
- gosmopolitan # not relevant
- exportloopref # Useless with go1.22
- canonicalheader # Can create side effects in the context of API clients
issues:
exclude-use-default: false
@ -234,3 +226,9 @@ issues:
text: 'cyclomatic complexity \d+ of func `(renewForDomains|renewForCSR)` is high'
- path: providers/dns/cpanel/cpanel.go
text: 'cyclomatic complexity 13 of func `\(\*DNSProvider\)\.CleanUp` is high'
output:
sort-results: true
sort-order:
- linter
- file

View file

@ -155,7 +155,7 @@ func generateCLIHelp(models *Providers) error {
}
func generateReadMe(models *Providers) error {
max, lines := extractTableData(models)
maximum, lines := extractTableData(models)
file, err := os.Open(readmePath)
if err != nil {
@ -174,7 +174,7 @@ func generateReadMe(models *Providers) error {
if text == startLine {
_, _ = fmt.Fprintln(buffer, text)
err = writeDNSTable(buffer, lines, max)
err = writeDNSTable(buffer, lines, maximum)
if err != nil {
return err
}
@ -208,14 +208,14 @@ func extractTableData(models *Providers) (int, [][]string) {
items := []string{fmt.Sprintf(readmePattern, "Manual", "manual")}
var max int
var maximum int
for _, pvd := range models.Providers {
item := fmt.Sprintf(readmePattern, strings.ReplaceAll(pvd.Name, "|", "/"), pvd.Code)
items = append(items, item)
if max < len(item) {
max = len(item)
if maximum < len(item) {
maximum = len(item)
}
}
@ -253,7 +253,7 @@ func extractTableData(models *Providers) (int, [][]string) {
lines = append(lines, line)
}
return max, lines
return maximum, lines
}
func writeDNSTable(w io.Writer, lines [][]string, size int) error {

View file

@ -280,7 +280,7 @@ func containsValue(record *internal.Record, value string) bool {
})
}
func backoff(min, max time.Duration, attemptNum int, resp *http.Response) time.Duration {
func backoff(minimum, maximum time.Duration, attemptNum int, resp *http.Response) time.Duration {
if resp != nil {
// https://api.dns.constellix.com/v4/docs#section/Using-the-API/Rate-Limiting
if resp.StatusCode == http.StatusTooManyRequests {
@ -292,5 +292,5 @@ func backoff(min, max time.Duration, attemptNum int, resp *http.Response) time.D
}
}
return retryablehttp.DefaultBackoff(min, max, attemptNum, resp)
return retryablehttp.DefaultBackoff(minimum, maximum, attemptNum, resp)
}