Skip to content

Commit

Permalink
feat(sarif): adjust end column
Browse files Browse the repository at this point in the history
Both SARIF and diagnostic-structure are exclusive ranges.
  • Loading branch information
kmoschcau committed Jan 7, 2025
1 parent aec22a3 commit d5e1e5b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lua/lint/parser.lua
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function M.for_sarif(skeleton, opts)
lnum = region.startLine - 1,
end_lnum = region.endLine and region.endLine - 1,
col = region.startColumn and region.startColumn - 1 or 0,
end_col = region.endColumn and region.endColumn - 2 or default_end_col,
end_col = region.endColumn and region.endColumn - 1 or default_end_col,
severity = severity,
message = message,
source = source,
Expand Down
4 changes: 2 additions & 2 deletions spec/pmd_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ describe("linter.pmd", function()
lnum = 0,
end_lnum = 0,
col = 0,
end_col = 4,
end_col = 5,
severity = vim.diagnostic.severity.WARN,
message = "All classes, interfaces, enums and annotations must belong to a named package",
source = "PMD",
Expand All @@ -149,7 +149,7 @@ describe("linter.pmd", function()
lnum = 0,
end_lnum = 0,
col = 0,
end_col = 4,
end_col = 5,
severity = vim.diagnostic.severity.ERROR,
message = "The class name 'foo' doesn't match '[A-Z][a-zA-Z0-9]*'",
source = "PMD",
Expand Down
4 changes: 2 additions & 2 deletions spec/sarif_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ describe("parser.sarif", function()
bufnr = 1,
lnum = 0,
col = 9,
end_col = 18,
end_col = 19,
severity = vim.diagnostic.severity.WARN,
message = "This is a placeholder message.",
source = "SpecTool",
Expand Down Expand Up @@ -842,7 +842,7 @@ describe("parser.sarif", function()
bufnr = 1,
lnum = 0,
col = 9,
end_col = 18,
end_col = 19,
severity = vim.diagnostic.severity.WARN,
message = "This is a placeholder message.",
source = "SpecTool",
Expand Down

0 comments on commit d5e1e5b

Please sign in to comment.