Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mindev linting errors #5227

Open
dussab opened this issue Dec 19, 2024 · 1 comment
Open

mindev linting errors #5227

dussab opened this issue Dec 19, 2024 · 1 comment
Labels
bug Something isn't working hackathon

Comments

@dussab
Copy link
Member

dussab commented Dec 19, 2024

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 dussab added bug Something isn't working hackathon labels Dec 19, 2024
@JAORMX
Copy link
Contributor

JAORMX commented Dec 19, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working hackathon
Projects
None yet
Development

No branches or pull requests

2 participants