mirror of
https://github.com/mgechev/revive.git
synced 2024-11-21 17:16:40 +02:00
fix trailing whitespaces (#917)
This commit is contained in:
parent
1ef3c0f554
commit
bcae8c78ca
@ -125,14 +125,14 @@ Since the default behavior of `revive` is compatible with `golint`, without prov
|
||||
`revive` supports a `-config` flag whose value should correspond to a TOML file describing which rules to use for `revive`'s linting. If not provided, `revive` will try to use a global config file (assumed to be located at `$HOME/revive.toml`). Otherwise, if no configuration TOML file is found then `revive` uses a built-in set of default linting rules.
|
||||
|
||||
### Docker
|
||||
A volume needs to be mounted to share the current repository with the container.
|
||||
A volume needs to be mounted to share the current repository with the container.
|
||||
Please refer to the [bind mounts Docker documentation](https://docs.docker.com/storage/bind-mounts/)
|
||||
|
||||
```bash
|
||||
docker run -v "$(pwd)":/var/<repository> ghcr.io/mgechev/revive:v1.1.2-next -config /var/<repository>/revive.toml -formatter stylish ./var/kidle/...
|
||||
```
|
||||
|
||||
- `-v` is for the volume
|
||||
- `-v` is for the volume
|
||||
- `ghcr.io/mgechev/revive:v1.1.2-next ` is the image name and its version corresponding to `revive` command
|
||||
- The provided flags are the same as the binary usage.
|
||||
|
||||
@ -628,11 +628,11 @@ With the snippet above we:
|
||||
A sample rule implementation can be found [here](/rule/argument-limit.go).
|
||||
|
||||
#### Using `revive` as a library
|
||||
If a rule is specific to your use case
|
||||
If a rule is specific to your use case
|
||||
(i.e. it is not a good candidate to be added to `revive`'s rule set) you can add it to your own linter using `revive` as linting engine.
|
||||
|
||||
The following code shows how to use `revive` in your own application.
|
||||
In the example only one rule is added (`myRule`), of course, you can add as many as you need to.
|
||||
In the example only one rule is added (`myRule`), of course, you can add as many as you need to.
|
||||
Your rules can be configured programmatically or with the standard `revive` configuration file.
|
||||
The full rule set of `revive` is also actionable by your application.
|
||||
|
||||
|
@ -33,7 +33,7 @@ List of all available rules.
|
||||
- [error-naming](#error-naming)
|
||||
- [error-return](#error-return)
|
||||
- [error-strings](#error-strings)
|
||||
- [errorf](#errorf)
|
||||
- [errorf](#errorf)
|
||||
- [exported](#exported)
|
||||
- [file-header](#file-header)
|
||||
- [flag-parameter](#flag-parameter)
|
||||
@ -851,8 +851,8 @@ _Description_: This rule warns when [initialism](https://github.com/golang/go/wi
|
||||
|
||||
_Configuration_: This rule accepts two slices of strings and one optional slice with single map with named parameters.
|
||||
(it's due to TOML hasn't "slice of any" and we keep backward compatibility with previous config version)
|
||||
First slice is a whitelist and second one is a blacklist of initialisms.
|
||||
In map, you can add "upperCaseConst=true" parameter to allow `UPPER_CASE` for `const`
|
||||
First slice is a whitelist and second one is a blacklist of initialisms.
|
||||
In map, you can add "upperCaseConst=true" parameter to allow `UPPER_CASE` for `const`
|
||||
By default, the rule behaves exactly as the alternative in `golint` but optionally, you can relax it (see [golint/lint/issues/89](https://github.com/golang/lint/issues/89))
|
||||
|
||||
Example:
|
||||
|
2
config/testdata/enableAllBut2.toml
vendored
2
config/testdata/enableAllBut2.toml
vendored
@ -9,4 +9,4 @@ enableAllRules = true
|
||||
[rule.exported]
|
||||
disabled=true
|
||||
[rule.cyclomatic]
|
||||
disabled=true
|
||||
disabled=true
|
||||
|
2
testdata/confusing-results.go
vendored
2
testdata/confusing-results.go
vendored
@ -4,7 +4,7 @@ func getfoo() (int, int, error) { // MATCH /unnamed results of the same type may
|
||||
|
||||
}
|
||||
|
||||
func getBar(a, b int) (int, error, int) {
|
||||
func getBar(a, b int) (int, error, int) {
|
||||
}
|
||||
|
||||
func Getbaz(a string, b int) (int, float32, string, string) { // MATCH /unnamed results of the same type may be confusing, consider using named results/
|
||||
|
2
testdata/duplicated-imports.go
vendored
2
testdata/duplicated-imports.go
vendored
@ -1,7 +1,7 @@
|
||||
package fixtures
|
||||
|
||||
import(
|
||||
"crypto/md5"
|
||||
"crypto/md5"
|
||||
"strings"
|
||||
_ "crypto/md5" // MATCH /Package "crypto/md5" already imported/
|
||||
str "strings" // MATCH /Package "strings" already imported/
|
||||
|
2
testdata/golint/error-strings.go
vendored
2
testdata/golint/error-strings.go
vendored
@ -16,7 +16,7 @@ func g(x int) error {
|
||||
err = fmt.Errorf("Newlines are really fun\n") // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||
err = errors.New(`too much stuff.`) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||
err = errors.New("This %d is too low", x) // MATCH /error strings should not be capitalized or end with punctuation or a newline/
|
||||
|
||||
|
||||
// Non-regression test for issue #610
|
||||
d.stack.Push(from)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user