|
1 | | ---- |
2 | | -version: "2" |
| 1 | +# © Broadcom. All Rights Reserved. |
| 2 | +# The term “Broadcom” refers to Broadcom Inc. and/or its subsidiaries. |
| 3 | +# SPDX-License-Identifier: MPL-2.0 |
3 | 4 |
|
4 | | -output: |
5 | | - formats: |
6 | | - text: |
7 | | - path: stdout |
| 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" |
8 | 16 |
|
9 | 17 | linters: |
10 | | - default: none |
| 18 | + disable-all: true # Disable all linters by default and enable only the ones required. |
11 | 19 | enable: |
12 | | - - gosec # Checks for security issues in code. |
| 20 | + - gofmt # Checks Go code formatting. |
| 21 | + - goimports # Ensures proper import formatting. |
| 22 | + - gosimple # Reports simplifications in code. |
13 | 23 | - govet # Examines code for possible mistakes. |
| 24 | + - gosec # Checks for security issues in code. |
14 | 25 | - ineffassign # Detects inefficient assignments. |
15 | 26 | - misspell # Finds and fixes typos. |
16 | 27 | - staticcheck # Reports bugs, code smells, and deprecated practices. |
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$ |
71 | 28 |
|
72 | 29 | run: |
73 | 30 | timeout: 30m # Sets the maximum time limit for the linter run. |
74 | 31 |
|
75 | | -formatters: |
76 | | - enable: |
77 | | - - gofmt |
78 | | - - goimports |
79 | | - exclusions: |
80 | | - generated: lax |
81 | | - paths: |
82 | | - - third_party$ |
83 | | - - builtin$ |
84 | | - - examples$ |
| 32 | +output: |
| 33 | + formats: |
| 34 | + - format: colored-line-number # Allows colored output with line numbers when errors are reported. |
| 35 | + |
| 36 | +linters-settings: |
| 37 | + errcheck: |
| 38 | + # Exclude specific functions from errcheck warnings, as errors are intentionally ignored in these cases. |
| 39 | + exclude-functions: |
| 40 | + - "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema:ForceNew|Set" |
| 41 | + - "fmt:.*" |
| 42 | + - "io:Close" |
| 43 | + |
| 44 | + revive: |
| 45 | + # Enable specific rules for the revive linter for improved code quality and readability. |
| 46 | + rules: |
| 47 | + - name: unreachable-code # Detect code that will never be executed. |
| 48 | + - name: errorf # Avoid string formatting in error messages. |
| 49 | + - name: range # Improve range loop usage. |
| 50 | + - name: superfluous-else # Eliminate unnecessary else statements. |
| 51 | + - name: var-declaration # Simplify variable declaration. |
| 52 | + - name: duplicated-imports # Detect and remove duplicate imports.-imports |
0 commit comments