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

Fix: PMD sarif report preview unavailable. #4571

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-l

- Fixes
- [swiftlint](https://github.com/realm/SwiftLint) Fix swiftlint error where linter is unable to find lintable files. Fixes [#440](https://github.com/oxsecurity/megalinter/issues/440).
- [SARIF_REPORTER](https://megalinter.io/latest/reporters/SarifReporter/) Fix PMD SARIF report preview unavailable. Fixes [#4522](https://github.com/oxsecurity/megalinter/issues/4522).

- Reporters

Expand Down
1 change: 1 addition & 0 deletions megalinter/reporters/SarifReporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ def produce_report(self):
os.remove(linter.sarif_output_file)
result_json = json.dumps(sarif_obj, sort_keys=True, indent=4)
# Remove workspace prefix from file names
result_json = result_json.replace("file:///github/workspace", "")
Copy link
Member

Choose a reason for hiding this comment

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

Won't you need replaceAll ?

Copy link
Member

Choose a reason for hiding this comment

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

@xezzon ? :)

Copy link
Author

Choose a reason for hiding this comment

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

What does replaceAll mean? Putting file:///github/workspace/d' into LIST_OF_REPLACEMENTS`?

result_json = normalize_log_string(result_json)
# Write output file
sarif_file_name = f"{self.report_folder}{os.path.sep}" + config.get(
Expand Down
Loading