chore: Use depguard instead of revive.imports-blacklist (#12153)
This commit is contained in:
parent
10dc4014a5
commit
6659e3d62a
|
|
@ -6,6 +6,7 @@ linters:
|
||||||
- asasalint
|
- asasalint
|
||||||
- bidichk
|
- bidichk
|
||||||
- bodyclose
|
- bodyclose
|
||||||
|
- depguard
|
||||||
- dogsled
|
- dogsled
|
||||||
- exportloopref
|
- exportloopref
|
||||||
- errcheck
|
- errcheck
|
||||||
|
|
@ -25,6 +26,45 @@ linters:
|
||||||
- unused
|
- unused
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
|
depguard:
|
||||||
|
# Kind of list is passed in.
|
||||||
|
# Allowed values: allowlist|denylist
|
||||||
|
# Default: denylist
|
||||||
|
list-type: denylist
|
||||||
|
# Check the list against standard lib.
|
||||||
|
# Default: false
|
||||||
|
include-go-root: true
|
||||||
|
# A list of packages for the list type specified.
|
||||||
|
# Can accept both string prefixes and string glob patterns.
|
||||||
|
# Default: []
|
||||||
|
packages:
|
||||||
|
- log
|
||||||
|
# A list of packages for the list type specified.
|
||||||
|
# Specify an error message to output when a denied package is used.
|
||||||
|
# Default: []
|
||||||
|
packages-with-error-message:
|
||||||
|
- log: 'Use injected telegraf.Logger instead'
|
||||||
|
# Specify rules by which the linter ignores certain files for consideration.
|
||||||
|
# Can accept both string prefixes and string glob patterns.
|
||||||
|
# The ! character in front of the rule is a special character
|
||||||
|
# which signals that the linter should negate the rule.
|
||||||
|
# This allows for more precise control, but it is only available for glob patterns.
|
||||||
|
# Default: []
|
||||||
|
ignore-file-rules:
|
||||||
|
- "**/agent/**"
|
||||||
|
- "**/cmd/**"
|
||||||
|
- "**/config/**"
|
||||||
|
- "**/filter/**"
|
||||||
|
- "**/internal/**"
|
||||||
|
- "**/logger/**"
|
||||||
|
- "**/metric/**"
|
||||||
|
- "**/models/**"
|
||||||
|
- "**/plugins/serializers/**"
|
||||||
|
- "**/scripts/**"
|
||||||
|
- "**/selfstat/**"
|
||||||
|
- "**/testutil/**"
|
||||||
|
- "**/tools/**"
|
||||||
|
- "**/*_test.go"
|
||||||
revive:
|
revive:
|
||||||
rules:
|
rules:
|
||||||
- name: argument-limit
|
- name: argument-limit
|
||||||
|
|
@ -50,13 +90,10 @@ linters-settings:
|
||||||
- name: error-return
|
- name: error-return
|
||||||
- name: error-strings
|
- name: error-strings
|
||||||
- name: errorf
|
- name: errorf
|
||||||
# - name: flag-parameter #disable for now
|
|
||||||
- name: function-result-limit
|
- name: function-result-limit
|
||||||
arguments: [ 3 ]
|
arguments: [ 3 ]
|
||||||
- name: identical-branches
|
- name: identical-branches
|
||||||
- name: if-return
|
- name: if-return
|
||||||
- name: imports-blacklist
|
|
||||||
arguments: [ "log" ]
|
|
||||||
- name: import-shadowing
|
- name: import-shadowing
|
||||||
- name: increment-decrement
|
- name: increment-decrement
|
||||||
- name: indent-error-flow
|
- name: indent-error-flow
|
||||||
|
|
@ -100,8 +137,6 @@ run:
|
||||||
- assets
|
- assets
|
||||||
- docs
|
- docs
|
||||||
- etc
|
- etc
|
||||||
- scripts
|
|
||||||
# - plugins/parsers/influx/machine.go
|
|
||||||
|
|
||||||
# which files to skip: they will be analyzed, but issues from them
|
# which files to skip: they will be analyzed, but issues from them
|
||||||
# won't be reported. Default value is empty list, but there is
|
# won't be reported. Default value is empty list, but there is
|
||||||
|
|
@ -127,14 +162,6 @@ issues:
|
||||||
linters:
|
linters:
|
||||||
- govet
|
- govet
|
||||||
|
|
||||||
- path: _test\.go
|
|
||||||
text: "parameter.*seems to be a control flag, avoid control coupling"
|
|
||||||
|
|
||||||
- path: (^agent/|^cmd/|^config/|^filter/|^internal/|^logger/|^metric/|^models/|^selfstat/|^testutil/|^tools|^plugins/serializers/|^plugins/inputs/zipkin/cmd)
|
|
||||||
text: "imports-blacklist: should not use the following blacklisted import: \"log\""
|
|
||||||
linters:
|
|
||||||
- revive
|
|
||||||
|
|
||||||
- path: cmd/telegraf/(main|printer).go
|
- path: cmd/telegraf/(main|printer).go
|
||||||
text: "Error return value of `outputBuffer.Write` is not checked"
|
text: "Error return value of `outputBuffer.Write` is not checked"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package logrus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"log" //nolint:revive // Allow exceptional but valid use of log here.
|
"log" //nolint:depguard // Allow exceptional but valid use of log here.
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@ package shim
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log" //nolint:revive // Allow exceptional but valid use of log here.
|
"log" //nolint:depguard // Allow exceptional but valid use of log here.
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/BurntSushi/toml"
|
"github.com/BurntSushi/toml"
|
||||||
|
|
||||||
"github.com/influxdata/telegraf"
|
"github.com/influxdata/telegraf"
|
||||||
"github.com/influxdata/telegraf/plugins/inputs"
|
"github.com/influxdata/telegraf/plugins/inputs"
|
||||||
"github.com/influxdata/telegraf/plugins/outputs"
|
"github.com/influxdata/telegraf/plugins/outputs"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package shim
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log" //nolint:revive // Allow exceptional but valid use of log here.
|
"log" //nolint:depguard // Allow exceptional but valid use of log here.
|
||||||
"os"
|
"os"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ import (
|
||||||
"bufio"
|
"bufio"
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"log" //nolint:revive
|
"log" //nolint:depguard // Allow exceptional but valid use of log here.
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue