Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
2 commits
Select commit Hold shift + click to select a range
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
8 changes: 7 additions & 1 deletion linters/ruff/ruff_to_sarif.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,13 @@ def get_region(entry, column_offset=0):
"ruleId": rule_id,
}

if "fix" in result and result["fix"] is not None:
have_fix = "fix" in result and result["fix"] is not None
# Skip autofixes specific to a jupyter notebook cell and they are difficult to apply.
have_cell = "cell" in result and result["cell"] is not None

if have_fix and not have_cell:
# Locations for jupyter notebooks are not relative to the file,
# so we can not easily handle them.
fixes = result["fix"]

# TODO(Tyler): If output format changes any more substantially, consider version-specific parsers
Expand Down
11 changes: 0 additions & 11 deletions linters/ruff/test_data/ruff_v0.6.0_basic_nb.check.shot
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,6 @@ exports[`Testing linter ruff test basic_nb 1`] = `
{
"issues": [
{
"autofixOptions": [
{
"message": "Remove unused import: \`os\`",
"replacements": [
{
"filePath": "test_data/basic_nb.in.ipynb",
"length": "2",
},
],
},
],
"code": "F401",
"column": "1",
"file": "test_data/basic_nb.in.ipynb",
Expand Down
Loading