aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/tdakkota
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2020-07-04 11:12:55 +0200
committerDmitry Vyukov <dvyukov@google.com>2020-07-04 15:05:30 +0200
commitc7d7f10bdff703e4a3c0414e8a33d4e45c91eb35 (patch)
tree0dff0ee1f98dbfa3ad8776112053a450d176592b /vendor/github.com/tdakkota
parent9573094ce235bd9afe88f5da27a47dd6bcc1e13b (diff)
go.mod: vendor golangci-lint
Diffstat (limited to 'vendor/github.com/tdakkota')
-rw-r--r--vendor/github.com/tdakkota/asciicheck/.gitignore33
-rw-r--r--vendor/github.com/tdakkota/asciicheck/LICENSE21
-rw-r--r--vendor/github.com/tdakkota/asciicheck/README.md44
-rw-r--r--vendor/github.com/tdakkota/asciicheck/ascii.go18
-rw-r--r--vendor/github.com/tdakkota/asciicheck/asciicheck.go49
-rw-r--r--vendor/github.com/tdakkota/asciicheck/go.mod5
6 files changed, 170 insertions, 0 deletions
diff --git a/vendor/github.com/tdakkota/asciicheck/.gitignore b/vendor/github.com/tdakkota/asciicheck/.gitignore
new file mode 100644
index 000000000..cf875a711
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/.gitignore
@@ -0,0 +1,33 @@
+# IntelliJ project files
+.idea
+*.iml
+out
+gen
+
+# Go template
+# Binaries for programs and plugins
+*.exe
+*.exe~
+*.dll
+*.so
+*.dylib
+
+# Test binary, built with `go test -c`
+*.test
+
+# Output of the go coverage tool, specifically when used with LiteIDE
+*.out
+
+# Dependency directories (remove the comment below to include it)
+# vendor/
+.idea/$CACHE_FILE$
+.idea/$PRODUCT_WORKSPACE_FILE$
+.idea/.gitignore
+.idea/codeStyles
+.idea/deployment.xml
+.idea/inspectionProfiles/
+.idea/kotlinc.xml
+.idea/misc.xml
+.idea/modules.xml
+asciicheck.iml
+go.sum
diff --git a/vendor/github.com/tdakkota/asciicheck/LICENSE b/vendor/github.com/tdakkota/asciicheck/LICENSE
new file mode 100644
index 000000000..48a60cf1c
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2020 tdakkota
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/github.com/tdakkota/asciicheck/README.md b/vendor/github.com/tdakkota/asciicheck/README.md
new file mode 100644
index 000000000..fc62811be
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/README.md
@@ -0,0 +1,44 @@
+# asciicheck [![Go Report Card](https://goreportcard.com/badge/github.com/tdakkota/asciicheck)](https://goreportcard.com/report/github.com/tdakkota/asciicheck) [![codecov](https://codecov.io/gh/tdakkota/asciicheck/branch/master/graph/badge.svg)](https://codecov.io/gh/tdakkota/asciicheck) ![Go](https://github.com/tdakkota/asciicheck/workflows/Go/badge.svg)
+Simple linter to check that your code does not contain non-ASCII identifiers
+
+# Install
+
+```
+go get -u github.com/tdakkota/asciicheck/cmd/asciicheck
+```
+
+# Usage
+asciicheck uses [`singlechecker`](https://pkg.go.dev/golang.org/x/tools/go/analysis/singlechecker) package to run:
+
+```
+asciicheck: checks that all code identifiers does not have non-ASCII symbols in the name
+
+Usage: asciicheck [-flag] [package]
+
+
+Flags:
+ -V print version and exit
+ -all
+ no effect (deprecated)
+ -c int
+ display offending line with this many lines of context (default -1)
+ -cpuprofile string
+ write CPU profile to this file
+ -debug string
+ debug flags, any subset of "fpstv"
+ -fix
+ apply all suggested fixes
+ -flags
+ print analyzer flags in JSON
+ -json
+ emit JSON output
+ -memprofile string
+ write memory profile to this file
+ -source
+ no effect (deprecated)
+ -tags string
+ no effect (deprecated)
+ -trace string
+ write trace log to this file
+ -v no effect (deprecated)
+```
diff --git a/vendor/github.com/tdakkota/asciicheck/ascii.go b/vendor/github.com/tdakkota/asciicheck/ascii.go
new file mode 100644
index 000000000..9e70c391d
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/ascii.go
@@ -0,0 +1,18 @@
+package asciicheck
+
+import "unicode"
+
+func isASCII(s string) (rune, bool) {
+ if len(s) == 1 {
+ return []rune(s)[0], s[0] <= unicode.MaxASCII
+ }
+
+ r := []rune(s)
+ for i := 0; i < len(s); i++ {
+ if r[i] > unicode.MaxASCII {
+ return r[i], false
+ }
+ }
+
+ return 0, true
+}
diff --git a/vendor/github.com/tdakkota/asciicheck/asciicheck.go b/vendor/github.com/tdakkota/asciicheck/asciicheck.go
new file mode 100644
index 000000000..690728022
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/asciicheck.go
@@ -0,0 +1,49 @@
+package asciicheck
+
+import (
+ "fmt"
+ "go/ast"
+ "golang.org/x/tools/go/analysis"
+)
+
+func NewAnalyzer() *analysis.Analyzer {
+ return &analysis.Analyzer{
+ Name: "asciicheck",
+ Doc: "checks that all code identifiers does not have non-ASCII symbols in the name",
+ Run: run,
+ }
+}
+
+func run(pass *analysis.Pass) (interface{}, error) {
+ for _, file := range pass.Files {
+ alreadyViewed := map[*ast.Object]struct{}{}
+ ast.Inspect(
+ file, func(node ast.Node) bool {
+ cb(pass, node, alreadyViewed)
+ return true
+ },
+ )
+ }
+
+ return nil, nil
+}
+
+func cb(pass *analysis.Pass, n ast.Node, m map[*ast.Object]struct{}) {
+ if v, ok := n.(*ast.Ident); ok {
+ if _, ok := m[v.Obj]; ok {
+ return
+ } else {
+ m[v.Obj] = struct{}{}
+ }
+
+ ch, ascii := isASCII(v.Name)
+ if !ascii {
+ pass.Report(
+ analysis.Diagnostic{
+ Pos: v.Pos(),
+ Message: fmt.Sprintf("identifier \"%s\" contain non-ASCII character: %#U", v.Name, ch),
+ },
+ )
+ }
+ }
+}
diff --git a/vendor/github.com/tdakkota/asciicheck/go.mod b/vendor/github.com/tdakkota/asciicheck/go.mod
new file mode 100644
index 000000000..43aa5d806
--- /dev/null
+++ b/vendor/github.com/tdakkota/asciicheck/go.mod
@@ -0,0 +1,5 @@
+module github.com/tdakkota/asciicheck
+
+go 1.13
+
+require golang.org/x/tools v0.0.0-20200414032229-332987a829c3