Repository navigation
feat(report): expose the file surface a finding landed on #703
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
Open
Harbor404
wants to merge
6
commits into
NVIDIA:main
Choose a base branch
from
Harbor404:feat/finding-file-surface
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
8de3ff4
feat(report): expose the file surface each finding landed on
Harbor404 3f6ada0
fix(report): tighten surface classification
Harbor404 201f30e
chore(merge): sync with latest main
Harbor404 9b39ea1
fix(report): reject inline-closed comment surfaces
Harbor404 52eaf34
fix(report): keep surface labels line-accurate
Harbor404 c93028c
chore(merge): sync with latest main
Harbor404 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
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.
[Blocker]
content_linescomes fromstr.splitlines(), which also breaks lines on\v,\f,\x1c-\x1e,\x85,\u2028and\u2029. AST-derived findings that reach this function carry CPython line numbers, which don't count those characters, for example E2 (static_patterns_data_exfiltration.py:225-233) and OH1 (static_patterns_output_handling.py:595-603). One form feed or\u2028above a call shifts this lookup to an earlier line. Example: inimport os/^L# Collect settings for the report/env = dict(os.environ), E2 is on CPython line 3, butcontent_lines[2]is the comment, so the HIGH finding is labeledcomments. Benign files with PEP 8 form feeds are affected too. The simplest fix is to skip the refinement when the file contains any of\v\f\x1c\x1d\x1e\x85\u2028\u2029(computed once per file). Please add a test with this example.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.
Fixed in
52eaf34.content_linesnow normalizes CRLF/CR and splits only on CPython physical newlines, so\v,\f,\x1c-\x1e,\x85,\u2028, and\u2029no longer shift AST line lookups. Added the form-feed E2 regression; it reports CPython line 3 and surfacecode. Focused pytest: 249 passed; Ruff check/format pass.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.
Updated in
c93028c.src/skillspector/nodes/analyzers/static_runner.py:981-988now normalizes CRLF/CR and splits only on\n;_scan_pathuses that helper forcontent_linesatstatic_runner.py:1007-1009. Vertical tab, form feed,\x1c-\x1e, NEL, and Unicode line/paragraph separators therefore no longer shift AST line lookups. The form-feed E2 regression istests/test_finding_surface.py:130-139.I also merged
origin/main(2f93a86) without rebase or force-push, retaining both main's occurrence report identity/snippet propagation and this PR's surface metadata.Focused verification:
uv run --no-sync pytest tests/test_finding_surface.py tests/nodes/test_report_occurrence_columns.py tests/nodes/analyzers/test_static_runner_filtering.py -q->264 passed.uv run --no-sync ruff check ...->All checks passed!;ruff format --check->7 files already formatted.