Skip to content

Commit

Permalink
Merge branch 'master' into forbidigo-update
Browse files Browse the repository at this point in the history
  • Loading branch information
pohly committed May 1, 2023
2 parents be241f8 + bc616e8 commit 0dc6570
Show file tree
Hide file tree
Showing 71 changed files with 627 additions and 512 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/post-release.yml
Expand Up @@ -37,7 +37,7 @@ jobs:
run: make update_netlify_state

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
uses: peter-evans/create-pull-request@v5
with:
base: master
token: ${{ secrets.GOLANGCI_LINT_TOKEN }}
Expand Down
86 changes: 39 additions & 47 deletions .golangci.reference.yml
Expand Up @@ -171,49 +171,38 @@ linters-settings:
disable-dec-num-check: false

depguard:
# Kind of list is passed in.
# Allowed values: allowlist|denylist
# Default: denylist
list-type: allowlist

# 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:
- github.com/sirupsen/logrus
- allow/**/pkg

# 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:
- github.com/sirupsen/logrus: 'logging is allowed only by logutils.Log'

# 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:
- "ignore/**/*.go"
- "!**/*_test.go"

# Create additional guards that follow the same configuration pattern.
# Results from all guards are aggregated together.
additional-guards:
- list-type: denylist
include-go-root: false
packages:
- github.com/stretchr/testify
# Specify rules by which the linter ignores certain files for consideration.
ignore-file-rules:
- "**/*_test.go"
- "**/mock/**/*.go"
# Rules to apply.
#
# Variables:
# - File Variables
# you can still use and exclamation mark ! in front of a variable to say not to use it.
# Example !$test will match any file that is not a go test file.
#
# `$all` - matches all go files
# `$test` - matches all go test files
#
# - Package Variables
#
# `$gostd` - matches all of go's standard library (Pulled from `GOROOT`)
#
# Default: no rules.
rules:
# Name of a rule.
main:
# List of file globs that will match this list of settings to compare against.
# Default: $all
files:
- "!**/*_a _file.go"
# List of allowed packages.
allow:
- $gostd
- github.com/OpenPeeDeeP
# Packages that are not allowed where the value is a suggestion.
deny:
- pkg: "github.com/sirupsen/logrus"
desc: not allowed
- pkg: "github.com/pkg/errors"
desc: Should be replaced by standard lib errors package

dogsled:
# Checks assignments with too many blank identifiers.
Expand Down Expand Up @@ -730,15 +719,15 @@ linters-settings:
# Values always ignored: `.+_test.go`
# Default: []
ignored-files:
- 'magic1_.*.go'
- 'magic1_.+\.go$'
# List of function patterns to exclude from analysis.
# Following functions are always ignored: `time.Date`,
# `strconv.FormatInt`, `strconv.FormatUint`, `strconv.FormatFloat`,
# `strconv.ParseInt`, `strconv.ParseUint`, `strconv.ParseFloat`.
# Default: []
ignored-functions:
- 'math.*'
- 'http.StatusText'
- '^math\.'
- '^http\.StatusText$'

gomoddirectives:
# Allow local `replace` directives.
Expand Down Expand Up @@ -1187,13 +1176,14 @@ linters-settings:
max: 5

ireturn:
# ireturn allows using `allow` and `reject` settings at the same time.
# ireturn does not allow using `allow` and `reject` settings at the same time.
# Both settings are lists of the keywords and regular expressions matched to interface or package names.
# keywords:
# - `empty` for `interface{}`
# - `error` for errors
# - `stdlib` for standard library
# - `anon` for anonymous interfaces
# - `generic` for generic interfaces added in go 1.18

# By default, it allows using errors, empty interfaces, anonymous interfaces,
# and interfaces provided by the standard library.
Expand Down Expand Up @@ -2190,6 +2180,7 @@ linters:
- whitespace
- wrapcheck
- wsl
- zerologlint

# Enable all available linters.
# Default: false
Expand Down Expand Up @@ -2302,6 +2293,7 @@ linters:
- whitespace
- wrapcheck
- wsl
- zerologlint

# Enable presets.
# https://golangci-lint.run/usage/linters
Expand Down
14 changes: 14 additions & 0 deletions .golangci.yml
@@ -1,12 +1,21 @@
linters-settings:
depguard:
# old configuration. TODO(ldez): must be removed
list-type: denylist
packages:
# logging is allowed only by logutils.Log, logrus
# is allowed to use only in logutils package
- github.com/sirupsen/logrus
packages-with-error-message:
- github.com/sirupsen/logrus: "logging is allowed only by logutils.Log"
# new configuration
rules:
logger:
deny:
# logging is allowed only by logutils.Log,
# logrus is allowed to use only in logutils package.
- pkg: "github.com/sirupsen/logrus"
desc: logging is allowed only by logutils.Log
dupl:
threshold: 100
funlen:
Expand All @@ -29,6 +38,10 @@ linters-settings:
- whyNoLint
gocyclo:
min-complexity: 15
gofmt:
rewrite-rules:
- pattern: 'interface{}'
replacement: 'any'
goimports:
local-prefixes: github.com/golangci/golangci-lint
gomnd:
Expand Down Expand Up @@ -67,6 +80,7 @@ linters-settings:
rules:
- name: unexported-return
disabled: true
- name: unused-parameter

linters:
disable-all: true
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -87,7 +87,7 @@ There is the most valuable changes log:

1. new linters
* `ginkgolinter`: https://github.com/nunnatsa/ginkgolinter
* `musttag`: https://github.com/junk1tm/musttag
* `musttag`: https://github.com/tmzane/musttag
* `gocheckcompilerdirectives`: https://github.com/leighmcculloch/gocheckcompilerdirectives
2. updated linters
* `bodyclose`: to HEAD
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -181,7 +181,7 @@ The Core Team has the following responsibilities:
<td align="center"><a href="https://github.com/barthr?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/9822478?u=c159fa0a22133fabb6a8468ed2372273f60cc7d9&v=4" width="100px;" alt=""/><br /><sub><b>Bart</b></sub></a></td>
<td align="center"><a href="https://github.com/neha-viswanathan?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/12013126?u=479684c936cc8b80f122fdede3f4afc4ceb80136&v=4" width="100px;" alt=""/><br /><sub><b>Neha Viswanathan</b></sub></a></td>
<td align="center"><a href="https://github.com/dbraley?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/2067019?u=47d3d161a65b877714779c39d2eb6dc686d427ec&v=4" width="100px;" alt=""/><br /><sub><b>David Braley</b></sub></a></td>
<td align="center"><a href="https://github.com/junk1tm?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/73077675?u=2e0a95650ef31e86c4b40b8d041794f6752aed3a&v=4" width="100px;" alt=""/><br /><sub><b>Tom</b></sub></a></td>
<td align="center"><a href="https://github.com/tmzane?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/73077675?u=2e0a95650ef31e86c4b40b8d041794f6752aed3a&v=4" width="100px;" alt=""/><br /><sub><b>Tom</b></sub></a></td>
<td align="center"><a href="https://github.com/cbandy?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/106560?v=4" width="100px;" alt=""/><br /><sub><b>Chris Bandy</b></sub></a></td>
<td align="center"><a href="https://patrickkuca.com?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/9790383?u=f3ee6bab4997260734040e0119d4cb35810973d7&v=4" width="100px;" alt=""/><br /><sub><b>Patrick Kuca</b></sub></a></td>
<td align="center"><a href="https://dev.to/vearutop?utm_source=golangci-lint-contributors"><img src="https://avatars.githubusercontent.com/u/1381436?v=4" width="100px;" alt=""/><br /><sub><b>Viacheslav Poturaev</b></sub></a></td>
Expand Down
14 changes: 7 additions & 7 deletions docs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion docs/package.json
Expand Up @@ -22,7 +22,7 @@
"gatsby-plugin-react-helmet": "^5.21.0",
"gatsby-plugin-react-svg": "^3.1.0",
"gatsby-plugin-robots-txt": "^1.7.1",
"gatsby-plugin-sharp": "^4.25.0",
"gatsby-plugin-sharp": "^4.25.1",
"gatsby-plugin-sitemap": "^5.24.0",
"gatsby-remark-autolink-headers": "^5.24.0",
"gatsby-remark-copy-linked-files": "^5.24.0",
Expand Down
2 changes: 1 addition & 1 deletion docs/src/docs/contributing/new-linters.mdx
Expand Up @@ -10,7 +10,7 @@ from scratch and integrate it into `golangci-lint`.
## How to add a public linter to `golangci-lint`

You need to implement a new linter using `go/analysis` API.
We don't accept not `go/analysis` linters.
We don't accept non `go/analysis` linters.

After that:

Expand Down
6 changes: 3 additions & 3 deletions docs/src/docs/index.mdx
Expand Up @@ -21,11 +21,11 @@ Follow the news and releases on our twitter <IconContainer color="#1DA1F2"><FaTw
## Features

-[Very fast](/usage/performance): runs linters in parallel, reuses Go build cache and caches analysis results.
- ⚙️ Yaml-based [configuration](/usage/configuration).
- 🖥 [integrations](/usage/integrations) with VS Code, Sublime Text, GoLand, GNU Emacs, Vim, Atom, GitHub Actions.
- ⚙️ YAML-based [configuration](/usage/configuration).
- 🖥 [Integrations](/usage/integrations) with VS Code, Sublime Text, GoLand, GNU Emacs, Vim, Atom, GitHub Actions.
- 🥇 [A lot of linters](/usage/linters) included, no need to install them.
- 📈 Minimum number of [false positives](/usage/false-positives) because of tuned default settings.
- 🔥nice output with colors, source code lines and marked `identifiers`.
- 🔥 Nice output with colors, source code lines and marked `identifiers`.

[Get started now!](/usage/install)

Expand Down
18 changes: 10 additions & 8 deletions go.mod
Expand Up @@ -12,7 +12,8 @@ require (
github.com/BurntSushi/toml v1.2.1
github.com/Djarvur/go-err113 v0.0.0-20210108212216-aea10b59be24
github.com/GaijinEntertainment/go-exhaustruct/v2 v2.3.0
github.com/OpenPeeDeeP/depguard v1.1.1
github.com/OpenPeeDeeP/depguard/v2 v2.0.1
github.com/alexkohler/nakedret/v2 v2.0.1
github.com/alexkohler/prealloc v1.0.0
github.com/alingse/asasalint v0.0.11
github.com/ashanbrown/forbidigo v1.5.1
Expand All @@ -22,7 +23,7 @@ require (
github.com/bombsimon/wsl/v3 v3.4.0
github.com/breml/bidichk v0.2.4
github.com/breml/errchkjson v0.3.1
github.com/butuzov/ireturn v0.1.1
github.com/butuzov/ireturn v0.2.0
github.com/charithe/durationcheck v0.0.10
github.com/curioswitch/go-reassign v0.2.0
github.com/daixiang0/gci v0.10.1
Expand All @@ -31,7 +32,7 @@ require (
github.com/fatih/color v1.15.0
github.com/firefart/nonamedreturns v1.0.4
github.com/fzipp/gocyclo v0.6.0
github.com/go-critic/go-critic v0.7.0
github.com/go-critic/go-critic v0.8.0
github.com/go-xmlfmt/xmlfmt v1.1.2
github.com/gofrs/flock v0.8.1
github.com/golangci/check v0.0.0-20180506172741-cfe4005ccda2
Expand All @@ -53,14 +54,13 @@ require (
github.com/jingyugao/rowserrcheck v1.1.1
github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af
github.com/julz/importas v0.1.0
github.com/junk1tm/musttag v0.5.0
github.com/kisielk/errcheck v1.6.3
github.com/kkHAIKE/contextcheck v1.1.4
github.com/kulti/thelper v0.6.3
github.com/kunwardeep/paralleltest v1.0.6
github.com/kyoh86/exportloopref v0.1.11
github.com/ldez/gomoddirectives v0.2.3
github.com/ldez/tagliatelle v0.4.0
github.com/ldez/tagliatelle v0.5.0
github.com/leonklingele/grouper v1.1.1
github.com/lufeee/execinquery v1.2.1
github.com/maratori/testableexamples v1.0.0
Expand All @@ -75,7 +75,7 @@ require (
github.com/nakabonne/nestif v0.3.1
github.com/nishanths/exhaustive v0.10.0
github.com/nishanths/predeclared v0.2.2
github.com/nunnatsa/ginkgolinter v0.11.0
github.com/nunnatsa/ginkgolinter v0.11.2
github.com/polyfloyd/go-errorlint v1.4.0
github.com/quasilyte/go-ruleguard/dsl v0.3.22
github.com/ryancurrah/gomodguard v1.3.0
Expand All @@ -99,7 +99,7 @@ require (
github.com/stretchr/testify v1.8.2
github.com/tdakkota/asciicheck v0.2.0
github.com/tetafro/godot v1.4.11
github.com/timakin/bodyclose v0.0.0-20221125081123-e39cf3fc478e
github.com/timakin/bodyclose v0.0.0-20230421092635-574207250966
github.com/timonwong/loggercheck v0.9.4
github.com/tomarrell/wrapcheck/v2 v2.8.1
github.com/tommy-muehle/go-mnd/v2 v2.5.1
Expand All @@ -110,11 +110,13 @@ require (
github.com/xen0n/gosmopolitan v1.2.1
github.com/yagipy/maintidx v1.0.0
github.com/yeya24/promlinter v0.2.0
github.com/ykadowak/zerologlint v0.1.1
gitlab.com/bosi/decorder v0.2.3
go.tmz.dev/musttag v0.6.0
golang.org/x/tools v0.8.0
gopkg.in/yaml.v3 v3.0.1
honnef.co/go/tools v0.4.3
mvdan.cc/gofumpt v0.4.0
mvdan.cc/gofumpt v0.5.0
mvdan.cc/interfacer v0.0.0-20180901003855-c20040233aed
mvdan.cc/unparam v0.0.0-20221223090309-7455f1af531d
)
Expand Down

0 comments on commit 0dc6570

Please sign in to comment.