Skip to content

Commit

Permalink
add/linter: queryMqlMissing -> fixed????++
Browse files Browse the repository at this point in the history
Signed-off-by: Manuel Weber <[email protected]>
  • Loading branch information
mm-weber committed Nov 1, 2024
1 parent a5bae9f commit 88f25f0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
3 changes: 2 additions & 1 deletion internal/bundle/lint.go
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ func lintQuery(query *Mquery, file string, globalQueriesUids map[string]int, ass
}
}

if query.Mql == "// not implemented yet" {
reNotImplemented := regexp.MustCompile(`\/\/\snot\simplemented\syet`)
if reNotImplemented.MatchString(query.Mql) {
res.Entries = append(res.Entries, Entry{
RuleID: queryMqlMissing,
Message: fmt.Sprintf("query %s does not define a mql field", uid),
Expand Down
2 changes: 1 addition & 1 deletion internal/bundle/lint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ func TestLintFail_MissingMQLVariant(t *testing.T) {
require.NoError(t, err)

assert.Equal(t, 1, len(results.BundleLocations))
assert.Equal(t, 2, len(results.Entries))
assert.Equal(t, 1, len(results.Entries))
assert.True(t, results.HasError())

entry := results.Entries[0]
Expand Down
7 changes: 2 additions & 5 deletions internal/bundle/testdata/missing-mql-variants.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ queries:
title: Missing MQL 1
variants:
- uid: mql-missing--foo
- uid: mql-missing--bar

- uid: mql-missing--foo
mql: "// not implemented yet"
- uid: mql-missing--bar
mql: "// not implemented yet"
mql: |
// not implemented yet
2 changes: 1 addition & 1 deletion internal/bundle/testdata/missing-mql.mql.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ policies:
queries:
- uid: mql-missing--1.1
title: Missing MQL 1
mql: "// not implemented yet"
mql: // not implemented yet

0 comments on commit 88f25f0

Please sign in to comment.