-
Notifications
You must be signed in to change notification settings - Fork 10
Introduce --format flag to conditionally generate SARIF report
#70
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
Merged
gayaldassanayake
merged 11 commits into
ballerina-platform:main
from
nureka-rodrigo:sarif
Aug 6, 2025
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
db3d995
Add SARIF report generation
nureka-rodrigo 311376f
Introduce --format flag to conditionally generate SARIF report
nureka-rodrigo 1816be0
Add tests for scan command format flag handling
nureka-rodrigo 31498b7
Update README to include --format flag information
nureka-rodrigo 2dd2ff9
Refactor report format handling to use enum for scan command
nureka-rodrigo e814c20
Update SARIF helpUri construction to follow current central doc ancho…
nureka-rodrigo 1cb73a3
Update README and code to reflect changes in output format from json …
nureka-rodrigo 1d84b08
Inject application version into properties file during build
nureka-rodrigo b954ce6
Optimize rule collection by using a Set to ensure unique rule IDs
nureka-rodrigo ef908e6
Refactor scan report file generation to use if-else logic for updatin…
nureka-rodrigo 0ae1aca
Bump version to 0.11.0
nureka-rodrigo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
scan-command/src/main/java/io/ballerina/scan/ReportFormat.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| /* | ||
| * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com). | ||
| * | ||
| * WSO2 LLC. licenses this file to you under the Apache License, | ||
| * Version 2.0 (the "License"); you may not use this file except | ||
| * in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| package io.ballerina.scan; | ||
|
|
||
| /** | ||
| * Enum representing the report formats supported by the scan command. | ||
| * | ||
| * @since 0.11.0 | ||
| */ | ||
| public enum ReportFormat { | ||
| BALLERINA("ballerina"), | ||
| SARIF("sarif"); | ||
|
|
||
| private final String format; | ||
|
|
||
| ReportFormat(String format) { | ||
| this.format = format; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the format string of the report format. | ||
| * | ||
| * @return the format string | ||
| */ | ||
| public String getFormat() { | ||
| return format; | ||
| } | ||
|
|
||
| /** | ||
| * Returns the ReportFormat enum constant corresponding to the given format string. | ||
| * | ||
| * @param format the format string | ||
| * @return the corresponding ReportFormat enum constant | ||
| * @throws IllegalArgumentException if the format string does not match any known format | ||
| */ | ||
| public static ReportFormat fromString(String format) { | ||
| for (ReportFormat reportFormat : values()) { | ||
| if (reportFormat.getFormat().equalsIgnoreCase(format)) { | ||
| return reportFormat; | ||
| } | ||
| } | ||
| throw new IllegalArgumentException("Unknown report format: " + format); | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.