|
| 1 | +# SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly> |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | + |
1 | 4 | linters-settings: |
2 | 5 | govet: |
3 | 6 | check-shadowing: true |
4 | 7 | misspell: |
5 | 8 | locale: US |
| 9 | + gomodguard: |
| 10 | + blocked: |
| 11 | + modules: |
| 12 | + - github.com/pkg/errors: |
| 13 | + recommendations: |
| 14 | + - errors |
| 15 | + forbidigo: |
| 16 | + forbid: |
| 17 | + - ^print(ln)?$ |
| 18 | + revive: |
| 19 | + rules: |
| 20 | + - name: package-comments |
| 21 | + disabled: true |
6 | 22 |
|
7 | 23 | linters: |
8 | | - enable-all: true |
| 24 | + enable: |
| 25 | + - asciicheck # Simple linter to check that your code does not contain non-ASCII identifiers |
| 26 | + - bidichk # Checks for dangerous unicode character sequences |
| 27 | + - bodyclose # checks whether HTTP response body is closed successfully |
| 28 | + - contextcheck # check the function whether use a non-inherited context |
| 29 | + - decorder # check declaration order and count of types, constants, variables and functions |
| 30 | + - depguard # Go linter that checks if package imports are in a list of acceptable packages |
| 31 | + - dogsled # Checks assignments with too many blank identifiers (e.g. x, _, _, _, := f()) |
| 32 | + - dupl # Tool for code clone detection |
| 33 | + - durationcheck # check for two durations multiplied together |
| 34 | + - errcheck # Errcheck is a program for checking for unchecked errors in go programs. These unchecked errors can be critical bugs in some cases |
| 35 | + - errchkjson # Checks types passed to the json encoding functions. Reports unsupported types and optionally reports occations, where the check for the returned error can be omitted. |
| 36 | + - errname # Checks that sentinel errors are prefixed with the `Err` and error types are suffixed with the `Error`. |
| 37 | + - exportloopref # checks for pointers to enclosing loop variables |
| 38 | + - forbidigo # Forbids identifiers |
| 39 | + - gci # Gci control golang package import order and make it always deterministic. |
| 40 | + - goconst # Finds repeated strings that could be replaced by a constant |
| 41 | + - gocritic # The most opinionated Go source code linter |
| 42 | + - godox # Tool for detection of FIXME, TODO and other comment keywords |
| 43 | + - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification |
| 44 | + - gofumpt # Gofumpt checks whether code was gofumpt-ed. |
| 45 | + - goheader # Checks is file header matches to pattern |
| 46 | + - goimports # Goimports does everything that gofmt does. Additionally it checks unused imports |
| 47 | + - gomoddirectives # Manage the use of 'replace', 'retract', and 'excludes' directives in go.mod. |
| 48 | + - gomodguard # Allow and block list linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations. |
| 49 | + - goprintffuncname # Checks that printf-like functions are named with `f` at the end |
| 50 | + - gosec # Inspects source code for security problems |
| 51 | + - gosimple # Linter for Go source code that specializes in simplifying a code |
| 52 | + - govet # Vet examines Go source code and reports suspicious constructs, such as Printf calls whose arguments do not align with the format string |
| 53 | + - grouper # An analyzer to analyze expression groups. |
| 54 | + - importas # Enforces consistent import aliases |
| 55 | + - ineffassign # Detects when assignments to existing variables are not used |
| 56 | + - misspell # Finds commonly misspelled English words in comments |
| 57 | + - nakedret # Finds naked returns in functions greater than a specified function length |
| 58 | + - nilerr # Finds the code that returns nil even if it checks that the error is not nil. |
| 59 | + - nilnil # Checks that there is no simultaneous return of `nil` error and an invalid value. |
| 60 | + - noctx # noctx finds sending http request without context.Context |
| 61 | + - predeclared # find code that shadows one of Go's predeclared identifiers |
| 62 | + - revive # golint replacement, finds style mistakes |
| 63 | + - staticcheck # Staticcheck is a go vet on steroids, applying a ton of static analysis checks |
| 64 | + - stylecheck # Stylecheck is a replacement for golint |
| 65 | + - tagliatelle # Checks the struct tags. |
| 66 | + - tenv # tenv is analyzer that detects using os.Setenv instead of t.Setenv since Go1.17 |
| 67 | + - tparallel # tparallel detects inappropriate usage of t.Parallel() method in your Go test codes |
| 68 | + - typecheck # Like the front-end of a Go compiler, parses and type-checks Go code |
| 69 | + - unconvert # Remove unnecessary type conversions |
| 70 | + - unparam # Reports unused function parameters |
| 71 | + - unused # Checks Go code for unused constants, variables, functions and types |
| 72 | + - wastedassign # wastedassign finds wasted assignment statements |
| 73 | + - whitespace # Tool for detection of leading and trailing whitespace |
9 | 74 | disable: |
10 | | - - lll |
11 | | - - gochecknoinits |
12 | | - - gochecknoglobals |
13 | | - - funlen |
| 75 | + - containedctx # containedctx is a linter that detects struct contained context.Context field |
| 76 | + - cyclop # checks function and package cyclomatic complexity |
| 77 | + - exhaustivestruct # Checks if all struct's fields are initialized |
| 78 | + - funlen # Tool for detection of long functions |
| 79 | + - gocyclo # Computes and checks the cyclomatic complexity of functions |
| 80 | + - godot # Check if comments end in a period |
| 81 | + - gomnd # An analyzer to detect magic numbers. |
| 82 | + - ifshort # Checks that your code uses short syntax for if-statements whenever possible |
| 83 | + - ireturn # Accept Interfaces, Return Concrete Types |
| 84 | + - lll # Reports long lines |
| 85 | + - maintidx # maintidx measures the maintainability index of each function. |
| 86 | + - makezero # Finds slice declarations with non-zero initial length |
| 87 | + - maligned # Tool to detect Go structs that would take less memory if their fields were sorted |
| 88 | + - nestif # Reports deeply nested if statements |
| 89 | + - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity |
| 90 | + - nolintlint # Reports ill-formed or insufficient nolint directives |
| 91 | + - paralleltest # paralleltest detects missing usage of t.Parallel() method in your Go test |
| 92 | + - prealloc # Finds slice declarations that could potentially be preallocated |
| 93 | + - promlinter # Check Prometheus metrics naming via promlint |
| 94 | + - rowserrcheck # checks whether Err of rows is checked successfully |
| 95 | + - sqlclosecheck # Checks that sql.Rows and sql.Stmt are closed. |
| 96 | + - testpackage # linter that makes you use a separate _test package |
| 97 | + - thelper # thelper detects golang test helpers without t.Helper() call and checks the consistency of test helpers |
| 98 | + - varnamelen # checks that the length of a variable's name matches its scope |
| 99 | + - wrapcheck # Checks that errors returned from external packages are wrapped |
| 100 | + - wsl # Whitespace Linter - Forces you to use empty lines! |
14 | 101 |
|
15 | 102 | issues: |
16 | 103 | exclude-use-default: false |
| 104 | + exclude-rules: |
| 105 | + # Allow complex tests, better to be self contained |
| 106 | + - path: _test\.go |
| 107 | + linters: |
| 108 | + - gocognit |
| 109 | + - forbidigo |
| 110 | + |
| 111 | + # Allow complex main function in examples |
| 112 | + - path: examples |
| 113 | + text: "of func `main` is high" |
| 114 | + linters: |
| 115 | + - gocognit |
| 116 | + |
| 117 | + # Allow forbidden identifiers in examples |
| 118 | + - path: examples |
| 119 | + linters: |
| 120 | + - forbidigo |
| 121 | + |
| 122 | + # Allow forbidden identifiers in CLI commands |
| 123 | + - path: cmd |
| 124 | + linters: |
| 125 | + - forbidigo |
| 126 | + |
| 127 | +run: |
| 128 | + skip-dirs: |
| 129 | + - c-data-channels |
0 commit comments