Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update godot to 1.3.0 #1498

Merged
merged 1 commit into from Nov 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions .golangci.example.yml
Expand Up @@ -155,8 +155,10 @@ linters-settings:
# minimal code complexity to report, 30 by default (but we recommend 10-20)
min-complexity: 10
godot:
# check all top-level comments, not only declarations
check-all: false
# comments to be checked: `declarations`, `toplevel`, or `all`
scope: declarations
# check that each sentence starts with a capital letter
capital: false
godox:
# report any comments starting with keywords, this is useful for TODO or FIXME comments that
# might be left in the code accidentally and should be resolved before merging
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -55,7 +55,7 @@ require (
github.com/ssgreg/nlreturn/v2 v2.1.0
github.com/stretchr/testify v1.6.1
github.com/tdakkota/asciicheck v0.0.0-20200416190851-d7f85be797a2
github.com/tetafro/godot v0.4.9
github.com/tetafro/godot v1.3.0
github.com/timakin/bodyclose v0.0.0-20190930140734-f7f2e9bca95e
github.com/tomarrell/wrapcheck v0.0.0-20200807122107-df9e8bcb914d
github.com/tommy-muehle/go-mnd v1.3.1-0.20200224220436-e6f9a994e8fa
Expand Down
7 changes: 5 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions pkg/config/config.go
Expand Up @@ -334,6 +334,10 @@ type WSLSettings struct {
}

type GodotSettings struct {
Scope string `mapstructure:"scope"`
Capital bool `mapstructure:"capital"`

// Deprecated: use `Scope` instead
CheckAll bool `mapstructure:"check-all"`
}

Expand Down
21 changes: 19 additions & 2 deletions pkg/golinters/godot.go
Expand Up @@ -28,12 +28,29 @@ func NewGodot() *goanalysis.Linter {
nil,
).WithContextSetter(func(lintCtx *linter.Context) {
cfg := lintCtx.Cfg.LintersSettings.Godot
settings := godot.Settings{CheckAll: cfg.CheckAll}
settings := godot.Settings{
Scope: godot.Scope(cfg.Scope),
Period: true,
Capital: cfg.Capital,
}

// Convert deprecated setting
if cfg.CheckAll { // nolint: staticcheck
settings.Scope = godot.TopLevelScope
}

if settings.Scope == "" {
settings.Scope = godot.DeclScope
}

analyzer.Run = func(pass *analysis.Pass) (interface{}, error) {
var issues []godot.Issue
for _, file := range pass.Files {
issues = append(issues, godot.Run(file, pass.Fset, settings)...)
iss, err := godot.Run(file, pass.Fset, settings)
if err != nil {
return nil, err
}
issues = append(issues, iss...)
}

if len(issues) == 0 {
Expand Down
2 changes: 1 addition & 1 deletion test/testdata/godot.go
@@ -1,7 +1,7 @@
//args: -Egodot
package testdata

// Godot checks top-level comments // ERROR "Top level comment should end in a period"
// Godot checks top-level comments // ERROR "Comment should end in a period"
func Godot() {
// nothing to do here
}