aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/tetafro/godot/README.md
blob: 902678f54226dd31c8f24de052b6a11747f6cabf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# godot

[![License](http://img.shields.io/badge/license-MIT-green.svg?style=flat)](https://raw.githubusercontent.com/tetafro/godot/master/LICENSE)
[![Github CI](https://img.shields.io/github/workflow/status/tetafro/godot/Test)](https://github.com/tetafro/godot/actions?query=workflow%3ATest)
[![Go Report](https://goreportcard.com/badge/github.com/tetafro/godot)](https://goreportcard.com/report/github.com/tetafro/godot)
[![Codecov](https://codecov.io/gh/tetafro/godot/branch/master/graph/badge.svg)](https://codecov.io/gh/tetafro/godot)

Linter that checks if all top-level comments contain a period at the
end of the last sentence if needed.

[CodeReviewComments](https://github.com/golang/go/wiki/CodeReviewComments#comment-sentences) quote:

> Comments should begin with the name of the thing being described
> and end in a period

## Install

*NOTE: Godot is available as a part of [GolangCI Lint](https://github.com/golangci/golangci-lint)
(disabled by default).*

Build from source

```sh
go get -u github.com/tetafro/godot/cmd/godot
```

or download binary from [releases page](https://github.com/tetafro/godot/releases).

## Config

You can specify options using config file. If no config provided the following
defaults are used:

```yaml
# Which comments to check:
#   declarations - for top level declaration comments (default);
#   toplevel     - for top level comments;
#   all          - for all comments.
scope: toplevel

# List pf regexps for excluding particular comment lines from check.
exclude:

# Check periods at the end of sentences.
period: true

# Check that first letter of each sentence is capital.
capital: false
```

## Run

```sh
godot ./myproject
```

Autofix flags are also available

```sh
godot -f ./myproject # fix issues and print the result
godot -w ./myproject # fix issues and replace the original file
```

See all flags with `godot -h`.

## Example

Code

```go
package math

// Sum sums two integers
func Sum(a, b int) int {
    return a + b // result
}
```

Output

```sh
Comment should end in a period: math/math.go:3:1
```