gopkg.in/ubuntu-core/snappy.v0@v0.0.0-20210902073436-25a8614f10a6/.golangci.yml (about)

     1  run:
     2    # default concurrency is a available CPU number
     3    concurrency: 4
     4  
     5    # timeout for analysis, e.g. 30s, 5m, default is 1m
     6    timeout: 5m
     7  
     8    # exit code when at least one issue was found, default is 1
     9    # issues-exit-code: 1
    10  
    11    # include test files or not, default is true
    12    tests: true
    13  
    14    # list of build tags, all linters use it. Default is empty list.
    15    #build-tags:
    16    #  - mytag
    17  
    18    # which dirs to skip: issues from them won't be reported;
    19    # can use regexp here: generated.*, regexp is applied on full path;
    20    # default value is empty list, but default dirs are skipped independently
    21    # from this option's value (see skip-dirs-use-default).
    22    # "/" will be replaced by current OS file path separator to properly work
    23    # on Windows.
    24    #skip-dirs:
    25    #  - src/external_libs
    26    #  - autogenerated_by_my_lib
    27  
    28    # default is true. Enables skipping of directories:
    29    #   vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
    30    skip-dirs-use-default: true
    31  
    32    # which files to skip: they will be analyzed, but issues from them
    33    # won't be reported. Default value is empty list, but there is
    34    # no need to include all autogenerated files, we confidently recognize
    35    # autogenerated files. If it's not please let us know.
    36    # "/" will be replaced by current OS file path separator to properly work
    37    # on Windows.
    38    # skip-files:
    39    #   - export_test.go
    40  
    41    # by default isn't set. If set we pass it to "go list -mod={option}". From "go help modules":
    42    # If invoked with -mod=readonly, the go command is disallowed from the implicit
    43    # automatic updating of go.mod described above. Instead, it fails when any changes
    44    # to go.mod are needed. This setting is most useful to check that go.mod does
    45    # not need updates, such as in a continuous integration and testing system.
    46    # If invoked with -mod=vendor, the go command assumes that the vendor
    47    # directory holds the correct copies of dependencies and ignores
    48    # the dependency descriptions in go.mod.
    49    # modules-download-mode: readonly|release|vendor
    50  
    51    # Allow multiple parallel golangci-lint instances running.
    52    # If false (default) - golangci-lint acquires file lock on start.
    53    allow-parallel-runners: false
    54  
    55  # output configuration options
    56  output:
    57    # colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
    58    # format: colored-line-number
    59  
    60    # print lines of code with issue, default is true
    61    # print-issued-lines: true
    62  
    63    # print linter name in the end of issue text, default is true
    64    # print-linter-name: true
    65  
    66    # make issues output unique by line, default is true
    67    # uniq-by-line: true
    68  
    69    # add a prefix to the output file references; default is no prefix
    70    # path-prefix: ""
    71  
    72  # all available settings of specific linters
    73  linters-settings:
    74    errcheck:
    75      # report about not checking of errors in type assertions: `a := b.(MyStruct)`;
    76      # default is false: such cases aren't reported by default.
    77      check-type-assertions: false
    78  
    79      # report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
    80      # default is false: such cases aren't reported by default.
    81      check-blank: false
    82  
    83      # [deprecated] comma-separated list of pairs of the form pkg:regex
    84      # the regex is used to ignore names within pkg. (default "fmt:.*").
    85      # see https://github.com/kisielk/errcheck#the-deprecated-method for details
    86      ignore: fmt:.*,io/ioutil:^Read.*
    87  
    88      # path to a file containing a list of functions to exclude from checking
    89      # see https://github.com/kisielk/errcheck#excluding-functions for details
    90      # exclude: /path/to/file.txt
    91  
    92    gci:
    93      # put imports beginning with prefix after 3rd-party packages;
    94      # only support one prefix
    95      # if not set, use goimports.local-prefixes
    96      local-prefixes: github.com/snapcore/snapd
    97    govet:
    98      # report about shadowed variables
    99      check-shadowing: false
   100    golint:
   101      # minimal confidence for issues, default is 0.8
   102      min-confidence: 0.8
   103    gofmt:
   104      # simplify code: gofmt with `-s` option, true by default
   105      simplify: true
   106    goimports:
   107      # put imports beginning with prefix after 3rd-party packages;
   108      # it's a comma-separated list of prefixes
   109      local-prefixes: github.com/snapcore/snapd
   110    gocyclo:
   111      # minimal code complexity to report, 30 by default (but we recommend 10-20)
   112      min-complexity: 10
   113    maligned:
   114      # print struct with more effective memory layout or not, false by default
   115      suggest-new: true
   116    dupl:
   117      # tokens count to trigger issue, 150 by default
   118      threshold: 100
   119    goconst:
   120      # minimal length of string constant, 3 by default
   121      min-len: 3
   122      # minimal occurrences count to trigger, 3 by default
   123      min-occurrences: 3
   124    # depguard:
   125    #   list-type: blacklist
   126    #   include-go-root: false
   127    #   packages:
   128    #     - github.com/davecgh/go-spew/spew
   129    misspell:
   130      # Correct spellings using locale preferences for US or UK.
   131      # Default is to use a neutral variety of English.
   132      # Setting locale to US will correct the British spelling of 'colour' to 'color'.
   133      #locale: US
   134      ignore-words:
   135        - someword
   136        - auther
   137        - PROCES
   138        - PROCESSS
   139        - proces
   140        - processs
   141        - exportfs
   142    lll:
   143      # max line length, lines longer will be reported. Default is 120.
   144      # '\t' is counted as 1 character by default, and can be changed with the tab-width option
   145      line-length: 120
   146      # tab width in spaces. Default to 1.
   147      tab-width: 1
   148    unused:
   149      # treat code as a program (not a library) and report unused exported identifiers; default is false.
   150      # XXX: if you enable this setting, unused will report a lot of false-positives in text editors:
   151      # if it's called for subdir of a project it can't find funcs usages. All text editor integrations
   152      # with golangci-lint call it on a directory with the changed file.
   153      check-exported: false
   154    unparam:
   155      # Inspect exported functions, default is false. Set to true if no external program/library imports your code.
   156      # XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
   157      # if it's called for subdir of a project it can't find external interfaces. All text editor integrations
   158      # with golangci-lint call it on a directory with the changed file.
   159      check-exported: false
   160    nakedret:
   161      # make an issue if func has more lines of code than this setting and it has naked returns; default is 30
   162      max-func-lines: 5
   163    prealloc:
   164      # XXX: we don't recommend using this linter before doing performance profiling.
   165      # For most programs usage of prealloc will be a premature optimization.
   166  
   167      # Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
   168      # True by default.
   169      simple: true
   170      range-loops: true # Report preallocation suggestions on range loops, true by default
   171      for-loops: false # Report preallocation suggestions on for loops, false by default
   172  
   173  linters:
   174    # enable the following linters
   175    enable:
   176      - govet
   177      - misspell
   178      - deadcode
   179      - unused
   180      # gosimple may suggest patterns that work only with more recent Go versions
   181      # - gosimple
   182      - nakedret
   183      # formatting is disabled until we move to Go 1.13
   184      # - gofmt
   185      - ineffassign
   186      - gci
   187      - testpackage
   188    # disable everything else
   189    disable-all: true
   190  
   191  
   192  issues:
   193    # List of regexps of issue texts to exclude, empty list by default.
   194    # But independently from this option we use default exclude patterns,
   195    # it can be disabled by `exclude-use-default: false`. To list all
   196    # excluded by default patterns execute `golangci-lint run --help`
   197    # exclude:
   198    #   - abcdef
   199  
   200    # Excluding configuration per-path, per-linter, per-text and per-source
   201    exclude-rules:
   202      # Exclude some linters from running on tests files.
   203      - path: _test\.go
   204        linters:
   205          - gocyclo
   206          - errcheck
   207          - dupl
   208          - gosec
   209  
   210      - path: export.*_test\.go
   211        linters:
   212          - deadcode
   213          - testpackage
   214  
   215      - path: osutil/.*_test.go
   216        linters:
   217          - testpackage
   218  
   219      # an external dependency that was imported
   220      - path: udev/netlink/.*.go
   221        linters:
   222          - testpackage
   223          - nakedret
   224  
   225      - path: udev/crawler/.*.go
   226        linters:
   227          - testpackage
   228          - nakedret
   229  
   230      # test files that do live in corresponding xxx_test packages, they will
   231      # need over time to be moved to *_internal_test.go or fixed
   232      - path: arch/arch_test.go
   233        linters:
   234          - testpackage
   235      - path: asserts/findwildcard_test.go
   236        linters:
   237          - testpackage
   238      - path: cmd/snapctl/main_test.go
   239        linters:
   240          - testpackage
   241      - path: cmd/snap-update-ns/sorting_test.go
   242        linters:
   243          - testpackage
   244      - path: daemon/daemon_test.go
   245        linters:
   246          - testpackage
   247      - path: daemon/ucrednet_test.go
   248        linters:
   249          - testpackage
   250      - path: i18n/i18n_test.go
   251        linters:
   252          - testpackage
   253      - path: i18n/xgettext-go/main_test.go
   254        linters:
   255          - testpackage
   256      - path: interfaces/hotplug/deviceinfo_test.go
   257        linters:
   258          - testpackage
   259      - path: interfaces/hotplug/proposed_slot_test.go
   260        linters:
   261          - testpackage
   262      - path: interfaces/hotplug/udevadm_test.go
   263        linters:
   264          - testpackage
   265      - path: overlord/hookstate/context_test.go
   266        linters:
   267          - testpackage
   268      - path: overlord/hookstate/repository_test.go
   269        linters:
   270          - testpackage
   271      - path: overlord/snapstate/cookies_test.go
   272        linters:
   273          - testpackage
   274      - path: overlord/snapstate/progress_test.go
   275        linters:
   276          - testpackage
   277      - path: polkit/pid_start_time_test.go
   278        linters:
   279          - testpackage
   280      - path: snap/snapenv/snapenv_test.go
   281        linters:
   282          - testpackage
   283      - path: snap/types_test.go
   284        linters:
   285          - testpackage
   286      - path: store/details_v2_test.go
   287        linters:
   288          - testpackage
   289      - path: store/stringlist_test.go
   290        linters:
   291          - testpackage
   292      - path: strutil/shlex/shlex_test.go
   293        linters:
   294          - testpackage
   295      - path: tests/lib/fakestore/store/store_test.go
   296        linters:
   297          - testpackage
   298      - path: testutil/exec_test.go
   299        linters:
   300          - testpackage
   301      - path: timeout/timeout_test.go
   302        linters:
   303          - testpackage
   304  
   305    # Independently from option `exclude` we use default exclude patterns,
   306    # it can be disabled by this option. To list all
   307    # excluded by default patterns execute `golangci-lint run --help`.
   308    # Default value for this option is true.
   309    exclude-use-default: false
   310  
   311    # Maximum issues count per one linter. Set to 0 to disable. Default is 50.
   312    max-per-linter: 0
   313  
   314    # Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
   315    max-same-issues: 0
   316  
   317    # Show only new issues: if there are unstaged changes or untracked files,
   318    # only those changes are analyzed, else only changes in HEAD~ are analyzed.
   319    # It's a super-useful option for integration of golangci-lint into existing
   320    # large codebase. It's not practical to fix all existing issues at the moment
   321    # of integration: much better don't allow issues in new code.
   322    # Default is false.
   323    new: false