Skip to content

Commit

Permalink
Merge pull request #131 from xanzy/svh/f-foodcritic
Browse files Browse the repository at this point in the history
Properly exclude foodcritic checks
  • Loading branch information
svanharmelen committed Jun 20, 2019
2 parents 60195af + d06f221 commit 97b4cd2
Show file tree
Hide file tree
Showing 256 changed files with 46,008 additions and 4,238 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
language: go

go:
- 1.8
- 1.10.x
- 1.11.x
- 1.12.x
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,17 @@
Chef-Guard CHANGELOG
====================

0.7.3
------------------
- Switch to using Go modules, but still vendor (`go mod vendor`) for backwards compatibility
- Fix an issue that prevented to properly exclude foodcritic checks
- Fix a compatibility problem with Berkshelf > 7.x (GH-127)

0.7.2
------------------
- Add support for Foodcritic > v9.x.x
- Update dependencies order to fix issues resulting from [RFC 85](https://github.com/chef/chef/commit/dc96b2f45b8d8a0c6335c879551d8c1e94e9559c)
- Update go-gitlab dependency to start using the Gitlab V4 API and so stop using the deprecated V3 API
- Update `go-gitlab` dependency to start using the Gitlab V4 API and so stop using the deprecated V3 API
- Do not search and replace CRLF with LF line endings (GH-125)

0.7.1
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.7.2
0.7.3
4 changes: 2 additions & 2 deletions checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ func getFoodcriticArgs(org, cookbookPath string) []string {
excludes = fmt.Sprintf("%s,%s", excludes, custExcludes)
}
args := []string{}
if excludes != "" {
args = append(args, "--tags", "~"+strings.Replace(excludes, ",", ",~", -1))
for _, exclude := range strings.Split(excludes, ",") {
args = append(args, "--tags", "~"+exclude)
}
if cfg.Default.IncludeFCs != "" {
args = append(args, "--include", cfg.Default.IncludeFCs)
Expand Down
3 changes: 2 additions & 1 deletion chef-guard.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import (
)

// VERSION holds the current version
const VERSION = "0.7.2"
const VERSION = "0.7.3"

var chefKey string

Expand Down Expand Up @@ -164,6 +164,7 @@ func main() {
}

rtr.NotFoundHandler = p
rtr.MethodNotAllowedHandler = p
http.Handle("/", rtr)

// Start the server
Expand Down
12 changes: 3 additions & 9 deletions git/gitlab.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ func (g *GitLab) GetDiff(project, user, sha string) (string, error) {
func (g *GitLab) GetArchiveLink(project, tag string) (*url.URL, error) {
ns := fmt.Sprintf("%s/%s", g.group, project)

_, resp, err := g.client.Projects.GetProject(ns)
_, resp, err := g.client.Projects.GetProject(ns, nil)
if err != nil {
if resp != nil {
switch resp.StatusCode {
Expand Down Expand Up @@ -284,7 +284,7 @@ func (g *GitLab) TagRepo(project, tag string, usr *User) error {
func (g *GitLab) TagExists(project, tag string) (bool, error) {
ns := fmt.Sprintf("%s/%s", g.group, project)

tags, resp, err := g.client.Tags.ListTags(ns)
_, resp, err := g.client.Tags.GetTag(ns, tag)
if err != nil {
if resp != nil {
switch resp.StatusCode {
Expand All @@ -297,13 +297,7 @@ func (g *GitLab) TagExists(project, tag string) (bool, error) {
return false, fmt.Errorf("Error retrieving tags of project %s: %v", project, err)
}

for _, t := range tags {
if t.Name == tag {
return true, nil
}
}

return false, nil
return true, nil
}

// UntagRepo implements the Git interface
Expand Down
17 changes: 17 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
module github.com/xanzy/chef-guard

go 1.12

require (
github.com/google/go-github v17.0.0+incompatible
github.com/gorilla/mux v1.7.2
github.com/icub3d/graceful v0.0.0-20150426161802-c35c02575508
github.com/marpaia/chef-golang v0.1.1-0.20170804021637-5237b77e9f54
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f
github.com/xanzy/go-gitlab v0.18.0
github.com/xanzy/go-pathspec v1.0.1
github.com/xanzy/multisyncer v0.0.0-20151209090734-170d66c6ef90
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
gopkg.in/gcfg.v1 v1.2.3
gopkg.in/warnings.v0 v0.1.2 // indirect
)
46 changes: 46 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM=
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
github.com/google/go-github v17.0.0+incompatible h1:N0LgJ1j65A7kfXrZnUDaYCs/Sf4rEjNlfyDHW9dolSY=
github.com/google/go-github v17.0.0+incompatible/go.mod h1:zLgOLi98H3fifZn+44m+umXrS52loVEgC2AApnigrVQ=
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
github.com/gorilla/mux v1.7.2 h1:zoNxOV7WjqXptQOVngLmcSQgXmgk4NMz1HibBchjl/I=
github.com/gorilla/mux v1.7.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/icub3d/graceful v0.0.0-20150426161802-c35c02575508 h1:pax9JCxkPK2vkKW36qCURVgDJElxZgxoPecZMfD8CjU=
github.com/icub3d/graceful v0.0.0-20150426161802-c35c02575508/go.mod h1:dKf/Jxnwh0uXQ7vgDVbXwV8PoZIagjcZozYDiUHHS94=
github.com/marpaia/chef-golang v0.1.1-0.20170804021637-5237b77e9f54 h1:/S332O8/vwWgsMGd55/zsgQWXhd7hpFHgpTt8laSOG0=
github.com/marpaia/chef-golang v0.1.1-0.20170804021637-5237b77e9f54/go.mod h1:JuMP/YKjn5NxEuxjsn1PUKGstApK3g/qNn5vDaTDDUg=
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f h1:2+myh5ml7lgEU/51gbeLHfKGNfgEQQIWrlbdaOsidbQ=
github.com/mitchellh/osext v0.0.0-20151018003038-5e2d6d41470f/go.mod h1:OkQIRizQZAeMln+1tSwduZz7+Af5oFlKirV/MSYes2A=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/xanzy/go-gitlab v0.18.0 h1:LybNSWSIw8BK+GnxuETAhUXEzzh5rHsHjopqVkGJXRE=
github.com/xanzy/go-gitlab v0.18.0/go.mod h1:LSfUQ9OPDnwRqulJk2HcWaAiFfCzaknyeGvjQI67MbE=
github.com/xanzy/go-pathspec v1.0.1 h1:duIJo+KtA1hRr0DnpQWQQfe8lzqxMg0tA9SOPGnLy9E=
github.com/xanzy/go-pathspec v1.0.1/go.mod h1:kkGj4h2VmQ1a5oc8HI79R0kP455DGvCusDjBPNzRysE=
github.com/xanzy/multisyncer v0.0.0-20151209090734-170d66c6ef90 h1:pHWdb7guGshjdI6iqXdRmn/sTyxBtGpTMjrYkpGPDB8=
github.com/xanzy/multisyncer v0.0.0-20151209090734-170d66c6ef90/go.mod h1:gsPQA0xZ2YoLrETaigVJG+E78SP6KyHLqxePS4L2WZk=
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181108082009-03003ca0c849/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e h1:bRhVy7zSSasaqNksaRZiA5EEI+Ei4I1nO5Jh72wfHlg=
golang.org/x/net v0.0.0-20190108225652-1e06a53dbb7e/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/oauth2 v0.0.0-20181106182150-f42d05182288/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
google.golang.org/appengine v1.3.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
gopkg.in/gcfg.v1 v1.2.3 h1:m8OOJ4ccYHnx2f4gQwpno8nAX5OGOh7RLaaz0pj3Ogs=
gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
3 changes: 3 additions & 0 deletions vendor/github.com/golang/protobuf/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions vendor/github.com/golang/protobuf/CONTRIBUTORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 97b4cd2

Please sign in to comment.