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

Request: commenter could support any json from any random code scanner #80

Open
jrobison-sb opened this issue Sep 15, 2022 · 0 comments

Comments

@jrobison-sb
Copy link

The commenter tool is really cool how it targets comments in a PR directly to any offending line which will change in that PR, and equally cool is how it doesn't spam a PR with comments relating to lines which aren't changing in a PR. I've googled around a bunch and this tool was the only one I could find which had that capability.

It could be even cooler if that commenter tool supported json from any random code scanner, rather than being hardcoded for tfsec json keys. For example, here's a sample of output from ansible-lint:

[
  {
    "categories": [
      "idempotency"
    ],
    "check_name": "package-latest",
    "content": {
      "body": "Task/Handler: Install some package"
    },
    "description": "Package installs should not use latest.",
    "fingerprint": "160155f8da48226ca74e3ed55a307c2bd93f5e06960ec650556220bf56974797",
    "location": {
      "lines": {
        "begin": 376
      },
      "path": "ansible/roles/common/tasks/main.yml"
    },
    "severity": "info",
    "type": "issue"
  }
]

Those fields don't exactly map to the fields commenter looks for, but they're pretty close. It would be cool if I could remap fields when calling the commenter tool to make it work on any json from any code scanner. In the above example, I might call the commenter tool like this:

commenter \
--rule-id 'json:"check_name"' \
--file-name 'json:"location.path"' \
... and so on...

And of course the default behavior could be kept if I didn't explicitly remap any fields, so it's behavior with tfsec json could be unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant