Identypoは、識別子(関数、関数呼び出し、変数、定数、タイプ宣言、パッケージ、ラベル)のタイプミスを見つけるためのGO静的分析ツールです。
go get -u github.com/alexkohler/identypo/cmd/identypo
misspell 、生のテキストとコメントで動作します。 identypo 、AST識別子(つまり、変数名、関数名など)で動作します。さらに、 identypo 、必要に応じて各ラクダケース識別子を分割します(myIdentifiernameは「私の識別子名」に変わります)。ボンネットの下で、 identypoはMisspellのSpellChckingエンジンを使用して、特定の単語が正しく綴られていないかどうかを判断しています。
他のGO静的分析ツール(Golint、Go Vetなど)と同様に、IdentyPoは、1つ以上のファイル名、ディレクトリ、またはその輸入パスで名前が付けられたパッケージで呼び出すことができます。 IdentyPoは...ワイルドカードもサポートしています。デフォルトでは、すべての識別子(関数、関数呼び出し、変数、定数、タイプ宣言、パッケージ、ラベル)でタイプミスを検索します。
identypo [flags] files/directories/packages
-i="nto,creater" )。これは、Misspellパッケージへの直接パススルーです。注:デフォルトでは、IdentyPoはすべての識別子(関数、関数呼び出し、変数、定数、タイプ宣言、パッケージ、ラベル)のタイプミスをチェックします。この場合、フラグは指定されていません。頻度が不足しているため、現在、タイプの宣言、パッケージ、またはラベルのみを見つけるフラグはありません。
GO Standard Libraryのいくつかの例( -iフラグを使用して、いくつかの問題を抑制します):
$ 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
}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 ,
}機能/バグについては、問題やPRを開いてください。
IdentyPoを楽しんでいる場合は、他の静的Anaylsisツールをご覧ください!