linter

linter is a lint tool for project source code.
About opencave
opencave is an open source organization focusing on peer-to-peer network solutions, find more information here
Install
go install github.com/opencave/linter@latest
Usage
Use the -h parameter to obtain usage help.
> linter -h
linter is a lint tool
Usage:
linter [command]
Examples:
linter blankline
Available Commands:
blankline check if file ends with a blank line
license check if the source code files have a license header
help Help about any command
Flags:
-h, --help help for linter
Use "linter [command] --help" for more information about a command.
Use the blankline command to detect blank lines in files.
> linter blankline -h
check if file ends with a blank line
Usage:
linter blankline [flags]
Aliases:
blankline, bl
Examples:
linter bl -d . -e .idea,testdata
Flags:
-d, --directory string directory to check (default ".")
-e, --exclude strings directories or files to exclude (comma-separated)
-h, --help help for blankline
> # check /tmp/demo directory and exclude .idea
> linter blankline -d /tmp/demo -e .idea
the following files are not end with a blank line:
testdata/blankline/noline.txt
2025/03/30 19:12:59 ERROR linter execute failed reason="blank line issue found"
exit status 1
Use the license command to detect license header in files.
> linter license -h
check if the source code files have a license header
Usage:
linter license [flags]
Aliases:
license, lic
Examples:
linter lic -d . -e .idea,testdata
Flags:
-d, --directory string directory to check (default ".")
-e, --exclude strings directories or files to exclude (comma-separated)
-x, --extensions strings file extension to check, if not set, all files will be checked (comma-separated)
-h, --help help for license
-l, --license string license file to use, if no license file is found and this flag is not set, process will be skipped, support [Apache-2.0, MIT, GPL-2.0, GPL-3.0, LGPL, MPL, BSD]
> # check /tmp/demo directory and exclude .idea
> linter license -d /tmp/demo -e .idea
the following files are not end with a blank line:
testdata/blankline/noline.txt
2025/03/30 19:12:59 ERROR linter execute failed reason="blank line issue found"
exit status 1
License
opencave is licensed under the Apache License 2.0. Refer to LICENSE for more details.