minder icon indicating copy to clipboard operation
minder copied to clipboard

mindev linting errors

Open dussab opened this issue 1 year ago • 1 comments

Describe the issue

I'm writing a rule similar to https://github.com/mindersec/minder-rules-and-profiles/pull/228/files#diff-c403aa914bf9da4592bdc7034803e737cabb0713223d0c07ddb4a8ba99004936

When i run mindev ruletype lint -r [my.yaml] on a file I get the following errors:

aggregates: {}
metrics: {}
aggregateprofile: {}
ignoredirectives: {}
violations:
    - title: opa-fmt
      description: File should be formatted with `opa fmt`
      category: style
      level: error
      relatedresources:
        - description: documentation
          reference: https://docs.styra.com/regal/rules/style/opa-fmt
      location:
        end: null
        text: package minder
        file: gitleaks_github_action.yaml
        column: 1
        row: 1
        offset: 0
      isaggregate: false
    - title: directory-package-mismatch
      description: Directory structure should mirror package
      category: idiomatic
      level: error
      relatedresources:
        - description: documentation
          reference: https://docs.styra.com/regal/rules/idiomatic/directory-package-mismatch
      location:
        end:
            row: 1
            column: 15
        text: package minder
        file: gitleaks_github_action.yaml
        column: 9
        row: 1
        offset: 0
      isaggregate: false
notices:
    - title: implicit-future-keywords
      description: Rule made obsolete by rego.v1 capability
      category: imports
      level: notice
      severity: none
profile: []
summary:
    filesscanned: 1
    filesfailed: 1
    rulesskipped: 0
    numviolations: 2

The file was located in the github rules folder: https://github.com/mindersec/minder-rules-and-profiles/tree/main/rule-types/github so it looks like it was expecting the package to be "github". I also couldn't get rid of the "File should be formatted with opa fmt" error unless I ran mindev ruletype lint -r [my.yaml] --skip-rego

Should the linter work out of the. box for these scenarios?

To Reproduce

Run on mindev ruletype lint -r on https://github.com/mindersec/minder-rules-and-profiles/pull/228/files#diff-c403aa914bf9da4592bdc7034803e737cabb0713223d0c07ddb4a8ba99004936

What version are you using?

No response

dussab avatar Dec 19 '24 11:12 dussab

So, unfortunately, a bunch of our rules have linting warnings from OPA. They still work but don't follow all practices set by the linter. These are non-fatal errors. I understand it's confusing though.

JAORMX avatar Dec 19 '24 13:12 JAORMX