"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/tools/vendor/github.com/mgechev/revive/rule/add-constant.go" between
buildah-1.26.4.tar.gz and buildah-1.27.0.tar.gz

About: Buildah is a tool that facilitates building Open Container Initiative (OCI) container images.

add-constant.go  (buildah-1.26.4):add-constant.go  (buildah-1.27.0)
skipping to change at line 25 skipping to change at line 25
kindINT = "INT" kindINT = "INT"
kindSTRING = "STRING" kindSTRING = "STRING"
) )
type whiteList map[string]map[string]bool type whiteList map[string]map[string]bool
func newWhiteList() whiteList { func newWhiteList() whiteList {
return map[string]map[string]bool{kindINT: {}, kindFLOAT: {}, kindSTRING: {}} return map[string]map[string]bool{kindINT: {}, kindFLOAT: {}, kindSTRING: {}}
} }
func (wl whiteList) add(kind string, list string) { func (wl whiteList) add(kind, list string) {
elems := strings.Split(list, ",") elems := strings.Split(list, ",")
for _, e := range elems { for _, e := range elems {
wl[kind][e] = true wl[kind][e] = true
} }
} }
// AddConstantRule lints unused params in functions. // AddConstantRule lints unused params in functions.
type AddConstantRule struct { type AddConstantRule struct {
whiteList whiteList whiteList whiteList
strLitLimit int strLitLimit int
skipping to change at line 123 skipping to change at line 123
case *ast.BasicLit: case *ast.BasicLit:
switch kind := n.Kind.String(); kind { switch kind := n.Kind.String(); kind {
case kindFLOAT, kindINT: case kindFLOAT, kindINT:
w.checkNumLit(kind, n) w.checkNumLit(kind, n)
case kindSTRING: case kindSTRING:
w.checkStrLit(n) w.checkStrLit(n)
} }
} }
return w return w
} }
func (w lintAddConstantRule) checkStrLit(n *ast.BasicLit) { func (w lintAddConstantRule) checkStrLit(n *ast.BasicLit) {
if w.whiteLst[kindSTRING][n.Value] { if w.whiteLst[kindSTRING][n.Value] {
return return
} }
count := w.strLits[n.Value] count := w.strLits[n.Value]
if count >= 0 { if count >= 0 {
w.strLits[n.Value] = count + 1 w.strLits[n.Value] = count + 1
 End of changes. 2 change blocks. 
2 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)