Identypo es una herramienta de análisis estático para encontrar errores tipográficos en identificadores (funciones, llamadas de funciones, variables, constantes, declaraciones de tipo, paquetes, etiquetas), incluidas funciones con camello, variables, etc., se basa en el paquete de fusiones de Client9.
go get -u github.com/alexkohler/identypo/cmd/identypo
misspell opera en texto y comentarios en bruto. identypo opera en identificadores AST (es decir, nombres de variables, nombres de funciones, etc.). Además, identypo divide cada identificador con camello si es necesario (myidentifiername se convierte en 'mi nombre de identificador') antes de analizar si se escribe o no correctamente. Debajo del capó, identypo está utilizando el motor de comprobación de hechizos de Meldspell para determinar si no se escribe correctamente una palabra determinada.
Similar a otras herramientas de análisis estáticas de GO (como Golint, GO VET), Identypo se puede invocar con uno o más nombres de archivo, directorios o paquetes nombrados por su ruta de importación. Identypo también es compatible con el ... comodín. Por defecto, buscará errores tipográficos en cada identificador (funciones, llamadas de función, variables, constantes, declaraciones de tipo, paquetes, etiquetas).
identypo [flags] files/directories/packages
-i="nto,creater" ). Este es un paso directo al paquete Melpell.Nota: Por defecto, Identypo verificará los errores tipográficos en cada identificador (funciones, llamadas de función, variables, constantes, declaraciones de tipo, paquetes, etiquetas). En este caso, no se especifica ningún indicador. Debido a la falta de frecuencia, actualmente no hay banderas para encontrar solo declaraciones de tipo, paquetes o etiquetas.
Algunos ejemplos de la biblioteca estándar GO (utilizando la bandera -i para suprimir algunos no visitas):
$ 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
}Algunos ejemplos seleccionados de 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 ,
}Abra un problema y/o un PR para cualquier característica/error.
Si has disfrutado de Identypo, ¡eche un vistazo a mis otras herramientas estáticas de Anaylsis!