Skip to content
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

Improve sarif #155

Merged
merged 4 commits into from
Nov 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
]
},
"fsdocs-tool": {
"version": "20.0.0-alpha-006",
"version": "20.0.0-alpha-009",
"commands": [
"fsdocs"
]
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
* [Provide better DX when project cracking failed](https://github.com/ionide/FSharp.Analyzers.SDK/issues/126) (thanks @dawedawe!)
* [Hint is mapped as note in sarif export](https://github.com/ionide/FSharp.Analyzers.SDK/pull/148) (thanks @nojaf!)
* [Properly walk SynModuleSigDecl.Val](https://github.com/ionide/FSharp.Analyzers.SDK/pull/156) (thanks @nojaf!)
* [Sarif file should not report absolute file paths](https://github.com/ionide/FSharp.Analyzers.SDK/issues/154) (thanks @nojaf!)

## [0.19.0] - 2023-11-08

Expand Down
8 changes: 5 additions & 3 deletions src/FSharp.Analyzers.Cli/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,8 @@ let printMessages (msgs: AnalyzerMessage list) =

let writeReport (results: AnalyzerMessage list option) (report: string) =
try
let pwd = Directory.GetCurrentDirectory() |> Uri

// Construct full path to ensure path separators are normalized.
let report = Path.GetFullPath report
// Ensure the parent directory exists
Expand Down Expand Up @@ -315,15 +317,15 @@ let writeReport (results: AnalyzerMessage list option) (report: string) =

physicalLocation.ArtifactLocation <-
let al = ArtifactLocation()
al.Uri <- Uri(analyzerResult.Message.Range.FileName)
al.Uri <- pwd.MakeRelativeUri(Uri(analyzerResult.Message.Range.FileName))
al

physicalLocation.Region <-
let r = Region()
r.StartLine <- analyzerResult.Message.Range.StartLine
r.StartColumn <- analyzerResult.Message.Range.StartColumn
r.StartColumn <- analyzerResult.Message.Range.StartColumn + 1
r.EndLine <- analyzerResult.Message.Range.EndLine
r.EndColumn <- analyzerResult.Message.Range.EndColumn
r.EndColumn <- analyzerResult.Message.Range.EndColumn + 1
r

let location: Location = Location()
Expand Down