Skip to content

Update sarif tests#124

Merged
zhamborova merged 10 commits intomainfrom
fix_java
May 16, 2025
Merged

Update sarif tests#124
zhamborova merged 10 commits intomainfrom
fix_java

Conversation

@zhamborova
Copy link
Copy Markdown
Contributor

@zhamborova zhamborova commented May 15, 2025

This pull request includes several changes across multiple areas, focusing on improving workflows, enhancing SARIF output processing, updating runtime and tool configurations, and refining integration test scripts. Below is a summary of the most important changes, grouped by theme:

Workflow Improvements

  • Removed the installation of yq on Windows in .github/workflows/it-test.yml and added a new id for the Run init tests on Windows step. This simplifies the workflow and ensures better test identification.
  • Updated the Check test results step to always run and added detailed checks for test outcomes on both Windows and Unix, improving error detection and reporting.

SARIF Output Enhancements

  • Modified the analyzeCmd in cmd/analyze.go to filter rules from merged SARIF outputs before writing to a file or printing, ensuring cleaner and more relevant output.
  • Updated SARIF files for various tools (eslint, lizard, pmd, semgrep, etc.) to replace detailed rule definitions with rules: null, simplifying the SARIF structure. [1] [2] [3] [4] [5] [6]

Runtime and Tool Configuration Updates

  • Added java@17.0.10 to the list of runtimes in integration-tests/init-with-token/expected/codacy.yaml and integration-tests/init-without-token/expected/codacy.yaml, reflecting updated runtime support. [1] [2]

Integration Test Refinements

  • Enhanced the Normalize-Config function in integration-tests/run.ps1 to preserve YAML structure and sort within sections, improving test output consistency.
  • Improved the Compare-Files function in integration-tests/run.ps1 to provide more detailed diff output when files do not match, aiding debugging. [1] [2]

Cleanup of Legacy Configurations

  • Removed outdated runtime and tool configurations from integration-tests/init-with-token/expected/.codacy/codacy.yaml, ensuring alignment with current standards.

These changes collectively enhance the maintainability, accuracy, and robustness of the workflows, SARIF processing, and integration tests.

@codacy-production
Copy link
Copy Markdown

codacy-production Bot commented May 15, 2025

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
-0.05% 0.00%
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (c29ef51) 4494 1376 30.62%
Head commit (b746ef3) 4501 (+7) 1376 (+0) 30.57% (-0.05%)

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#124) 29 0 0.00%

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settings    Change summary preferences

@zhamborova zhamborova force-pushed the fix_java branch 2 times, most recently from 043b365 to bb33d65 Compare May 15, 2025 20:49
@zhamborova zhamborova changed the title Fix java Fix sarif/ windows test/ unix result check May 15, 2025
@zhamborova zhamborova marked this pull request as ready for review May 16, 2025 07:48
@zhamborova zhamborova marked this pull request as draft May 16, 2025 08:13
Comment thread utils/sarif.go
// This should be called separately after MergeSarifOutputs if rule filtering is required
func FilterRulesFromSarif(sarifData []byte) ([]byte, error) {
// Use a map to preserve all fields during unmarshaling
var report map[string]interface{}
Copy link
Copy Markdown
Contributor

@andrzej-janczak andrzej-janczak May 16, 2025

Choose a reason for hiding this comment

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

I think it was ok work on the parsed (structure) version var report SarifReport

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

these change are due to previously disappeared fields in serifs

Copy link
Copy Markdown
Contributor

@andrzej-janczak andrzej-janczak May 16, 2025

Choose a reason for hiding this comment

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

what I mean is that this version, it has this longer implementation, but doing exactly same thing
So I think we can just get back to old impl of this and it should be fine right ? 🤔

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I reverted to your versions, but there are now missing fields in the actual sarif that we used have, especially visible in eslint failure 🤔

@zhamborova zhamborova marked this pull request as ready for review May 16, 2025 09:35
Comment thread integration-tests/init-with-token/expected/.codacy/codacy.yaml
@zhamborova zhamborova changed the title Fix sarif/ windows test/ unix result check Update sarif tests May 16, 2025
@zhamborova zhamborova merged commit 237e427 into main May 16, 2025
10 checks passed
@alerizzo alerizzo deleted the fix_java branch June 3, 2025 09:45
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

Successfully merging this pull request may close these issues.

3 participants