consul/.golangci.yml

118 lines
3.7 KiB
YAML
Raw Normal View History

# Copyright (c) HashiCorp, Inc.
[COMPLIANCE] License changes (#18443) * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Adding explicit MPL license for sub-package This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository. * Updating the license from MPL to Business Source License Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl. * add missing license headers * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 * Update copyright file headers to BUSL-1.1 --------- Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 13:12:13 +00:00
# SPDX-License-Identifier: BUSL-1.1
linters:
disable-all: true
enable:
- gofmt
- govet
- unconvert
- staticcheck
- ineffassign
2020-06-23 17:43:24 +00:00
- unparam
- forbidigo
- gomodguard
- depguard
issues:
# Disable the default exclude list so that all excludes are explicitly
# defined in this file.
exclude-use-default: false
exclude-rules:
# Temp Ignore SA9004: only the first constant in this group has an explicit type
# https://staticcheck.io/docs/checks#SA9004
- linters: [staticcheck]
2023-04-28 17:14:37 +00:00
text: "SA9004:"
2022-10-24 16:33:22 +00:00
- linters: [staticcheck]
text: 'SA1019: "io/ioutil" has been deprecated since Go 1.16'
# Allow usage of deprecated values.
- linters: [ staticcheck ]
text: 'SA1019:'
path: "(agent/grpc-external)"
2020-06-23 17:43:24 +00:00
# An argument that always receives the same value is often not a problem.
- linters: [unparam]
2023-04-28 17:14:37 +00:00
text: "always receives"
2020-06-23 17:43:24 +00:00
# Often functions will implement an interface that returns an error without
# needing to return an error. Sometimes the error return value is unnecessary
# but a linter can not tell the difference.
- linters: [unparam]
text: 'result \d+ \(error\) is always nil'
# Allow unused parameters to start with an underscore. Arguments with a name
# of '_' are already ignored.
# Ignoring longer names that start with underscore allow for better
# self-documentation than a single underscore by itself. Underscore arguments
# should generally only be used when a function is implementing an interface.
- linters: [unparam]
2023-04-28 17:14:37 +00:00
text: "`_[^`]*` is unused"
2020-06-23 17:43:24 +00:00
# Temp ignore some common unused parameters so that unparam can be added
# incrementally.
- linters: [unparam]
2023-04-28 17:14:37 +00:00
text: "`(t|resp|req|entMeta)` is unused"
2020-06-23 17:43:24 +00:00
# Temp ignore everything in _ce(_test).go and _ent(_test).go. Many of these
2020-06-23 17:43:24 +00:00
# could use underscore to ignore the unused arguments, but the "always returns"
# issue will likely remain in CE, and will need to be excluded.
2020-06-23 17:43:24 +00:00
- linters: [unparam]
path: "(_ce.go|_ce_test.go|_ent.go|_ent_test.go)"
linters-settings:
govet:
check-shadowing: true
enable-all: true
disable:
- fieldalignment
- nilness
- shadow
- unusedwrite
gofmt:
simplify: true
forbidigo:
# Forbid the following identifiers (list of regexp).
forbid:
- '\bioutil\b(# Use io and os packages instead of ioutil)?'
- '\brequire\.New\b(# Use package-level functions with explicit TestingT)?'
- '\bassert\.New\b(# Use package-level functions with explicit TestingT)?'
# Exclude godoc examples from forbidigo checks.
# Default: true
exclude_godoc_examples: false
gomodguard:
blocked:
# List of blocked modules.
modules:
# Blocked module.
- github.com/hashicorp/net-rpc-msgpackrpc:
recommendations:
- github.com/hashicorp/consul-net-rpc/net-rpc-msgpackrpc
- github.com/hashicorp/go-msgpack:
recommendations:
- github.com/hashicorp/consul-net-rpc/go-msgpack
- github.com/golang/protobuf:
recommendations:
- google.golang.org/protobuf
depguard:
list-type: denylist
include-go-root: true
# A list of packages for the list type specified.
# Default: []
packages:
- net/rpc
# 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:
2023-04-28 17:14:37 +00:00
- net/rpc: "only use forked copy in github.com/hashicorp/consul-net-rpc/net/rpc"
- github.com/golang/protobuf: "only use google.golang.org/protobuf"
run:
timeout: 10m
concurrency: 4
skip-dirs-use-default: false