-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev: remove unrelated flags from config and linters command #4284
Conversation
@ldez would like to merge this one to work on others ideas that touch same part of code (to avoid rebases later). There is anything I can do to get this one merged? |
Diff of the help commands to help the review:
diff10c10
< config Config
---
> config Config file information
diff
diff
diff1c1
< Config
---
> Config file information
diff
diff7,99c7,15
< --out-format string Format of output: colored-line-number|line-number|json|tab|checkstyle|code-climate|html|junit-xml|github-actions|teamcity (default "colored-line-number")
< --print-issued-lines Print lines of code with issue (default true)
< --print-linter-name Print linter name in issue line (default true)
< --uniq-by-line Make issues output unique by line (default true)
< --sort-results Sort linter results
< --path-prefix string Path prefix to add to output
< --modules-download-mode string Modules download mode. If not empty, passed as -mod=<mode> to go tools
< --issues-exit-code int Exit code when issues were found (default 1)
< --go string Targeted Go version
< --build-tags strings Build tags
< --timeout duration Timeout for total work (default 1m0s)
< --tests Analyze tests (*_test.go) (default true)
< --print-resources-usage Print avg and max memory usage of golangci-lint and total time
< -c, --config PATH Read config from file path PATH
< --no-config Don't read config
< --skip-dirs strings Regexps of directories to skip
< --skip-dirs-use-default Use or not use default excluded directories:
< - (^|/)vendor($|/)
< - (^|/)third_party($|/)
< - (^|/)testdata($|/)
< - (^|/)examples($|/)
< - (^|/)Godeps($|/)
< - (^|/)builtin($|/)
< (default true)
< --skip-files strings Regexps of files to skip
< --allow-parallel-runners Allow multiple parallel golangci-lint instances running. If false (default) - golangci-lint acquires file lock on start.
< --allow-serial-runners Allow multiple golangci-lint instances running, but serialize them around a lock. If false (default) - golangci-lint exits with an error if it fails to acquire file lock on start.
< --show-stats Show statistics per linter
< -E, --enable strings Enable specific linter
< -D, --disable strings Disable specific linter
< --enable-all Enable all linters
< --disable-all Disable all linters
< -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters. Run 'golangci-lint help linters' to see them. This option implies option --disable-all
< --fast Run only fast linters from enabled linters set (first run won't be fast)
< -e, --exclude strings Exclude issue by regexp
< --exclude-use-default Use or not use default excludes:
< # EXC0001 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)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
<
< # EXC0002 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)
<
< # EXC0003 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
<
< # EXC0004 govet: Common false positives
< - (possible misuse of unsafe.Pointer|should have signature)
<
< # EXC0005 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
<
< # EXC0006 gosec: Too many false-positives on 'unsafe' usage
< - Use of unsafe calls should be audited
<
< # EXC0007 gosec: Too many false-positives for parametrized shell calls
< - Subprocess launch(ed with variable|ing should be audited)
<
< # EXC0008 gosec: Duplicated errcheck checks
< - (G104)
<
< # EXC0009 gosec: Too many issues in popular repos
< - (Expect directory permissions to be 0750 or less|Expect file permissions to be 0600 or less)
<
< # EXC0010 gosec: False positive is triggered by 'src, err := ioutil.ReadFile(filename)'
< - Potential file inclusion via variable
<
< # EXC0011 stylecheck: 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)
<
< # EXC0012 revive: Annoying issue about not having a comment. The rare codebase has such comments
< - exported (.+) should have comment( \(or a comment on this block\))? or be unexported
<
< # EXC0013 revive: Annoying issue about not having a comment. The rare codebase has such comments
< - package comment should be of the form "(.+)...
<
< # EXC0014 revive: Annoying issue about not having a comment. The rare codebase has such comments
< - comment on exported (.+) should be of the form "(.+)..."
<
< # EXC0015 revive: Annoying issue about not having a comment. The rare codebase has such comments
< - should have a package comment
< (default true)
< --exclude-case-sensitive If set to true exclude and exclude rules regular expressions are case sensitive
< --max-issues-per-linter int Maximum issues count per one linter. Set to 0 to disable (default 50)
< --max-same-issues int Maximum count of issues with the same text. Set to 0 to disable (default 3)
< -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 a super-useful option for integration of golangci-lint into existing large codebase.
< It's not practical to fix all existing issues at the moment of integration: much better to not allow issues in new code.
< 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-rev REV Show only new issues created after git revision REV
< --new-from-patch PATH Show only new issues created in git patch with file path PATH
< --whole-files Show issues in any part of update files (requires new-from-rev or new-from-patch)
< --fix Fix found issues (if it's supported by the linter)
< -h, --help help for linters
---
> -c, --config PATH Read config from file path PATH
> --no-config Don't read config file
> -D, --disable strings Disable specific linter
> --disable-all Disable all linters
> -E, --enable strings Enable specific linter
> --enable-all Enable all linters
> --fast Enable only fast linters from enabled linters set (first run won't be fast)
> -p, --presets strings Enable presets (bugs|comment|complexity|error|format|import|metalinter|module|performance|sql|style|test|unused) of linters. Run 'golangci-lint help linters' to see them. This option implies option --disable-all
> -h, --help help for linters
diff6a7,8
> -c, --config PATH Read config from file path PATH
> --no-config Don't read config file
20,21d21
< -c, --config PATH Read config from file path PATH
< --no-config Don't read config
35d34
< -E, --enable strings Enable specific linter
37d35
< --enable-all Enable all linters
38a37,39
> -E, --enable strings Enable specific linter
> --enable-all Enable all linters
> --fast Enable only fast linters from enabled linters set (first run won't be fast)
40d40
< --fast Run only fast linters from enabled linters set (first run won't be fast)
diff |
The PR contains some unrelated changes and introduces some opinionated ways to handle flags. The unrelated changes (like the messages related to the list of linters) are "minor" (and partially wrong, I fixed them) but this should be avoided. Some flags (ex: |
546d2fc
to
6cf5ecd
Compare
84bd215
to
3bb4f79
Compare
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
3bb4f79
to
276a746
Compare
…#4284) Co-authored-by: Fernandez Ludovic <ldez@users.noreply.github.com>
config
andlinters
command would present all flags fromrun
command to users. This PR removes unnecessary flags from those commands.