Skip to content

Commit d8a49d2

Browse files
authored
feat(fixer_v2): Enhance Ellipsis Metavariable (#132)
# Description - eliipsis metavar handler - update golangci linter config files
1 parent 35576c6 commit d8a49d2

File tree

7 files changed

+607
-121
lines changed

7 files changed

+607
-121
lines changed

.github/golangci.yml

-3
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
11
run:
22
concurrency: 8
33
timeout: 10m
4-
issue-exit-code: 1
54
tests: true
6-
skip-dirs-use-default: true
75
modules-download-mode: readonly
86
allow-parallel-runners: false
97
go: ""
108

119
output:
12-
uniq-by-line: false
1310
path-prefix: ""
1411
sort-results: true
1512

.golangci.yml

+312-9
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,313 @@
1-
linters-settings:
2-
typecheck:
3-
# Keep the linter enabled (since it can't be disabled), but exclude all its messages
4-
disable: false
1+
linters:
2+
# Disable all linters.
3+
# Default: false
4+
disable-all: true
5+
# Enable specific linter
6+
# https://golangci-lint.run/usage/linters/#enabled-by-default
7+
enable:
8+
- asasalint
9+
- asciicheck
10+
- bidichk
11+
- bodyclose
12+
- canonicalheader
13+
- containedctx
14+
- contextcheck
15+
- copyloopvar
16+
- cyclop
17+
- decorder
18+
- depguard
19+
- dogsled
20+
- dupl
21+
- dupword
22+
- durationcheck
23+
- err113
24+
- errcheck
25+
- errchkjson
26+
- errname
27+
- errorlint
28+
- execinquery
29+
- exhaustive
30+
- exhaustruct
31+
- exportloopref
32+
- exptostd
33+
- fatcontext
34+
- forbidigo
35+
- forcetypeassert
36+
- funlen
37+
- gci
38+
- ginkgolinter
39+
- gocheckcompilerdirectives
40+
- gochecknoglobals
41+
- gochecknoinits
42+
- gochecksumtype
43+
- gocognit
44+
- goconst
45+
- gocritic
46+
- gocyclo
47+
- godot
48+
- godox
49+
- gofmt
50+
- gofumpt
51+
- goheader
52+
- goimports
53+
- gomoddirectives
54+
- gomodguard
55+
- goprintffuncname
56+
- gosec
57+
- gosimple
58+
- gosmopolitan
59+
- govet
60+
- grouper
61+
- iface
62+
- importas
63+
- inamedparam
64+
- ineffassign
65+
- interfacebloat
66+
- intrange
67+
- ireturn
68+
- lll
69+
- loggercheck
70+
- maintidx
71+
- makezero
72+
- mirror
73+
- misspell
74+
- mnd
75+
- musttag
76+
- nakedret
77+
- nestif
78+
- nilerr
79+
- nilnesserr
80+
- nilnil
81+
- nlreturn
82+
- noctx
83+
- nolintlint
84+
- nonamedreturns
85+
- nosprintfhostport
86+
- paralleltest
87+
- perfsprint
88+
- prealloc
89+
- predeclared
90+
- promlinter
91+
- protogetter
92+
- reassign
93+
- recvcheck
94+
- revive
95+
- rowserrcheck
96+
- sloglint
97+
- spancheck
98+
- sqlclosecheck
99+
- staticcheck
100+
- stylecheck
101+
- tagalign
102+
- tagliatelle
103+
- tenv
104+
- testableexamples
105+
- testifylint
106+
- testpackage
107+
- thelper
108+
- tparallel
109+
- unconvert
110+
- unparam
111+
- unused
112+
- usestdlibvars
113+
- usetesting
114+
- varnamelen
115+
- wastedassign
116+
- whitespace
117+
- wrapcheck
118+
- wsl
119+
- zerologlint
120+
# Enable all available linters.
121+
# Default: false
122+
enable-all: true
123+
# Disable specific linter
124+
# https://golangci-lint.run/usage/linters/#disabled-by-default
125+
disable:
126+
- asasalint
127+
- asciicheck
128+
- bidichk
129+
- bodyclose
130+
- canonicalheader
131+
- containedctx
132+
- contextcheck
133+
- copyloopvar
134+
- cyclop
135+
- decorder
136+
- depguard
137+
- dogsled
138+
- dupl
139+
- dupword
140+
- durationcheck
141+
- err113
142+
- errcheck
143+
- errchkjson
144+
- errname
145+
- errorlint
146+
- execinquery
147+
- exhaustive
148+
- exhaustruct
149+
- exportloopref
150+
- exptostd
151+
- fatcontext
152+
- forbidigo
153+
- forcetypeassert
154+
- funlen
155+
- gci
156+
- ginkgolinter
157+
- gocheckcompilerdirectives
158+
- gochecknoglobals
159+
- gochecknoinits
160+
- gochecksumtype
161+
- gocognit
162+
- goconst
163+
- gocritic
164+
- gocyclo
165+
- godot
166+
- godox
167+
- gofmt
168+
- gofumpt
169+
- goheader
170+
- goimports
171+
- gomoddirectives
172+
- gomodguard
173+
- goprintffuncname
174+
- gosec
175+
- gosimple
176+
- gosmopolitan
177+
- govet
178+
- grouper
179+
- iface
180+
- importas
181+
- inamedparam
182+
- ineffassign
183+
- interfacebloat
184+
- intrange
185+
- ireturn
186+
- lll
187+
- loggercheck
188+
- maintidx
189+
- makezero
190+
- mirror
191+
- misspell
192+
- mnd
193+
- musttag
194+
- nakedret
195+
- nestif
196+
- nilerr
197+
- nilnesserr
198+
- nilnil
199+
- nlreturn
200+
- noctx
201+
- nolintlint
202+
- nonamedreturns
203+
- nosprintfhostport
204+
- paralleltest
205+
- perfsprint
206+
- prealloc
207+
- predeclared
208+
- promlinter
209+
- protogetter
210+
- reassign
211+
- recvcheck
212+
- revive
213+
- rowserrcheck
214+
- sloglint
215+
- spancheck
216+
- sqlclosecheck
217+
- staticcheck
218+
- stylecheck
219+
- tagalign
220+
- tagliatelle
221+
- tenv
222+
- testableexamples
223+
- testifylint
224+
- testpackage
225+
- thelper
226+
- tparallel
227+
- unconvert
228+
- unparam
229+
- unused
230+
- usestdlibvars
231+
- usetesting
232+
- varnamelen
233+
- wastedassign
234+
- whitespace
235+
- wrapcheck
236+
- wsl
237+
- zerologlint
238+
- deadcode # Deprecated
239+
- exhaustivestruct # Deprecated
240+
- golint # Deprecated
241+
- ifshort # Deprecated
242+
- interfacer # Deprecated
243+
- maligned # Deprecated
244+
- gomnd # Deprecated
245+
- nosnakecase # Deprecated
246+
- scopelint # Deprecated
247+
- structcheck # Deprecated
248+
- varcheck # Deprecated
249+
# Enable presets.
250+
# https://golangci-lint.run/usage/linters
251+
# Default: []
252+
presets:
253+
- bugs
254+
- comment
255+
- complexity
256+
- error
257+
- format
258+
- import
259+
- metalinter
260+
- module
261+
- performance
262+
- sql
263+
- style
264+
- test
265+
- unused
266+
# Enable only fast linters from enabled linters set (first run won't be fast)
267+
# Default: false
268+
fast: true
5269

6-
exclude-rules:
7-
- linters:
8-
- typecheck
9-
- gosimple
10-
text: '.*'
270+
# Options for analysis running.
271+
run:
272+
# Timeout for analysis, e.g. 30s, 5m.
273+
# If the value is lower or equal to 0, the timeout is disabled.
274+
# Default: 1m
275+
timeout: 5m
276+
# Exit code when at least one issue was found.
277+
# Default: 1
278+
issues-exit-code: 2
279+
# Include test files or not.
280+
# Default: true
281+
tests: false
282+
# List of build tags, all linters use it.
283+
# Default: []
284+
build-tags:
285+
- mytag
286+
# If set, we pass it to "go list -mod={option}". From "go help modules":
287+
# If invoked with -mod=readonly, the go command is disallowed from the implicit
288+
# automatic updating of go.mod described above. Instead, it fails when any changes
289+
# to go.mod are needed. This setting is most useful to check that go.mod does
290+
# not need updates, such as in a continuous integration and testing system.
291+
# If invoked with -mod=vendor, the go command assumes that the vendor
292+
# directory holds the correct copies of dependencies and ignores
293+
# the dependency descriptions in go.mod.
294+
#
295+
# Allowed values: readonly|vendor|mod
296+
# Default: ""
297+
modules-download-mode: readonly
298+
# Allow multiple parallel golangci-lint instances running.
299+
# If false, golangci-lint acquires file lock on start.
300+
# Default: false
301+
allow-parallel-runners: true
302+
# Allow multiple golangci-lint instances running, but serialize them around a lock.
303+
# If false, golangci-lint exits with an error if it fails to acquire file lock on start.
304+
# Default: false
305+
allow-serial-runners: true
306+
# Define the Go version limit.
307+
# Mainly related to generics support since go1.18.
308+
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.17
309+
# go: '1.19'
310+
# Number of operating system threads (`GOMAXPROCS`) that can execute golangci-lint simultaneously.
311+
# If it is explicitly set to 0 (i.e. not the default) then golangci-lint will automatically set the value to match Linux container CPU quota.
312+
# Default: the number of logical CPUs in the machine
313+
concurrency: 4

fixer_v2/lexer.go

+8-3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package fixerv2
22

33
import (
44
"fmt"
5+
"unicode"
56
)
67

78
type TokenType int
@@ -169,14 +170,18 @@ func Lex(input string) ([]Token, error) {
169170
return tokens, nil
170171
}
171172

173+
func isDigit(c byte) bool {
174+
return unicode.IsDigit(rune(c))
175+
}
176+
172177
func isIdentifierStart(c byte) bool {
173-
return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c == '_'
178+
return unicode.IsLetter(rune(c)) || c == '_' // Use unicode.IsLetter for better i18n support
174179
}
175180

176181
func isIdentifierChar(c byte) bool {
177-
return isIdentifierStart(c) || (c >= '0' && c <= '9')
182+
return isIdentifierStart(c) || isDigit(c)
178183
}
179184

180185
func isWhitespace(c byte) bool {
181-
return c == ' ' || c == '\t' || c == '\n' || c == '\r'
186+
return unicode.IsSpace(rune(c))
182187
}

0 commit comments

Comments
 (0)