Skip to content

Commit bf7adb6

Browse files
authored
Update README.md & Typo (#1010)
* docs: update README.md - Fix the Docker image version - Syntax and grammer * fix: typo for minimum
1 parent 689291f commit bf7adb6

File tree

2 files changed

+33
-33
lines changed

2 files changed

+33
-33
lines changed

README.md

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -125,20 +125,20 @@ Since the default behavior of `revive` is compatible with `golint`, without prov
125125
`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.
126126

127127
### Docker
128-
A volume needs to be mounted to share the current repository with the container.
128+
A volume must be mounted to share the current repository with the container.
129129
Please refer to the [bind mounts Docker documentation](https://docs.docker.com/storage/bind-mounts/)
130130

131131
```bash
132-
docker run -v "$(pwd)":/var/<repository> ghcr.io/mgechev/revive:v1.1.2-next -config /var/<repository>/revive.toml -formatter stylish ./var/kidle/...
132+
docker run -v "$(pwd)":/var/<repository> ghcr.io/mgechev/revive:v1.3.7 -config /var/<repository>/revive.toml -formatter stylish ./var/kidle/...
133133
```
134134

135135
- `-v` is for the volume
136-
- `ghcr.io/mgechev/revive:v1.1.2-next ` is the image name and its version corresponding to `revive` command
136+
- `ghcr.io/mgechev/revive:v1.3.7 ` is the image name and its version corresponds to `revive` command
137137
- The provided flags are the same as the binary usage.
138138

139139
### Bazel
140140

141-
If you want to use revive with Bazel, take a look at the [rules](https://github.com/atlassian/bazel-tools/tree/master/gorevive) that Atlassian maintains.
141+
If you want to use revive with Bazel, look at the [rules](https://github.com/atlassian/bazel-tools/tree/master/gorevive) that Atlassian maintains.
142142

143143
### Text Editors
144144

@@ -208,14 +208,14 @@ Please notice that if no particular configuration is provided, `revive` will beh
208208

209209
`revive` accepts the following command line parameters:
210210

211-
- `-config [PATH]` - path to config file in TOML format, defaults to `$HOME/revive.toml` if present.
211+
- `-config [PATH]` - path to the config file in TOML format, defaults to `$HOME/revive.toml` if present.
212212
- `-exclude [PATTERN]` - pattern for files/directories/packages to be excluded for linting. You can specify the files you want to exclude for linting either as package name (i.e. `github.com/mgechev/revive`), list them as individual files (i.e. `file.go`), directories (i.e. `./foo/...`), or any combination of the three.
213213
- `-formatter [NAME]` - formatter to be used for the output. The currently available formatters are:
214214

215215
- `default` - will output the failures the same way that `golint` does.
216216
- `json` - outputs the failures in JSON format.
217-
- `ndjson` - outputs the failures as stream in newline delimited JSON (NDJSON) format.
218-
- `friendly` - outputs the failures when found. Shows summary of all the failures.
217+
- `ndjson` - outputs the failures as a stream in newline delimited JSON (NDJSON) format.
218+
- `friendly` - outputs the failures when found. Shows the summary of all the failures.
219219
- `stylish` - formats the failures in a table. Keep in mind that it doesn't stream the output so it might be perceived as slower compared to others.
220220
- `checkstyle` - outputs the failures in XML format compatible with that of Java's [Checkstyle](https://checkstyle.org/).
221221
- `-max_open_files` - maximum number of open files at the same time. Defaults to unlimited.
@@ -236,7 +236,7 @@ revive -config revive.toml -exclude file1.go -exclude file2.go -formatter friend
236236

237237
### Comment Directives
238238

239-
Using comments, you can disable the linter for the entire file or only range of lines:
239+
Using comments, you can disable the linter for the entire file or only a range of lines:
240240

241241
```go
242242
//revive:disable
@@ -259,7 +259,7 @@ func Public() private {
259259
//revive:enable:unexported-return
260260
```
261261

262-
This way, `revive` will not warn you for that you're returning an object of an unexported type, from an exported function.
262+
This way, `revive` will not warn you that you're returning an object of an unexported type, from an exported function.
263263

264264
You can document why you disable the linter by adding a trailing text in the directive, for example
265265

@@ -285,7 +285,7 @@ in the configuration. You can set the severity (defaults to _warning_) of the vi
285285

286286
### Configuration
287287

288-
`revive` can be configured with a TOML file. Here's a sample configuration with explanation for the individual properties:
288+
`revive` can be configured with a TOML file. Here's a sample configuration with an explanation of the individual properties:
289289

290290
```toml
291291
# When set to false, ignores files with "GENERATED" header, similar to golint
@@ -298,7 +298,7 @@ severity = "warning"
298298
# with less than 0.8 confidence will be ignored.
299299
confidence = 0.8
300300
301-
# Sets the error code for failures with severity "error"
301+
# Sets the error code for failures with the "error" severity
302302
errorCode = 0
303303
304304
# Sets the error code for failures with severity "warning"
@@ -323,7 +323,7 @@ To enable all available rules you need to add:
323323
enableAllRules = true
324324
```
325325

326-
This will enable all available rules no matter of what rules are named in the configuration file.
326+
This will enable all available rules no matter what rules are named in the configuration file.
327327

328328
To disable a rule, you simply mark it as disabled in the configuration.
329329
For example:
@@ -333,7 +333,7 @@ For example:
333333
Disabled = true
334334
```
335335
When enabling all rules you still need/can provide specific configurations for rules.
336-
The following files is an example configuration were all rules are enabled, with exception to those that are explicitly disabled, and some rules are configured with particular arguments:
336+
The following file is an example configuration where all rules are enabled, except for those that are explicitly disabled, and some rules are configured with particular arguments:
337337

338338
```toml
339339
severity = "warning"
@@ -429,7 +429,7 @@ warningCode = 0
429429

430430
You also can setup custom excludes for each rule.
431431

432-
It's alternative for global `-exclude` program arg.
432+
It's an alternative for the global `-exclude` program arg.
433433

434434
```toml
435435
ignoreGeneratedHeader = false
@@ -444,17 +444,17 @@ warningCode = 0
444444
Exclude=["src/somepkg/*.go", "TEST"]
445445
```
446446

447-
You can use following exclude patterns
447+
You can use the following exclude patterns
448448

449449
1. full paths to files `src/pkg/mypkg/some.go`
450450
2. globs `src/**/*.pb.go`
451451
3. regexes (should have prefix ~) `~\.(pb|auto|generated)\.go$`
452452
4. well-known `TEST` (same as `**/*_test.go`)
453453
5. special cases:
454-
a. `*` and `~` patterns exclude all files (same effect than disabling the rule)
454+
a. `*` and `~` patterns exclude all files (same effect as disabling the rule)
455455
b. `""` (empty) pattern excludes nothing
456456

457-
> NOTE: do not mess with `exclude` that can be used at top level of TOML file, that mean "exclude package patterns", not "exclude file patterns"
457+
> NOTE: do not mess with `exclude` that can be used at the top level of TOML file, that means "exclude package patterns", not "exclude file patterns"
458458
459459
## Available Rules
460460

@@ -539,7 +539,7 @@ List of all available rules. The rules ported from `golint` are left unchanged a
539539
| [`enforce-slice-style`](./RULES_DESCRIPTIONS.md#enforce-slice-style) | string (defaults to "any") | Enforces consistent usage of `make([]type, 0)` or `[]type{}` for slice initialization. Does not affect `make(map[type]type, non_zero_len, or_non_zero_cap)` constructions. | no | no |
540540
| [`enforce-repeated-arg-type-style`](./RULES_DESCRIPTIONS.md#enforce-repeated-arg-type-style) | string (defaults to "any") | Enforces consistent style for repeated argument and/or return value types. | no | no |
541541
| [`max-control-nesting`](./RULES_DESCRIPTIONS.md#max-control-nesting) | int (defaults to 5) | Sets restriction for maximum nesting of control structures. | no | no |
542-
| [`comments-density`](./RULES_DESCRIPTIONS.md#comments-density) | int (defaults to 0) | Enforces a minumum comment / code relation | no | no |
542+
| [`comments-density`](./RULES_DESCRIPTIONS.md#comments-density) | int (defaults to 0) | Enforces a minimum comment / code relation | no | no |
543543

544544

545545
## Configurable rules
@@ -555,7 +555,7 @@ This rule accepts two slices of strings, an allowlist and a blocklist of initial
555555
arguments = [["ID"], ["VM"]]
556556
```
557557

558-
This way, revive will not warn for identifier called `customId` but will warn that `customVm` should be called `customVM`.
558+
This way, revive will not warn for an identifier called `customId` but will warn that `customVm` should be called `customVM`.
559559

560560
## Available Formatters
561561

@@ -577,7 +577,7 @@ The default formatter produces the same output as `golint`.
577577

578578
### Plain
579579

580-
The plain formatter produces the same output as the default formatter and appends URL to the rule description.
580+
The plain formatter produces the same output as the default formatter and appends the URL to the rule description.
581581

582582
![Plain formatter](/assets/formatter-plain.png)
583583

@@ -616,7 +616,7 @@ The `Arguments` type is an alias of the type `[]interface{}`. The arguments of t
616616

617617
#### Example
618618

619-
Let's suppose we have developed a rule called `BanStructNameRule` which disallow us to name a structure with given identifier. We can set the banned identifier by using the TOML configuration file:
619+
Let's suppose we have developed a rule called `BanStructNameRule` which disallow us to name a structure with a given identifier. We can set the banned identifier by using the TOML configuration file:
620620

621621
```toml
622622
[rule.ban-struct-name]
@@ -625,16 +625,16 @@ Let's suppose we have developed a rule called `BanStructNameRule` which disallow
625625

626626
With the snippet above we:
627627

628-
- Enable the rule with name `ban-struct-name`. The `Name()` method of our rule should return a string which matches `ban-struct-name`.
628+
- Enable the rule with the name `ban-struct-name`. The `Name()` method of our rule should return a string that matches `ban-struct-name`.
629629
- Configure the rule with the argument `Foo`. The list of arguments will be passed to `Apply(*File, Arguments)` together with the target file we're linting currently.
630630

631631
A sample rule implementation can be found [here](/rule/argument-limit.go).
632632

633633
#### Using `revive` as a library
634634
If a rule is specific to your use case
635-
(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.
635+
(i.e. it is not a good candidate to be added to `revive`'s rule set) you can add it to your linter using `revive` as a linting engine.
636636

637-
The following code shows how to use `revive` in your own application.
637+
The following code shows how to use `revive` in your application.
638638
In the example only one rule is added (`myRule`), of course, you can add as many as you need to.
639639
Your rules can be configured programmatically or with the standard `revive` configuration file.
640640
The full rule set of `revive` is also actionable by your application.
@@ -661,7 +661,7 @@ func (f myRule) Name() string {
661661
func (f myRule) Apply(*lint.File, lint.Arguments) []lint.Failure { ... }
662662
```
663663

664-
You can still go further and use `revive` without its cli, as part of your library, or your own cli:
664+
You can still go further and use `revive` without its CLI, as part of your library, or your CLI:
665665

666666
```go
667667
package mylib
@@ -728,7 +728,7 @@ For a sample formatter, take a look at [this file](/formatter/json.go).
728728

729729
## Speed Comparison
730730

731-
Compared to `golint`, `revive` performs better because it lints the files for each individual rule into a separate goroutine. Here's a basic performance benchmark on MacBook Pro Early 2013 run on kubernetes:
731+
Compared to `golint`, `revive` performs better because it lints the files for each individual rule into a separate goroutine. Here's a basic performance benchmark on MacBook Pro Early 2013 run on Kubernetes:
732732

733733
### golint
734734

@@ -751,7 +751,7 @@ user 0m40.721s
751751
sys 0m3.262s
752752
```
753753

754-
Keep in mind that if you use rules which require type checking, the performance may drop to 2x faster than `golint`:
754+
Keep in mind that if you use rules that require type checking, the performance may drop to 2x faster than `golint`:
755755

756756
```shell
757757
# type checking enabled
@@ -762,7 +762,7 @@ user 2m6.708s
762762
sys 0m17.192s
763763
```
764764

765-
Currently, type checking is enabled by default. If you want to run the linter without type checking, remove all typed rules from the configuration file.
765+
Currently, type-checking is enabled by default. If you want to run the linter without type-checking, remove all typed rules from the configuration file.
766766

767767
## Overriding colorization detection
768768

rule/comments-density.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111

1212
// CommentsDensityRule lints given else constructs.
1313
type CommentsDensityRule struct {
14-
minumumCommentsDensity int64
14+
minimumCommentsDensity int64
1515
configured bool
1616
sync.Mutex
1717
}
@@ -29,12 +29,12 @@ func (r *CommentsDensityRule) configure(arguments lint.Arguments) {
2929
r.configured = true
3030

3131
if len(arguments) < 1 {
32-
r.minumumCommentsDensity = defaultMinimumCommentsPercentage
32+
r.minimumCommentsDensity = defaultMinimumCommentsPercentage
3333
return
3434
}
3535

3636
var ok bool
37-
r.minumumCommentsDensity, ok = arguments[0].(int64)
37+
r.minimumCommentsDensity, ok = arguments[0].(int64)
3838
if !ok {
3939
panic(fmt.Sprintf("invalid argument for %q rule: argument should be an int, got %T", r.Name(), arguments[0]))
4040
}
@@ -48,12 +48,12 @@ func (r *CommentsDensityRule) Apply(file *lint.File, arguments lint.Arguments) [
4848
statementsCount := countStatements(file.AST)
4949
density := (float32(commentsLines) / float32(statementsCount+commentsLines)) * 100
5050

51-
if density < float32(r.minumumCommentsDensity) {
51+
if density < float32(r.minimumCommentsDensity) {
5252
return []lint.Failure{
5353
{
5454
Node: file.AST,
5555
Confidence: 1,
56-
Failure: fmt.Sprintf("the file has a comment density of %2.f%% (%d comment lines for %d code lines) but expected a minimum of %d%%", density, commentsLines, statementsCount, r.minumumCommentsDensity),
56+
Failure: fmt.Sprintf("the file has a comment density of %2.f%% (%d comment lines for %d code lines) but expected a minimum of %d%%", density, commentsLines, statementsCount, r.minimumCommentsDensity),
5757
},
5858
}
5959
}

0 commit comments

Comments
 (0)