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工具!