Skip to content

Commit

Permalink
Merge pull request #109 from grafana/106-update-k6lint-to-v0.3.0
Browse files Browse the repository at this point in the history
update k6lint to v0.3.1
  • Loading branch information
szkiba authored Nov 14, 2024
2 parents cef1a67 + f1bae1f commit fcc4c62
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
11 changes: 9 additions & 2 deletions cmd/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,13 @@ func updateWorkdir(ctx context.Context, dir string, cloneURL string) error {
return nil
}

func checkCompliance(ctx context.Context, module string, cloneURL string, tstamp float64) (*k6lint.Compliance, error) {
func checkCompliance(
ctx context.Context,
module string,
official bool,
cloneURL string,
tstamp float64,
) (*k6lint.Compliance, error) {
com, found, err := loadCompliance(ctx, module, tstamp)
if found {
slog.Debug("Compliance from cache", "module", module)
Expand All @@ -151,7 +157,8 @@ func checkCompliance(ctx context.Context, module string, cloneURL string, tstamp
slog.Debug("Check compliance", "module", module)

compliance, err := k6lint.Lint(ctx, dir, &k6lint.Options{
Passed: []k6lint.Checker{k6lint.CheckerLicense, k6lint.CheckerVersions, k6lint.CheckerGit},
Passed: []k6lint.Checker{k6lint.CheckerLicense, k6lint.CheckerVersions, k6lint.CheckerGit},
Official: official,
})
if err != nil {
return nil, err
Expand Down
4 changes: 3 additions & 1 deletion cmd/load.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ func loadOne(ctx context.Context, ext *k6registry.Extension, lint bool) error {
}

if lint && ext.Module != k6Module && ext.Compliance == nil && ext.Repo != nil {
compliance, err := checkCompliance(ctx, ext.Module, repo.CloneURL, repo.Timestamp)
official := ext.Tier == k6registry.TierOfficial

compliance, err := checkCompliance(ctx, ext.Module, official, repo.CloneURL, repo.Timestamp)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/google/go-github/v62 v62.0.0
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/grafana/clireadme v0.1.0
github.com/grafana/k6lint v0.2.0
github.com/grafana/k6lint v0.3.1
github.com/narqo/go-badge v0.0.0-20230821190521-c9a75c019a59
github.com/samber/slog-logrus/v2 v2.5.0
github.com/sirupsen/logrus v1.9.3
Expand Down Expand Up @@ -71,7 +71,7 @@ require (
golang.org/x/crypto v0.23.0 // indirect
golang.org/x/exp v0.0.0-20221006183845-316c7553db56 // indirect
golang.org/x/image v0.18.0 // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/mod v0.22.0 // indirect
golang.org/x/net v0.25.0 // indirect
golang.org/x/oauth2 v0.6.0 // indirect
golang.org/x/sync v0.7.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ github.com/grafana/clireadme v0.1.0 h1:KYEYSnYdSzmHf3bufaK6fQZ5j4dzvM/T+G6Ba+qNn
github.com/grafana/clireadme v0.1.0/go.mod h1:Wy4KIG2ZBGMYAYyF9l7qAy+yoJVasqk/txsRgoRI3gc=
github.com/grafana/k6foundry v0.3.0 h1:C+6dPbsOv7Uq4hEhBFNuYqmTdE9jQ0VqhXqBDtMkVTE=
github.com/grafana/k6foundry v0.3.0/go.mod h1:/NtBSQQgXup5SVbfInl0Q8zKVx08xgvXIZ0xncqexEs=
github.com/grafana/k6lint v0.2.0 h1:dEClo580VYmni/QHzF8m8svzdkY7XSYsbZovtDKD7Oo=
github.com/grafana/k6lint v0.2.0/go.mod h1:BQKSiLzZSniqZid6dW6/TX83Cm3Jt+n+1fa6VbSTg0A=
github.com/grafana/k6lint v0.3.1 h1:PgbAXqcullhmTKpU6uTmijivy4aShr0b2J2T1UblGOU=
github.com/grafana/k6lint v0.3.1/go.mod h1:rUkpZz8dx0Rxcy6e0tTzARIuQ4PbhG4/2YsGY8hhyzI=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542 h1:2VTzZjLZBgl62/EtslCrtky5vbi9dd7HrQPQIx6wqiw=
github.com/h2non/parth v0.0.0-20190131123155-b4df798d6542/go.mod h1:Ow0tF8D4Kplbc8s8sSb3V2oUCygFHVp8gC3Dn6U4MNI=
github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ=
Expand Down Expand Up @@ -201,8 +201,8 @@ golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.21.0 h1:vvrHzRwRfVKSiLrG+d4FMl/Qi4ukBCE6kZlTUkDYRT0=
golang.org/x/mod v0.21.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4=
golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY=
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
Expand Down

0 comments on commit fcc4c62

Please sign in to comment.