Skip to content

Commit 65374c3

Browse files
committed
PR feedback implemented and lint fixes.
1 parent ac98fb9 commit 65374c3

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

src/FSharpLint.Console/Program.fs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,28 +63,28 @@ let internal expandWildcard (pattern:string) =
6363
| -1 ->
6464
// Non-recursive pattern
6565
match normalizedPattern.LastIndexOf '/' with
66-
| -1 -> ".", normalizedPattern, SearchOption.TopDirectoryOnly
66+
| -1 -> (".", normalizedPattern, SearchOption.TopDirectoryOnly)
6767
| lastSeparator ->
6868
let dir = normalizedPattern.Substring(0, lastSeparator)
6969
let pat = normalizedPattern.Substring(lastSeparator + 1)
70-
(if String.IsNullOrEmpty dir then "." else dir), pat, SearchOption.TopDirectoryOnly
70+
((if String.IsNullOrEmpty dir then "." else dir), pat, SearchOption.TopDirectoryOnly)
7171
| 0 ->
7272
// Pattern starts with **/
7373
let pat = normalizedPattern.Substring 3
74-
".", pat, SearchOption.AllDirectories
74+
(".", pat, SearchOption.AllDirectories)
7575
| doubleStarIndex ->
7676
// Pattern has **/ in the middle
7777
let dir = normalizedPattern.Substring(0, doubleStarIndex).TrimEnd '/'
7878
let pat = normalizedPattern.Substring(doubleStarIndex + 3)
79-
dir, pat, SearchOption.AllDirectories
79+
(dir, pat, SearchOption.AllDirectories)
8080

8181
let fullDirectory = Path.GetFullPath directory
8282
if Directory.Exists fullDirectory then
8383
Directory.GetFiles(fullDirectory, searchPattern, searchOption)
8484
|> Array.filter isFSharpFile
8585
|> Array.toList
8686
else
87-
[]
87+
List.empty
8888

8989
let private parserProgress (output:Output.IOutput) = function
9090
| Starting file ->
@@ -169,10 +169,11 @@ let private start (arguments:ParseResults<ToolArgs>) (toolsPath:Ionide.ProjInfo.
169169
| FileType.Source -> Lint.lintSource lintParams target
170170
| FileType.Solution -> Lint.lintSolution lintParams target toolsPath
171171
| FileType.Wildcard ->
172+
output.WriteInfo $"Wildcard detected, but not recommended. Using a project (slnx/sln/fsproj) can detect more issues."
172173
let files = expandWildcard target
173174
if List.isEmpty files then
174175
output.WriteInfo $"No files matching pattern '%s{target}' were found."
175-
LintResult.Success []
176+
LintResult.Success List.empty
176177
else
177178
output.WriteInfo $"Found %d{List.length files} file(s) matching pattern '%s{target}'."
178179
Lint.lintFiles lintParams files

src/FSharpLint.Core/Application/Lint.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,8 +668,8 @@ module Lint =
668668

669669
let results = filePaths |> Seq.map lintSingleFile |> Seq.toList
670670

671-
let failures = results |> List.choose (function | LintResult.Failure f -> Some f | _ -> None)
672-
let warnings = results |> List.collect (function | LintResult.Success w -> w | _ -> [])
671+
let failures = results |> List.choose (function | LintResult.Failure failure -> Some failure | _ -> None)
672+
let warnings = results |> List.collect (function | LintResult.Success warning -> warning | _ -> List.empty)
673673

674674
match failures with
675675
| firstFailure :: _ -> LintResult.Failure firstFailure

0 commit comments

Comments
 (0)