Skip to content

json-writer: print level key in SARIF output - #81

Merged
lzaoral merged 1 commit into
csutils:mainfrom
lzaoral:sarif-level
Aug 27, 2022
Merged

json-writer: print level key in SARIF output#81
lzaoral merged 1 commit into
csutils:mainfrom
lzaoral:sarif-level

Conversation

@lzaoral

Copy link
Copy Markdown
Member

... so that users can easily filter results according to their severity.

Fixes: #80

@kdudkakdudka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for working on it! Some minor issues inline...

Comment threadsrc/json-writer.cc Outdated
Comment threadsrc/json-writer.cc Outdated
Comment threadsrc/json-writer.cc Outdated
... so that users can easily filter results according to their severity.
Fixes: csutils#80
Co-authored-by: Kamil Dudka <kdudka@redhat.com>
Co-authored-by: Lukáš Zaoral <lzaoral@redhat.com>

@kdudkakdudka left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the update!

@jamackujamacku left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is amazing; thank you! 🥳

Screenshot from 2022-08-26 21-19-53

@lzaoral
lzaoral merged commit a3eac76 into csutils:mainAug 27, 2022
@lzaoral
lzaoral deleted the sarif-level branch August 27, 2022 06:45
Comment threadsrc/json-writer.cc
pDst->put_child("message", msg);
}

static void sarifEncodeLevel(PTree *result, const std::string &event) {

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self: fix bracket formatting inconsistency in some future commit

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might consider using this one-liner in CI to catch this:

grep '^static .*) *{$' src/*

There is one more inconsistency in abstarct-parser.cc:

src/abstract-parser.cc:static inline std::unique_ptr<T> make_unique(InStream &input) {
src/json-writer.cc:static void sarifEncodeLevel(PTree *result, const std::string &event) {

@lzaorallzaoralSep 26, 2022

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a custom .clang-format config to enforce code style is would be a better solution. Tracked in #86.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That would mean more work than the proposed one-liner. But if we have a volunteer to work on this, why not :-)

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not that hard, I've already done it few times. Additionally, such config file can be then used in all of our projects.

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support level information in SARIF output

3 participants

@lzaoral@kdudka@jamacku