|
1 |
| -# © Broadcom. All Rights Reserved. |
2 |
| -# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. |
3 |
| -# SPDX-License-Identifier: MPL-2.0 |
| 1 | +--- |
| 2 | +version: "2" |
4 | 3 |
|
5 |
| -# For more information about the golangci-lint configuration file, refer to: |
6 |
| -# https://golangci-lint.run/usage/configuration/ |
7 |
| - |
8 |
| -issues: |
9 |
| - exclude-rules: |
10 |
| - # Exclude specific staticcheck rules to suppress false positives or acceptable issues. |
11 |
| - - linters: [staticcheck] |
12 |
| - text: "SA4004|SA1019|GetOkExists" |
13 |
| - # Exclude specific gosec rules to suppress warnings about issues deemed acceptable. |
14 |
| - - linters: [gosec] |
15 |
| - text: "G402|G404|G115" |
| 4 | +output: |
| 5 | + formats: |
| 6 | + text: |
| 7 | + path: stdout |
16 | 8 |
|
17 | 9 | linters:
|
18 |
| - disable-all: true # Disable all linters by default and enable only the ones required. |
| 10 | + default: none |
19 | 11 | enable:
|
20 |
| - - gofmt # Checks Go code formatting. |
21 |
| - - goimports # Ensures proper import formatting. |
22 |
| - - gosimple # Reports simplifications in code. |
23 |
| - - govet # Examines code for possible mistakes. |
24 | 12 | - gosec # Checks for security issues in code.
|
| 13 | + - govet # Examines code for possible mistakes. |
25 | 14 | - ineffassign # Detects inefficient assignments.
|
26 | 15 | - misspell # Finds and fixes typos.
|
27 | 16 | - staticcheck # Reports bugs, code smells, and deprecated practices.
|
28 | 17 | - unused # Detects unused variables, constants, etc.
|
| 18 | + settings: |
| 19 | + errcheck: |
| 20 | + exclude-functions: |
| 21 | + - github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set |
| 22 | + - fmt:.* |
| 23 | + - io:Close |
| 24 | + revive: |
| 25 | + rules: |
| 26 | + - name: unreachable-code # Detect code that will never be executed. |
| 27 | + - name: errorf # Avoid string formatting in error messages. |
| 28 | + - name: range # Improve range loop usage. |
| 29 | + - name: superfluous-else # Eliminate unnecessary else statements. |
| 30 | + - name: var-declaration # Simplify variable declaration. |
| 31 | + - name: duplicated-imports # Detect and remove duplicate imports.-imports |
| 32 | + exclusions: |
| 33 | + generated: lax |
| 34 | + presets: |
| 35 | + - comments |
| 36 | + - common-false-positives |
| 37 | + - legacy |
| 38 | + - std-error-handling |
| 39 | + rules: |
| 40 | + # Exclude specific staticcheck rules to suppress false positives or acceptable issues. |
| 41 | + - linters: |
| 42 | + - staticcheck |
| 43 | + text: SA4004|SA1019|GetOkExists |
| 44 | + # Exclude specific gosec rules to suppress warnings about issues deemed acceptable. |
| 45 | + - linters: |
| 46 | + - gosec |
| 47 | + text: G402|G404|G115 |
| 48 | + # TODO: Setting temporary exclusions. |
| 49 | + - linters: |
| 50 | + - staticcheck |
| 51 | + text: QF1001 |
| 52 | + - linters: |
| 53 | + - staticcheck |
| 54 | + text: QF1003 |
| 55 | + - linters: |
| 56 | + - staticcheck |
| 57 | + text: QF1004 |
| 58 | + - linters: |
| 59 | + - staticcheck |
| 60 | + text: QF1007 |
| 61 | + - linters: |
| 62 | + - staticcheck |
| 63 | + text: QF1011 |
| 64 | + - linters: |
| 65 | + - staticcheck |
| 66 | + text: ST1005 |
| 67 | + paths: |
| 68 | + - third_party$ |
| 69 | + - builtin$ |
| 70 | + - examples$ |
29 | 71 |
|
30 | 72 | run:
|
31 | 73 | timeout: 30m # Sets the maximum time limit for the linter run.
|
32 | 74 |
|
33 |
| -output: |
34 |
| - formats: |
35 |
| - - format: colored-line-number # Allows colored output with line numbers when errors are reported. |
36 |
| - |
37 |
| -linters-settings: |
38 |
| - errcheck: |
39 |
| - # Exclude specific functions from errcheck warnings, as errors are intentionally ignored in these cases. |
40 |
| - exclude-functions: |
41 |
| - - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set" |
42 |
| - - "fmt:.*" |
43 |
| - - "io:Close" |
44 |
| - |
45 |
| - revive: |
46 |
| - # Enable specific rules for the revive linter for improved code quality and readability. |
47 |
| - rules: |
48 |
| - - name: unreachable-code # Detect code that will never be executed. |
49 |
| - - name: errorf # Avoid string formatting in error messages. |
50 |
| - - name: range # Improve range loop usage. |
51 |
| - - name: superfluous-else # Eliminate unnecessary else statements. |
52 |
| - - name: var-declaration # Simplify variable declaration. |
53 |
| - - name: duplicated-imports # Detect and remove duplicate imports.-imports |
| 75 | +formatters: |
| 76 | + enable: |
| 77 | + - gofmt |
| 78 | + - goimports |
| 79 | + exclusions: |
| 80 | + generated: lax |
| 81 | + paths: |
| 82 | + - third_party$ |
| 83 | + - builtin$ |
| 84 | + - examples$ |
0 commit comments