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

Control severity of sarif reports #43

Closed
VictoriousRaptor opened this issue Dec 30, 2022 · 10 comments
Closed

Control severity of sarif reports #43

VictoriousRaptor opened this issue Dec 30, 2022 · 10 comments
Milestone

Comments

@VictoriousRaptor
Copy link

In wiki I see that user can configure specific events like unrecognized-spelling as warning, but I can't find any example or hint to apply it.

@jsoref
Copy link
Member

jsoref commented Dec 30, 2022

The default is:

check-spelling/action.yml

Lines 210 to 213 in d7cd297

warnings:
description: 'List of events that are warnings (items that are neither warnings nor notices will result in an :x:)'
required: false
default: bad-regex,binary-file,deprecated-feature,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration

If you wanted to include unrecognized-spelling, you could use:

with:
  warnings: unrecognized-spelling,bad-regex,binary-file,deprecated-feature,large-file,limited-references,no-newline-at-eof,noisy-file,non-alpha-in-dictionary,unexpected-line-ending,whitespace-in-dictionary,minified-file,unsupported-configuration 

@jsoref
Copy link
Member

jsoref commented Dec 30, 2022

I've made the following changes:

  1. Added a page documenting the feature
  2. Updated the v0.0.20 release notes and wiki entry
  3. Added a link from Event descriptions

@jsoref
Copy link
Member

jsoref commented Dec 30, 2022

Please let me know if this covers what you're looking for / if you have any problems.

@VictoriousRaptor
Copy link
Author

Thank you for your reply! Now I can treat unrecognized spellings as warning in action log. But is there a way to treat it as warning in Security tab of my repo?

@jsoref
Copy link
Member

jsoref commented Dec 31, 2022

Oh, interesting, you're using Sarif? Not currently, how much control do you want/need? I could allow you to specify a replacement Sarif template... Or I could provide a thing similar to the warnings flag, or I could try to apply the values from warnings into the Sarif template.

One concern I have w/ letting you replace the file entirely is that when you upgrade, you'd lose whatever new items it defines. warnings behaves a little differently in that it will only override things you know about and everything else you effectively inherit.

(I'd love to get feedback on your experience of using Sarif, it's a new feature and I don't think many people have deployed it yet.)

@jsoref
Copy link
Member

jsoref commented Jan 1, 2023

I've also added warnings to https://github.com/check-spelling/check-spelling/wiki/Configuration#warnings. I'll need to spend some time reviewing the full list to see if I've missed anything else...

@jsoref
Copy link
Member

jsoref commented Jan 1, 2023

Thinking about the Sarif side a bit, I think what I'll do is let you write a sarif.json file, and if there is one, I'll merge its contents into the sarif.json file I have, probably using code similar to:
https://gist.github.com/theimpostor/79d4d37876aa990edd2ebc0e1d9391b5

That's pretty workable, since prerelease handles the sarif.json using JSON::PP:

my $sarif_template_file = "$ENV{spellchecker}/sarif.json";

I suspect I'll look into this the next time I look at the Sarif handling (probably in a week or two).

@VictoriousRaptor
Copy link
Author

I've temporaily disabled sarif since it's spamming the repo's security tab. Please inform me when it's polished better.

how much control do you want/need?

My request is to treat events defined as warning in the yml file as warning in sarif too. Or the security tab is full of error alerts.

Thank you for creating this amazing repo!

@jsoref jsoref changed the title How to treat certain events as warning? Control severity of sarif reports Jan 4, 2023
@jsoref
Copy link
Member

jsoref commented Jan 4, 2023

I've implemented a version of this in: d5a7faa.
You can try using @prerelease.

Just drop in a file, something like https://raw.githubusercontent.com/check-spelling/check-spelling/prerelease/t/sarif.json into .github/actions/spelling/sarif.json (assuming you're using .github/actions/spelling), its content will be merged with the general https://raw.githubusercontent.com/check-spelling/check-spelling/prerelease/sarif.json file, things you define should override things in the base file. (The version field is set by check-spelling after this, so you won't be able to set it, and similarly the results are filled in after merging your override.)

I'd love to get some feedback before this ships.

@jsoref jsoref added this to the v0.0.21 milestone Jan 11, 2023
@jsoref
Copy link
Member

jsoref commented Sep 29, 2023

@jsoref jsoref closed this as completed Sep 29, 2023
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

2 participants