Skip to content

Commit

Permalink
chore: update linter (#2183)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldez committed May 9, 2024
1 parent c61aeba commit bf10a46
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 10 additions & 12 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
12 changes: 6 additions & 6 deletions internal/dnsdocs/generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}
Expand Down Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions providers/dns/constellix/constellix.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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)
}

0 comments on commit bf10a46

Please sign in to comment.