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

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

Merged
merged 1 commit into from
Aug 27, 2022

Conversation

lzaoral
Copy link
Member

@lzaoral lzaoral commented Aug 26, 2022

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

Fixes: #80

Copy link
Member

@kdudka kdudka left a comment

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...

src/json-writer.cc Outdated Show resolved Hide resolved
src/json-writer.cc Outdated Show resolved Hide resolved
src/json-writer.cc Outdated Show resolved Hide resolved
... so that users can easily filter results according to their severity.

Fixes: csutils#80

Co-authored-by: Kamil Dudka <[email protected]>
Co-authored-by: Lukáš Zaoral <[email protected]>
Copy link
Member

@kdudka kdudka left a comment

Choose a reason for hiding this comment

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

Thanks for the update!

Copy link
Member

@jamacku jamacku left a comment

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:main Aug 27, 2022
@lzaoral lzaoral deleted the sarif-level branch August 27, 2022 06:45
@@ -214,6 +214,24 @@ static void sarifEncodeMsg(PTree *pDst, const std::string& text)
pDst->put_child("message", msg);
}

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

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
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) {

Copy link
Member Author

@lzaoral lzaoral Sep 26, 2022

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
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
Member Author

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 free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support level information in SARIF output
3 participants