docs: add skip-dirs-use-default into .golangci.example.yml (#820)

This commit is contained in:
Isaev Denis 2019-10-14 23:19:57 +03:00 committed by GitHub
parent 22df2d739f
commit f2c566b7e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 82 additions and 75 deletions

View File

@ -19,15 +19,18 @@ run:
build-tags: build-tags:
- mytag - mytag
# which dirs to skip: they won't be analyzed; # which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path; # can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently # default value is empty list, but default dirs are skipped independently
# from this option's value: # from this option's value (see skip-dirs-use-default).
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs: skip-dirs:
- src/external_libs - src/external_libs
- autogenerated_by_my_lib - autogenerated_by_my_lib
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them # which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is # won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize # no need to include all autogenerated files, we confidently recognize

146
README.md
View File

@ -500,73 +500,74 @@ Usage:
golangci-lint run [flags] golangci-lint run [flags]
Flags: Flags:
--out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml (default "colored-line-number") --out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|junit-xml (default "colored-line-number")
--print-issued-lines Print lines of code with issue (default true) --print-issued-lines Print lines of code with issue (default true)
--print-linter-name Print linter name in issue line (default true) --print-linter-name Print linter name in issue line (default true)
--issues-exit-code int Exit code when issues were found (default 1) --modules-download-mode string Modules download mode. If not empty, passed as -mod=<mode> to go tools
--build-tags strings Build tags --issues-exit-code int Exit code when issues were found (default 1)
--timeout duration Timeout for total work (default 1m0s) --build-tags strings Build tags
--tests Analyze tests (*_test.go) (default true) --timeout duration Timeout for total work (default 1m0s)
--print-resources-usage Print avg and max memory usage of golangci-lint and total time --tests Analyze tests (*_test.go) (default true)
-c, --config PATH Read config from file path PATH --print-resources-usage Print avg and max memory usage of golangci-lint and total time
--no-config Don't read config -c, --config PATH Read config from file path PATH
--skip-dirs strings Regexps of directories to skip --no-config Don't read config
--skip-dirs-use-default Use or not use default excluded directories: --skip-dirs strings Regexps of directories to skip
- (^|/)vendor($|/) --skip-dirs-use-default Use or not use default excluded directories:
- (^|/)third_party($|/) - (^|/)vendor($|/)
- (^|/)testdata($|/) - (^|/)third_party($|/)
- (^|/)examples($|/) - (^|/)testdata($|/)
- (^|/)Godeps($|/) - (^|/)examples($|/)
- (^|/)builtin($|/) - (^|/)Godeps($|/)
(default true) - (^|/)builtin($|/)
--skip-files strings Regexps of files to skip (default true)
-E, --enable strings Enable specific linter --skip-files strings Regexps of files to skip
-D, --disable strings Disable specific linter -E, --enable strings Enable specific linter
--disable-all Disable all linters -D, --disable strings Disable specific linter
-p, --presets strings Enable presets (bugs|complexity|format|performance|style|unused) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all --disable-all Disable all linters
--fast Run only fast linters from enabled linters set (first run won't be fast) -p, --presets strings Enable presets (bugs|complexity|format|performance|style|unused) of linters. Run 'golangci-lint linters' to see them. This option implies option --disable-all
-e, --exclude strings Exclude issue by regexp --fast Run only fast linters from enabled linters set (first run won't be fast)
--exclude-use-default Use or not use default excludes: -e, --exclude strings Exclude issue by regexp
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok --exclude-use-default Use or not use default excludes:
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked # errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
# golint: Annoying issue about not having a comment. The rare codebase has such comments
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form) # golint: Annoying issue about not having a comment. The rare codebase has such comments
- (comment on exported (method|function|type|const)|should have( a package)? comment|comment should be of the form)
# golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this # golint: False positive when tests are defined in package 'test'
- func name will be used as test\.Test.* by other packages, and that stutters; consider calling this
# govet: Common false positives
- (possible misuse of unsafe.Pointer|should have signature) # govet: Common false positives
- (possible misuse of unsafe.Pointer|should have signature)
# staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
- ineffective break statement. Did you mean to break out of the outer loop # staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore
- ineffective break statement. Did you mean to break out of the outer loop
# gosec: Too many false-positives on 'unsafe' usage
- Use of unsafe calls should be audited # gosec: Too many false-positives on 'unsafe' usage
- Use of unsafe calls should be audited
# gosec: Too many false-positives for parametrized shell calls
- Subprocess launch(ed with variable|ing should be audited) # gosec: Too many false-positives for parametrized shell calls
- Subprocess launch(ed with variable|ing should be audited)
# gosec: Duplicated errcheck checks
- G104 # gosec: Duplicated errcheck checks
- G104
# gosec: Too many issues in popular repos
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less) # gosec: Too many issues in popular repos
- (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
# gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
- Potential file inclusion via variable # gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
(default true) - Potential file inclusion via variable
--max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50) (default true)
--max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3) --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)
-n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed. --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)
It's a super-useful option for integration of golangci-lint into existing large codebase. -n, --new Show only new issues: if there are unstaged changes or untracked files, only those changes are analyzed, else only changes in HEAD~ are analyzed.
It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code. It's a super-useful option for integration of golangci-lint into existing large codebase.
For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs. It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
--new-from-rev REV Show only new issues created after git revision REV For CI setups, prefer --new-from-rev=HEAD~, as --new can skip linting the current patch if any scripts generate unstaged files before golangci-lint runs.
--new-from-patch PATH Show only new issues created in git patch with file path PATH --new-from-rev REV Show only new issues created after git revision REV
--fix Fix found issues (if it's supported by the linter) --new-from-patch PATH Show only new issues created in git patch with file path PATH
-h, --help help for run --fix Fix found issues (if it's supported by the linter)
-h, --help help for run
Global Flags: Global Flags:
--color string Use color when printing; can be 'always', 'auto', or 'never' (default "auto") --color string Use color when printing; can be 'always', 'auto', or 'never' (default "auto")
@ -618,15 +619,18 @@ run:
build-tags: build-tags:
- mytag - mytag
# which dirs to skip: they won't be analyzed; # which dirs to skip: issues from them won't be reported;
# can use regexp here: generated.*, regexp is applied on full path; # can use regexp here: generated.*, regexp is applied on full path;
# default value is empty list, but next dirs are always skipped independently # default value is empty list, but default dirs are skipped independently
# from this option's value: # from this option's value (see skip-dirs-use-default).
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs: skip-dirs:
- src/external_libs - src/external_libs
- autogenerated_by_my_lib - autogenerated_by_my_lib
# default is true. Enables skipping of directories:
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
skip-dirs-use-default: true
# which files to skip: they will be analyzed, but issues from them # which files to skip: they will be analyzed, but issues from them
# won't be reported. Default value is empty list, but there is # won't be reported. Default value is empty list, but there is
# no need to include all autogenerated files, we confidently recognize # no need to include all autogenerated files, we confidently recognize