All Projects → alexkohler → identypo

alexkohler / identypo

Licence: MIT license
identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels).

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to identypo

Dg
[LLVM Static Slicer] Various program analyses, construction of dependence graphs and program slicing of LLVM bitcode.
Stars: ✭ 242 (+830.77%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
lints
Lint all your JavaScript, CSS, HTML, Markdown and Dockerfiles with a single command
Stars: ✭ 14 (-46.15%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Sonar Dotnet
Code analyzer for C# and VB.NET projects https://redirect.sonarsource.com/plugins/vbnet.html
Stars: ✭ 466 (+1692.31%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
eba
EBA is a static bug finder for C.
Stars: ✭ 14 (-46.15%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
phpstan-nette
Nette Framework class reflection extension for PHPStan & framework-specific rules
Stars: ✭ 87 (+234.62%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Prealloc
prealloc is a Go static analysis tool to find slice declarations that could potentially be preallocated.
Stars: ✭ 419 (+1511.54%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Sonarjs
SonarSource Static Analyzer for JavaScript and TypeScript
Stars: ✭ 696 (+2576.92%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Phpstan Doctrine
Doctrine extensions for PHPStan
Stars: ✭ 338 (+1200%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Phpinspectionsea
A Static Code Analyzer for PHP (a PhpStorm/Idea Plugin)
Stars: ✭ 1,211 (+4557.69%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Cfmt
cfmt is a tool to wrap Go comments over a certain length to a new line.
Stars: ✭ 28 (+7.69%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
nakedret
nakedret is a Go static analysis tool to find naked returns in functions greater than a specified function length.
Stars: ✭ 82 (+215.38%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
sonarlint4netbeans
SonarLint integration for Apache Netbeans
Stars: ✭ 23 (-11.54%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Phpdoc Parser
Next-gen phpDoc parser with support for intersection types and generics
Stars: ✭ 569 (+2088.46%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Sonar Java
☕️ SonarSource Static Analyzer for Java Code Quality and Security
Stars: ✭ 745 (+2765.38%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Phpstan
PHP Static Analysis Tool - discover bugs in your code without running it!
Stars: ✭ 10,534 (+40415.38%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
unimport
unimport is a Go static analysis tool to find unnecessary import aliases.
Stars: ✭ 64 (+146.15%)
Mutual labels:  static-code-analysis, static-analysis, static-analyzer
Forbidden Apis
Policeman's Forbidden API Checker
Stars: ✭ 216 (+730.77%)
Mutual labels:  static-code-analysis, static-analysis
Spotbugs
SpotBugs is FindBugs' successor. A tool for static analysis to look for bugs in Java code.
Stars: ✭ 2,569 (+9780.77%)
Mutual labels:  static-code-analysis, static-analysis
Revive
🔥 ~6x faster, stricter, configurable, extensible, and beautiful drop-in replacement for golint
Stars: ✭ 3,139 (+11973.08%)
Mutual labels:  static-code-analysis, static-analysis
Codeclimate
Code Climate CLI
Stars: ✭ 2,273 (+8642.31%)
Mutual labels:  static-code-analysis, static-analysis

identypo Build Status

identypo is a Go static analysis tool to find typos in identifiers (functions, function calls, variables, constants, type declarations, packages, labels) including CamelCased functions, variables, etc. It is built on top of client9's misspell package.

Installation

go get -u github.com/alexkohler/identypo/cmd/identypo

How is this different from https://github.com/client9/misspell?

misspell operates on raw text and comments. identypo operates on AST identifiers (i.e. variable names, function names, etc.). Moreover, identypo splits each camelcased identifier if necessary (MyIdentifierName turns into 'My Identifier Name') prior to analyzing whether or not it is spelled correctly. Under the hood, identypo is using misspell's spellchecking engine to determine whether not a given word is spelled correctly.

Usage

Similar to other Go static analysis tools (such as golint, go vet), identypo can be invoked with one or more filenames, directories, or packages named by its import path. Identypo also supports the ... wildcard. By default, it will search for typos in every identifier (functions, function calls, variables, constants, type declarations, packages, labels).

identypo [flags] files/directories/packages

Flags

  • -tests (default true) - Include test files in analysis
  • -i - Comma separated list of corrections to be ignored (for example, to stop corrections on "nto" and "creater", pass -i="nto,creater"). This is a direct passthrough to the misspell package.
  • -functions - Find typos in function declarations only.
  • -constants - Find typos in constants only.
  • -variables - Find typos in variables only.
  • -set_exit_status (default false) - Set exit status to 1 if any issues are found.

NOTE: by default, identypo will check for typos in every identifier (functions, function calls, variables, constants, type declarations, packages, labels). In this case, no flag needs specified. Due to a lack of frequency, there are currently no flags to find only type declarations, packages, or labels.

Example uses in popular Go repos

Some examples from the Go standard library (utilizing the -i flag to suppress some non-isses):

$ identypo -i="rela,nto,onot,alltime" ./...
cmd/trace/goroutines.go:169 "dividened" should be dividend in dividened
cmd/trace/goroutines.go:173 "dividened" should be dividend in dividened
cmd/trace/goroutines.go:175 "dividened" should be dividend in dividened
cmd/trace/goroutines.go:179 "dividened" should be dividend in dividened
cmd/trace/annotations.go:1162 "dividened" should be dividend in dividened
cmd/trace/annotations.go:1166 "dividened" should be dividend in dividened
cmd/trace/annotations.go:1168 "dividened" should be dividend in dividened
cmd/trace/annotations.go:1172 "dividened" should be dividend in dividened
crypto/x509/verify.go:208 "Comparisions" should be Comparisons in MaxConstraintComparisions
crypto/x509/verify.go:585 "Comparisions" should be Comparisons in MaxConstraintComparisions
// cmd/trace/annotations.go:1162 dividened" should be dividend in dividened
"percent": func(dividened, divisor int64) template.HTML {

// crypto/x509/verify.go:208 "Comparisions" should be Comparisons in MaxConstraintComparisions
type VerifyOptions struct {
	...
	MaxConstraintComparisions int
}

Some selected examples from Kubernetes:

$ identypo ./...
cmd/kubeadm/app/util/apiclient/wait.go:51 "inital" should be initial in initalTimeout
pkg/apis/certificates/types.go:125 "Committment" should be Commitment in UsageContentCommittment
test/e2e_node/eviction_test.go:51 "Dissapear" should be Disappear in pressureDissapearTimeout
pkg/scheduler/scheduler_test.go:705 "Satsified" should be Satisfied in FindUnboundSatsified
pkg/kubectl/cmd/scale.go:265 "Psuedo" should be Pseudo in JobPsuedoScaler
// cmd/kubeadm/app/util/apiclient/wait.go:51 "inital" should be initial in initalTimeout
WaitForHealthyKubelet(initalTimeout time.Duration, healthzEndpoint string) error

// pkg/apis/certificates/types.go:125 "Committment" should be Commitment in UsageContentCommittment
UsageContentCommittment KeyUsage = "content commitment"

// test/e2e_node/eviction_test.go:51 "Dissapear" should be Disappear in pressureDissapearTimeout
const (
	...
	pressureDissapearTimeout = 1 * time.Minute
	...
)

// pkg/scheduler/scheduler_test.go:705 "Satsified" should be Satisfied in FindUnboundSatsified
volumeBinderConfig: &persistentvolume.FakeVolumeBinderConfig{
	...
	FindUnboundSatsified: true,
	...
}

// pkg/kubectl/cmd/scale.go:265 "Psuedo" should be Pseudo in JobPsuedoScaler
scaler := scalejob.JobPsuedoScaler{
	JobsClient: jobsClient,
}

Contributing

Please open an issue and/or a PR for any features/bugs.

Other static analysis tools

If you've enjoyed identypo, take a look at my other static anaylsis tools!

  • prealloc - Finds slice declarations that could potentially be preallocated.
  • nakedret - Finds naked returns.
  • unimport - Finds unnecessary import aliases.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].