identypo
1.0.0
Identypo是一個GO靜態分析工具,可在標識符(功能,函數呼叫,變量,常數,類型聲明,軟件包,標籤)中找到錯別字,包括基於駱駝的功能,變量等。
go get -u github.com/alexkohler/identypo/cmd/identypo
misspell在原始文本和評論上運行。 identypo在AST標識符(即變量名稱,函數名稱等)上運行。此外,在必要時, identypo將每個基於駱駝的標識符(myIdentifierName變成我的標識符名稱')在分析是否正確拼寫之前。在引擎蓋下, identypo使用Misserpell的拼寫檢查引擎來確定是否正確拼寫了給定單詞。
與其他GO靜態分析工具(例如Golint,Go Vet)類似,可以使用一個或多個以其導入路徑命名的文件名,目錄或軟件包來調用Identypo。 Identypo還支持...通配符。默認情況下,它將在每個標識符(功能,函數呼叫,變量,常數,類型聲明,軟件包,標籤)中搜索錯別字。
identypo [flags] files/directories/packages
-i="nto,creater" )。這是通往拼寫軟件包的直接通行證。注意:默認情況下,Identypo將在每個標識符(功能,函數呼叫,變量,常數,類型聲明,軟件包,標籤)中檢查錯別字。在這種情況下,無需指定標誌。由於缺乏頻率,目前尚無標誌可以找到類型的聲明,軟件包或標籤。
GO標準庫中的一些示例(利用-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工具!