From bcae8c78caf2a7e914bbde9aab73f9314974ea45 Mon Sep 17 00:00:00 2001 From: Marcin Federowicz Date: Fri, 27 Oct 2023 07:26:27 +0200 Subject: [PATCH] fix trailing whitespaces (#917) --- README.md | 8 ++++---- RULES_DESCRIPTIONS.md | 6 +++--- config/testdata/enableAllBut2.toml | 2 +- testdata/confusing-results.go | 2 +- testdata/duplicated-imports.go | 2 +- testdata/golint/error-strings.go | 2 +- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index b9f82bd..b628652 100644 --- a/README.md +++ b/README.md @@ -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/ ghcr.io/mgechev/revive:v1.1.2-next -config /var//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. diff --git a/RULES_DESCRIPTIONS.md b/RULES_DESCRIPTIONS.md index ef0e4b4..f4aeb48 100644 --- a/RULES_DESCRIPTIONS.md +++ b/RULES_DESCRIPTIONS.md @@ -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: diff --git a/config/testdata/enableAllBut2.toml b/config/testdata/enableAllBut2.toml index adc8f76..0e450ec 100644 --- a/config/testdata/enableAllBut2.toml +++ b/config/testdata/enableAllBut2.toml @@ -9,4 +9,4 @@ enableAllRules = true [rule.exported] disabled=true [rule.cyclomatic] - disabled=true + disabled=true diff --git a/testdata/confusing-results.go b/testdata/confusing-results.go index 772fc45..fc47abe 100644 --- a/testdata/confusing-results.go +++ b/testdata/confusing-results.go @@ -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/ diff --git a/testdata/duplicated-imports.go b/testdata/duplicated-imports.go index 07211c7..f499b21 100644 --- a/testdata/duplicated-imports.go +++ b/testdata/duplicated-imports.go @@ -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/ diff --git a/testdata/golint/error-strings.go b/testdata/golint/error-strings.go index 54dab8c..e3ae153 100644 --- a/testdata/golint/error-strings.go +++ b/testdata/golint/error-strings.go @@ -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)