Identypo는 식별자 (함수, 기능 호출, 변수, 상수, 유형 선언, 패키지, 레이블)에서 오타를 찾는 GO 정적 분석 도구입니다. Camelcased 기능, 변수 등을 포함하여 Client9의 잘못된 패키지 위에 구축되었습니다.
go get -u github.com/alexkohler/identypo/cmd/identypo
misspell 원시 텍스트와 주석으로 작동합니다. identypo AST 식별자 (예 : 변수 이름, 함수 이름 등)에서 작동합니다. 또한, identypo 정확한 철자 여부를 분석하기 전에 필요한 경우 각 Camelcased Identifier (MyIdentifierName이 '내 식별자 이름'으로 바뀝니다)를 분할합니다. Hood에서 identypo 는 Misspell의 맞춤법 검사 엔진을 사용하여 주어진 단어의 철자가 정확하지 않은지 여부를 결정합니다.
다른 GO 정적 분석 도구 (예 : Golint, Go Vet)와 마찬가지로 Identypo는 가져 오기 경로에서 명명 된 하나 이상의 파일 이름, 디렉토리 또는 패키지로 호출 할 수 있습니다. Identypo는 또한 ... 와일드 카드를 지원합니다. 기본적으로 모든 식별자 (함수, 기능 호출, 변수, 상수, 유형 선언, 패키지, 레이블)에서 오타를 검색합니다.
identypo [flags] files/directories/packages
-i="nto,creater" 수정을 중지하기 위해). 이것은 Misspell 패키지와의 직접적인 패스입니다.참고 : 기본적으로 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 도구를 살펴보십시오!