Skip to content

Commit

Permalink
release 0.0.6
Browse files Browse the repository at this point in the history
go mod update
import sort
change native format
fix typo
  • Loading branch information
zabio3 committed Jun 30, 2019
1 parent 93ddd4b commit 1a8fcb9
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
19 changes: 10 additions & 9 deletions cmd/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"sort"

"github.com/moby/buildkit/frontend/dockerfile/parser"

"github.com/zabio3/godolint/linter"
)

Expand All @@ -24,7 +25,7 @@ const (

const name = "godolint"

const version = "0.0.5"
const version = "0.0.6"

const usage = `godolint - Dockerfile Linter written in Golang
Expand Down Expand Up @@ -58,25 +59,25 @@ func (ss *sliceString) Set(value string) error {

// Run it takes Dockerfile as an argument and applies it to analyzer to standard output.
func (cli *CLI) Run(args []string) int {
var ingnoreRules sliceString
var ignoreRules sliceString
var isVersion bool

flags := flag.NewFlagSet(name, flag.ContinueOnError)
flags.Usage = func() {
_, _ = fmt.Fprint(cli.OutStream, usage)
}

flags.Var(&ingnoreRules, "ignore", "Set ignore strings")
flags.Var(&ignoreRules, "ignore", "Set ignore strings")
flags.BoolVar(&isVersion, "version", false, "version")
flags.BoolVar(&isVersion, "v", false, "version")

if err := flags.Parse(args[1:]); err != nil {
_, _ = fmt.Fprintf(cli.ErrStream, "%s\n", err)
_, _ = fmt.Fprintf(cli.ErrStream, "%v\n", err)
return ExitCodeParseFlagsError
}

if isVersion {
_, _ = fmt.Fprintf(cli.OutStream, "godolint version %s\n", version)
_, _ = fmt.Fprintf(cli.OutStream, "godolint version %v\n", version)
return ExitCodeOK
}

Expand All @@ -90,20 +91,20 @@ func (cli *CLI) Run(args []string) int {
file := args[length-1]
f, err := os.Open(file)
if err != nil {
_, _ = fmt.Fprintf(cli.ErrStream, "%s\n", err)
_, _ = fmt.Fprintf(cli.ErrStream, "%v\n", err)
return ExitCodeFileError
}

r, err := parser.Parse(f)
if err != nil {
_, _ = fmt.Fprintf(cli.ErrStream, "%s\n", err)
_, _ = fmt.Fprintf(cli.ErrStream, "%v\n", err)
return ExitCodeAstParseError
}

analyzer := linter.NewAnalyzer(ingnoreRules)
analyzer := linter.NewAnalyzer(ignoreRules)
rst, err := analyzer.Run(r.AST)
if err != nil {
_, _ = fmt.Fprintf(cli.ErrStream, "%s\n", err)
_, _ = fmt.Fprintf(cli.ErrStream, "%v\n", err)
return ExitCodeLintCheckError
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Other Commands:
},
{
command: "godolint --version",
expectedOutStream: "godolint version 0.0.5\n",
expectedOutStream: "godolint version 0.0.6\n",
expectedErrStream: "",
expectedExitCode: ExitCodeOK,
},
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module github.com/zabio3/godolint

require github.com/moby/buildkit v0.5.1
require github.com/moby/buildkit v0.5.1
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ github.com/gogo/protobuf v1.0.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7a
github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-cmp v0.2.0 h1:+dTQ8DZQJz0Mb/HjFlkptS1FeQ4cWSnN941F8aEG4SQ=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/shlex v0.0.0-20150127133951-6f45313302b9/go.mod h1:RpwtwJQFrIEPstU94h88MWPXP2ektJZ8cZ0YntAmXiE=
github.com/gotestyourself/gotestyourself v2.2.0+incompatible/go.mod h1:zZKM6oeNM8k+FRljX1mnzVYeS8wiGgQyvST1/GafPbY=
Expand Down Expand Up @@ -104,4 +105,5 @@ gopkg.in/gemnasium/logrus-airbrake-hook.v2 v2.1.2/go.mod h1:Xk6kEKp8OKb+X14hQBKW
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gotest.tools v2.1.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo=
gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw=
1 change: 1 addition & 0 deletions linter/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package linter

import (
"github.com/moby/buildkit/frontend/dockerfile/parser"

"github.com/zabio3/godolint/linter/rules"
)

Expand Down
2 changes: 1 addition & 1 deletion linter/rules/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ func isContain(s []string, e string) bool {
func CreateMessage(rule *Rule, vrst []ValidateResult) []string {
rst := make([]string, len(vrst))
for i, v := range vrst {
rst[i] = fmt.Sprintf("#%v %s %s %s\n", v.line, rule.Code, rule.Description, v.addMsg)
rst[i] = fmt.Sprintf("#%d %s %s %s\n", v.line, rule.Code, rule.Description, v.addMsg)
}
return rst
}

0 comments on commit 1a8fcb9

Please sign in to comment.