Skip to content

Commit

Permalink
Merge pull request #150 from dawedawe/fix-141
Browse files Browse the repository at this point in the history
check --project arguments if file exists
  • Loading branch information
dawedawe authored Nov 9, 2023
2 parents c59fc44 + ca0fbe6 commit 80e6f0b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]

### Fixed
* [--project value should be tested if path exists](https://github.com/ionide/FSharp.Analyzers.SDK/issues/141) (thanks @dawedawe!)
* [Provide better DX when project cracking failed](https://github.com/ionide/FSharp.Analyzers.SDK/issues/126) (thanks @dawedawe!)

## [0.19.0] - 2023-11-08
Expand Down
17 changes: 5 additions & 12 deletions src/FSharp.Analyzers.Cli/Program.fs
Original file line number Diff line number Diff line change
Expand Up @@ -454,20 +454,13 @@ let main argv =
exit 1
| [], Some fscArgs -> runFscArgs client fscArgs ignoreFiles severityMapping |> Async.RunSynchronously
| projects, None ->
let runProj (proj: string) =
async {
let project =
if Path.IsPathRooted proj then
proj
else
Path.GetFullPath(Path.Combine(Environment.CurrentDirectory, proj))

let! results = runProject client toolsPath project ignoreFiles severityMapping
return results
}
for projPath in projects do
if not (File.Exists(projPath)) then
printError $"Invalid `--project` argument. File does not exist: '{projPath}'"
exit 1

projects
|> List.map runProj
|> List.map (fun projPath -> runProject client toolsPath projPath ignoreFiles severityMapping)
|> Async.Sequential
|> Async.RunSynchronously
|> Array.choose id
Expand Down

0 comments on commit 80e6f0b

Please sign in to comment.