Skip to content

fix: preserve full result description after error ID#115

Open
stacknil wants to merge 2 commits into
microsoft:mainfrom
stacknil:fix/preserve-result-description
Open

fix: preserve full result description after error ID#115
stacknil wants to merge 2 commits into
microsoft:mainfrom
stacknil:fix/preserve-result-description

Conversation

@stacknil

@stacknil stacknil commented Jul 5, 2026

Copy link
Copy Markdown

Summary

Fixes #109.

This updates SARIF result record conversion so that when a message starts with the result ruleId, the Description keeps the full remaining message text instead of only the first character after the rule ID.

Root cause

result_to_record() used message[len(error_id) + 1], which indexes a single character. It should slice from that position with message[len(error_id) + 1:].

Validation

  • python -m pytest tests/test_sarif_file.py -q
  • python -m pytest -q
  • python -m ruff check .
  • python -m ruff format --check .

Review notes

  • Design decision: keep the existing behavior for messages that do not start with the rule ID, and for messages that exactly equal the rule ID; only change the prefixed-message branch from single-character indexing to slicing.
  • Main risk: messages that start with the rule ID but use an unusual separator continue to follow the existing prefix/length guard; this PR does not broaden parsing semantics.
  • Compatibility impact: non-prefixed and exact rule-ID messages remain unchanged; prefixed messages now preserve the full remaining description instead of one character.
  • Rollback path: revert the two commits on this PR branch.

@stacknil

stacknil commented Jul 5, 2026

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

@stacknil

Copy link
Copy Markdown
Author

Hi maintainers, gentle follow-up on this small fix for #109. I also added boundary coverage for messages that do not start with ruleId and messages that exactly equal ruleId; CLA is green and local pytest/Ruff validation passes. Happy to adjust the test shape if you prefer a different one.

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.

Description truncated to only 1 character

1 participant