Skip to content

eugercek/noyoda

Repository files navigation

noyoda is a Go linter, which reports yoda style conditionals.

Flags

Flag Description Default
-fix Auto fix yoda conditions no
-include-const Treat const as literal (const x = 10; if x == a) no
-skip-range Skip number range checks (10 > a && a > 5) yes

Installation and Usage

go install github.com/eugercek/noyoda/cmd/noyoda
cd mycode # go to your code's main package
noyoda ./...

Roadmap

  • if check
  • switch check
  • const check
  • Flag for const
  • Recursive check
  • Auto fix
  • Skip number range checks (10 > a && a > 10...)
  • Run tests for comprehensive set of popular go codebases, if there are many maybe Open a PR to golangci-lint

Useful Resources