gostutter

module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 15, 2021 License: MIT

README

gostutter

Simple linter for golang for stuttering detection (repeating of names) in code.

Package name Code Relaxed mode Strict mode
foo func NewFoo() *Foo Allowed Forbidden
foo func HandleFoo() Allowed Forbidden
foo type ConfigFoo struct Allowed Forbidden
foo func fooHandle() Forbidden Forbidden
foo type FooConfig struct Forbidden Forbidden
- type Config struct { config int } Forbidden Forbidden
How to install
go install github.com/MartinKuzma/gostutter@latest

How to run:

gostutter ./...

Output:

pkg/stutter/analyzer.go:54:6: function name "runStutterCheck"  contains name of package "stutter"
pkg/stutter/analyzer.go:78:19: function name "checkStutter"  contains name of package "stutter"
pkg/stutter/analyzer.go:172:6: function name "stutteringDemo"  contains name of package "stutter"
pkg/stutter/analyzer.go:176:6: type name "Stutter" contains name of package "stutter"
pkg/stutter/analyzer.go:177:2: field name "stutter" contains name of structure "Stutter"
Strict mode

GoStutter has strict feature that checks for any substring in functions, struct fields or global variable names. To start with strict mode, just add strict parameter:

go run ./cmd/lint/main.go --strict=true  --  ./...

Directories

Path Synopsis
cmd
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL