diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index b161e3c337..dfe1dea839 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -24,7 +24,7 @@
"rollForward": false
},
"fsharp-analyzers": {
- "version": "0.25.0",
+ "version": "0.32.1",
"commands": [
"fsharp-analyzers"
],
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 2a30cf7952..576e0bfa61 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -27,15 +27,6 @@ jobs:
- name: "trigger fantomas-tools action"
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/main'
run: "curl -H 'Accept: application/vnd.github.everest-preview+json' -H 'Authorization: token ${{secrets.FANTOMAS_TOOLS_TOKEN}}' --request POST --data '{\"event_type\": \"fantomas-commit-on-main\"}' https://api.github.com/repos/fsprojects/fantomas-tools/dispatches"
- - name: "Run analyzers"
- run: dotnet fsi build.fsx -- -p Analyze
- continue-on-error: true
- if: matrix.os == 'ubuntu-latest'
- - name: Upload SARIF file
- uses: github/codeql-action/upload-sarif@v3
- if: matrix.os == 'ubuntu-latest' && (github.event_name != 'push' || github.actor != 'dependabot[bot]')
- with:
- sarif_file: analysisreports
- name: "Documentation"
if: matrix.os == 'windows-latest' && github.ref == 'refs/heads/main'
uses: peaceiris/actions-gh-pages@v4
@@ -49,6 +40,26 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: dotnet fsi build.fsx -p Release
+ analyze:
+ name: Analyze solution
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v5
+
+ - name: Setup .NET Core
+ uses: actions/setup-dotnet@v4
+
+ - name: Run analyzers
+ run: dotnet fsi build.fsx -- -p Analyze
+ continue-on-error: true
+
+ - name: Upload merged SARIF
+ if: github.event_name != 'push' || github.actor != 'dependabot[bot]'
+ uses: github/codeql-action/upload-sarif@v3
+ with:
+ sarif_file: analysis.sarif
+
# Builds the project in a dev container
build-devcontainer:
runs-on: ubuntu-latest
diff --git a/Directory.Build.props b/Directory.Build.props
index 26e34508ab..e39f292f81 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -65,6 +65,5 @@ Some common use cases include:
all
runtime; build; native; contentfiles; analyzers
-
diff --git a/Directory.Build.targets b/Directory.Build.targets
index d4e4361d29..3ef1267b3b 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -5,12 +5,4 @@
-
- .
- --analyzers-path "$(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs"
- $(FSharpAnalyzersOtherFlags) --analyzers-path "$(PkgIonide_Analyzers)/analyzers/dotnet/fs"
- $(FSharpAnalyzersOtherFlags) --verbosity d
- $(FSharpAnalyzersOtherFlags) --code-root $(CodeRoot)
- $(FSharpAnalyzersOtherFlags) --report "$(CodeRoot)/analysisreports/$(MSBuildProjectName)-analysis.sarif"
-
\ No newline at end of file
diff --git a/Directory.Packages.props b/Directory.Packages.props
index 084fea47dc..c0e7d0becc 100644
--- a/Directory.Packages.props
+++ b/Directory.Packages.props
@@ -14,9 +14,8 @@
-
-
-
+
+
diff --git a/Directory.Solution.targets b/Directory.Solution.targets
index ee1676023c..56e77a69ca 100644
--- a/Directory.Solution.targets
+++ b/Directory.Solution.targets
@@ -1,17 +1,28 @@
+
+
-
+
$(SolutionDir)
-
-
+
+
+ --analyzers-path "$(PkgG-Research_FSharp_Analyzers)/analyzers/dotnet/fs"
+ $(FSharpAnalyzersOtherFlags) --analyzers-path "$(PkgIonide_Analyzers)/analyzers/dotnet/fs"
+ $(FSharpAnalyzersOtherFlags) --verbosity d
+ $(FSharpAnalyzersOtherFlags) --code-root $(CodeRoot)
+ $(FSharpAnalyzersOtherFlags) --report "$(CodeRoot)/analysis.sarif"
+
+
+
+
+
\ No newline at end of file
diff --git a/build.fsx b/build.fsx
index 4a159bf9f9..382cae6feb 100644
--- a/build.fsx
+++ b/build.fsx
@@ -1,9 +1,8 @@
-#r "nuget: Fun.Build, 1.0.3"
+#r "nuget: Fun.Build, 1.1.16"
#r "nuget: CliWrap, 3.6.4"
#r "nuget: FSharp.Data, 6.3.0"
#r "nuget: Ionide.KeepAChangelog, 0.1.8"
#r "nuget: Humanizer.Core, 2.14.1"
-#load "./sarif.fsx"
open System
open System.IO
@@ -502,8 +501,9 @@ pipeline "PublishAlpha" {
pipeline "Analyze" {
workingDir __SOURCE_DIRECTORY__
+ stage "RestoreTools" { run "dotnet tool restore" }
+ stage "RestoreSolution" { run "dotnet restore --tl" }
stage "Analyze" { run "dotnet msbuild /t:AnalyzeSolution" }
- stage "Merge" { run Sarif.mergeSarifFiles }
runIfOnlySpecified true
}
diff --git a/sarif.fsx b/sarif.fsx
deleted file mode 100644
index 89889136fa..0000000000
--- a/sarif.fsx
+++ /dev/null
@@ -1,294 +0,0 @@
-#r "nuget: Thoth.Json.Newtonsoft, 0.3.2"
-
-open System
-open System.IO
-open System.Threading.Tasks
-
-type Text = { text: string }
-
-type Region =
- { startLine: int
- startColumn: int
- endLine: int
- endColumn: int }
-
-type ArtifactLocation = { uri: string }
-
-type PhysicalLocation =
- { artifactLocation: ArtifactLocation
- region: Region }
-
-type Location = { physicalLocation: PhysicalLocation }
-
-type Message = { text: string }
-
-type Result =
- { ruleId: string
- ruleIndex: int
- message: Message
- locations: Location list }
-
-type RuleShortDescription = { text: string; markdown: string }
-
-type Rule =
- { id: string
- name: string
- shortDescription: RuleShortDescription
- helpUri: string }
-
-type Driver =
- { name: string
- version: string
- informationUri: string
- rules: Rule list option }
-
-type Tool = { driver: Driver }
-
-type Invocation =
- { startTimeUtc: DateTime
- endTimeUtc: DateTime
- executionSuccessful: bool }
-
-type Run =
- { results: Result list
- tool: Tool
- invocations: Invocation list
- columnKind: string }
-
-type SarifLog =
- { schema: string
- version: string
- runs: Run list }
-
-module private Encoders =
- open Thoth.Json.Core
-
- let textEncoder: Encoder =
- fun (t: Text) -> Encode.object [ ("text", Encode.string t.text) ]
-
- let regionEncoder: Encoder =
- fun (r: Region) ->
- Encode.object
- [ ("startLine", Encode.int r.startLine)
- ("startColumn", Encode.int r.startColumn)
- ("endLine", Encode.int r.endLine)
- ("endColumn", Encode.int r.endColumn) ]
-
- let artifactLocationEncoder: Encoder =
- fun (al: ArtifactLocation) -> Encode.object [ ("uri", Encode.string al.uri) ]
-
- let physicalLocationEncoder: Encoder =
- fun (pl: PhysicalLocation) ->
- Encode.object
- [ ("artifactLocation", artifactLocationEncoder pl.artifactLocation)
- ("region", regionEncoder pl.region) ]
-
- let locationEncoder: Encoder =
- fun (l: Location) -> Encode.object [ ("physicalLocation", physicalLocationEncoder l.physicalLocation) ]
-
- let messageEncoder: Encoder =
- fun (m: Message) -> Encode.object [ ("text", Encode.string m.text) ]
-
- let resultEncoder: Encoder =
- fun (r: Result) ->
- Encode.object
- [ ("ruleId", Encode.string r.ruleId)
- ("ruleIndex", Encode.int r.ruleIndex)
- ("message", messageEncoder r.message)
- ("locations", List.map locationEncoder r.locations |> Encode.list) ]
-
- let ruleShortDescriptionEncoder: Encoder =
- fun (rsd: RuleShortDescription) ->
- Encode.object [ ("text", Encode.string rsd.text); ("markdown", Encode.string rsd.markdown) ]
-
- let ruleEncoder: Encoder =
- fun (r: Rule) ->
- Encode.object
- [ ("id", Encode.string r.id)
- ("name", Encode.string r.name)
- ("shortDescription", ruleShortDescriptionEncoder r.shortDescription)
- ("helpUri", Encode.string r.helpUri) ]
-
- let driverEncoder: Encoder =
- fun (d: Driver) ->
- Encode.object
- [ ("name", Encode.string d.name)
- ("version", Encode.string d.version)
- ("informationUri", Encode.string d.informationUri)
- ("rules",
- match d.rules with
- | None -> Encode.list []
- | Some rules -> List.map ruleEncoder rules |> Encode.list) ]
-
- let toolEncoder: Encoder =
- fun (t: Tool) -> Encode.object [ ("driver", driverEncoder t.driver) ]
-
- let invocationEncoder: Encoder =
- fun (i: Invocation) ->
- Encode.object
- [ ("startTimeUtc", Encode.string (i.startTimeUtc.ToString("o"))) // ISO 8601 format
- ("endTimeUtc", Encode.string (i.endTimeUtc.ToString("o")))
- ("executionSuccessful", Encode.bool i.executionSuccessful) ]
-
- let runEncoder: Encoder =
- fun (r: Run) ->
- Encode.object
- [ ("results", List.map resultEncoder r.results |> Encode.list)
- ("tool", toolEncoder r.tool)
- ("invocations", List.map invocationEncoder r.invocations |> Encode.list)
- ("columnKind", Encode.string r.columnKind) ]
-
- let sarifLogEncoder: Encoder =
- fun (log: SarifLog) ->
- Encode.object
- [ ("$schema", Encode.string log.schema)
- ("version", Encode.string log.version)
- ("runs", List.map runEncoder log.runs |> Encode.list) ]
-
-module private Decoders =
- open Thoth.Json.Core
-
- let textDecoder: Decoder =
- Decode.object (fun get -> { text = get.Required.Field "text" Decode.string })
-
- let regionDecoder: Decoder =
- Decode.object (fun get ->
- { startLine = get.Required.Field "startLine" Decode.int
- startColumn = get.Required.Field "startColumn" Decode.int
- endLine = get.Required.Field "endLine" Decode.int
- endColumn = get.Required.Field "endColumn" Decode.int })
-
- let artifactLocationDecoder: Decoder =
- Decode.object (fun get -> { uri = get.Required.Field "uri" Decode.string })
-
- let physicalLocationDecoder: Decoder =
- Decode.object (fun get ->
- { artifactLocation = get.Required.Field "artifactLocation" artifactLocationDecoder
- region = get.Required.Field "region" regionDecoder })
-
- let locationDecoder: Decoder =
- Decode.object (fun get -> { physicalLocation = get.Required.Field "physicalLocation" physicalLocationDecoder })
-
- let messageDecoder: Decoder =
- Decode.object (fun get -> { text = get.Required.Field "text" Decode.string })
-
- let resultDecoder: Decoder =
- Decode.object (fun get ->
- { ruleId = get.Required.Field "ruleId" Decode.string
- ruleIndex = get.Required.Field "ruleIndex" Decode.int
- message = get.Required.Field "message" messageDecoder
- locations = get.Required.Field "locations" (Decode.list locationDecoder) })
-
- let ruleShortDescriptionDecoder: Decoder =
- Decode.object (fun get ->
- { text = get.Required.Field "text" Decode.string
- markdown = get.Required.Field "markdown" Decode.string })
-
- let ruleDecoder: Decoder =
- Decode.object (fun get ->
- { id = get.Required.Field "id" Decode.string
- name = get.Required.Field "name" Decode.string
- shortDescription = get.Required.Field "shortDescription" ruleShortDescriptionDecoder
- helpUri = get.Required.Field "helpUri" Decode.string })
-
- let driverDecoder: Decoder =
- Decode.object (fun get ->
- { name = get.Required.Field "name" Decode.string
- version = get.Required.Field "version" Decode.string
- informationUri = get.Required.Field "informationUri" Decode.string
- rules = get.Optional.Field "rules" (Decode.list ruleDecoder) })
-
- let toolDecoder: Decoder =
- Decode.object (fun get -> { driver = get.Required.Field "driver" driverDecoder })
-
- let invocationDecoder: Decoder =
- Decode.object (fun get ->
- { startTimeUtc = get.Required.Field "startTimeUtc" Decode.datetimeUtc
- endTimeUtc = get.Required.Field "endTimeUtc" Decode.datetimeUtc
- executionSuccessful = get.Required.Field "executionSuccessful" Decode.bool })
-
- let runDecoder: Decoder =
- Decode.object (fun get ->
- { results = get.Required.Field "results" (Decode.list resultDecoder)
- tool = get.Required.Field "tool" toolDecoder
- invocations = get.Required.Field "invocations" (Decode.list invocationDecoder)
- columnKind = get.Required.Field "columnKind" Decode.string })
-
- let sarifLogDecoder: Decoder =
- Decode.object (fun get ->
- { schema = get.Required.Field "$schema" Decode.string
- version = get.Required.Field "version" Decode.string
- runs = get.Required.Field "runs" (Decode.list runDecoder) })
-
-let private readSarif (json: string) : Result =
- match Thoth.Json.Newtonsoft.Decode.fromString Decoders.sarifLogDecoder json with
- | Ok sarifLog -> Ok sarifLog
- | Error err -> Error($"Failed to decode, got %A{err}")
-
-let private writeSarif (sarifLog: SarifLog) : string =
- Encoders.sarifLogEncoder sarifLog |> Thoth.Json.Newtonsoft.Encode.toString 4
-
-let mergeSarifFiles _ =
- task {
- let mergedPath =
- Path.Combine(__SOURCE_DIRECTORY__, "analysisreports", "merged.sarif")
-
- if Path.Exists(mergedPath) then
- File.Delete(mergedPath)
-
- let! sarifFiles =
- Directory.GetFiles("analysisreports", "*.sarif")
- |> Seq.map (fun path ->
- task {
- let! sarifContent = File.ReadAllTextAsync(path)
- let sarifResult = readSarif sarifContent
-
- match sarifResult with
- | Error e ->
- eprintfn $"%A{e}"
- return exit 1
- | Ok sarif -> return path, sarif
- })
- |> Task.WhenAll
-
- if Array.isEmpty sarifFiles then
- printfn "No sarif files could be merged"
- else
- let firstSarif = snd sarifFiles.[0]
- let firstRun = firstSarif.runs.[0]
-
- let results = ResizeArray()
- let rules = ResizeArray()
-
- for _, sarif in sarifFiles do
- for run in sarif.runs do
- results.AddRange(run.results)
-
- match run.tool.driver.rules with
- | None -> ()
- | Some rulesList -> rules.AddRange(rulesList)
-
-
- let combined: SarifLog =
- {
- schema = firstSarif.schema
- version = firstSarif.version
- runs =
- [ { tool =
- { firstRun.tool with
- driver =
- { firstRun.tool.driver with
- rules = Some(List.ofSeq rules) } }
- invocations = firstRun.invocations
- columnKind = firstRun.columnKind
- results = List.ofSeq results } ] }
-
- sarifFiles |> Array.iter (fun (path, _) -> File.Delete(path))
-
- let mergedStream = File.OpenWrite("analysisreports/merged.sarif")
- let combinedJson = writeSarif combined
- do! mergedStream.WriteAsync(System.Text.Encoding.UTF8.GetBytes(combinedJson))
- do! mergedStream.FlushAsync()
- mergedStream.Close()
- printfn $"Successfully merged %d{sarifFiles.Length} SARIF files"
- }
diff --git a/src/Fantomas.Benchmarks/packages.lock.json b/src/Fantomas.Benchmarks/packages.lock.json
index cc618a9806..bad220a5b4 100644
--- a/src/Fantomas.Benchmarks/packages.lock.json
+++ b/src/Fantomas.Benchmarks/packages.lock.json
@@ -20,12 +20,6 @@
"System.Management": "5.0.0"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -34,15 +28,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"BenchmarkDotNet.Annotations": {
"type": "Transitive",
diff --git a/src/Fantomas.Client.Tests/packages.lock.json b/src/Fantomas.Client.Tests/packages.lock.json
index 6bbec117ff..962b7621bb 100644
--- a/src/Fantomas.Client.Tests/packages.lock.json
+++ b/src/Fantomas.Client.Tests/packages.lock.json
@@ -8,12 +8,6 @@
"resolved": "3.6.7",
"contentHash": "KYhA0OAGmNg22xI2OjkqG0zlgd61OCJOHYb+/uvSILriQNMQNmAjsRj7OqAh9dgltEuNpuPvN9+Y7pMBD/0NyQ=="
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -22,15 +16,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
diff --git a/src/Fantomas.Client/packages.lock.json b/src/Fantomas.Client/packages.lock.json
index 65f0ab5696..b8feabd258 100644
--- a/src/Fantomas.Client/packages.lock.json
+++ b/src/Fantomas.Client/packages.lock.json
@@ -14,12 +14,6 @@
"Microsoft.SourceLink.GitLab": "1.1.1"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -28,15 +22,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Ionide.KeepAChangelog.Tasks": {
"type": "Direct",
diff --git a/src/Fantomas.Core.Tests/packages.lock.json b/src/Fantomas.Core.Tests/packages.lock.json
index 50a2903a96..9d84872dfc 100644
--- a/src/Fantomas.Core.Tests/packages.lock.json
+++ b/src/Fantomas.Core.Tests/packages.lock.json
@@ -11,12 +11,6 @@
"FSharp.Core": "4.2.3"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -35,15 +29,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
diff --git a/src/Fantomas.Core/ASTTransformer.fs b/src/Fantomas.Core/ASTTransformer.fs
index 58450725c3..f7e48dad8d 100644
--- a/src/Fantomas.Core/ASTTransformer.fs
+++ b/src/Fantomas.Core/ASTTransformer.fs
@@ -2640,10 +2640,10 @@ let mkTypeDefn
let objectMembers =
objectMembers
- |> List.filter (function
- | SynMemberDefn.ImplicitCtor _ -> false
- | _ -> true)
- |> List.map (mkMemberDefn creationAide)
+ |> List.choose (fun md ->
+ match md with
+ | SynMemberDefn.ImplicitCtor _ -> None
+ | _ -> Some(mkMemberDefn creationAide md))
let endNode =
match range with
@@ -2685,15 +2685,15 @@ let mkTypeDefn
let allMembers =
let objectMembers =
objectMembers
- |> List.filter (function
- | SynMemberDefn.ImplicitCtor _ -> false
- | _ -> true)
- |> List.map (mkMemberDefn creationAide)
+ |> List.choose (fun md ->
+ match md with
+ | SynMemberDefn.ImplicitCtor _ -> None
+ | _ -> Some(mkMemberDefn creationAide md))
[ yield! objectMembers; yield! members ]
TypeDefnRegularNode(typeNameNode, allMembers, typeDefnRange) |> TypeDefn.Regular
- | _ -> failwithf "Could not create a TypeDefn for %A" typeRepr
+ | _ -> failwithf $"Could not create a TypeDefn for %A{typeRepr}"
let mkWithGetSet
(withKeyword: range option)
diff --git a/src/Fantomas.Core/Defines.fs b/src/Fantomas.Core/Defines.fs
index a74693d8d9..ded5ea1a3b 100644
--- a/src/Fantomas.Core/Defines.fs
+++ b/src/Fantomas.Core/Defines.fs
@@ -209,8 +209,7 @@ module private DefineCombinationSolver =
| Some((i, x), (j, y), r) ->
f (
(exprsIndexed
- |> Seq.filter (fun (k, _) -> i <> k && j <> k)
- |> Seq.map snd
+ |> Seq.choose (fun (k, xs) -> if i <> k && j <> k then Some(xs) else None)
|> Seq.toList)
@ [ IfDirectiveExpression.And(x, y), Some r ]
)
diff --git a/src/Fantomas.Core/packages.lock.json b/src/Fantomas.Core/packages.lock.json
index 423ac63843..b4e483a4a7 100644
--- a/src/Fantomas.Core/packages.lock.json
+++ b/src/Fantomas.Core/packages.lock.json
@@ -14,12 +14,6 @@
"Microsoft.SourceLink.GitLab": "1.1.1"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -28,15 +22,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Ionide.KeepAChangelog.Tasks": {
"type": "Direct",
diff --git a/src/Fantomas.FCS/packages.lock.json b/src/Fantomas.FCS/packages.lock.json
index 9482e407e7..5ca34ae224 100644
--- a/src/Fantomas.FCS/packages.lock.json
+++ b/src/Fantomas.FCS/packages.lock.json
@@ -14,12 +14,6 @@
"Microsoft.SourceLink.GitLab": "1.1.1"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -38,15 +32,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Ionide.KeepAChangelog.Tasks": {
"type": "Direct",
diff --git a/src/Fantomas.Tests/packages.lock.json b/src/Fantomas.Tests/packages.lock.json
index 7c8f686ebd..1786c3260a 100644
--- a/src/Fantomas.Tests/packages.lock.json
+++ b/src/Fantomas.Tests/packages.lock.json
@@ -11,12 +11,6 @@
"FSharp.Core": "4.2.3"
}
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -35,15 +29,15 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Microsoft.NET.Test.Sdk": {
"type": "Direct",
diff --git a/src/Fantomas/Format.fs b/src/Fantomas/Format.fs
index c0282b53af..25817e54b9 100644
--- a/src/Fantomas/Format.fs
+++ b/src/Fantomas/Format.fs
@@ -149,8 +149,11 @@ module Format =
async {
let! formatted =
filenames
- |> Seq.filter (IgnoreFile.isIgnoredFile (IgnoreFile.current.Force()) >> not)
- |> Seq.map (fun f -> formatFileInternalAsync (FormatParams.Create(true, false, f)))
+ |> Seq.choose (fun filename ->
+ if IgnoreFile.isIgnoredFile (IgnoreFile.current.Force()) filename then
+ None
+ else
+ Some(formatFileInternalAsync (FormatParams.Create(true, false, filename))))
|> Async.Parallel
let getChangedFile =
diff --git a/src/Fantomas/packages.lock.json b/src/Fantomas/packages.lock.json
index a69893af5b..723d73c623 100644
--- a/src/Fantomas/packages.lock.json
+++ b/src/Fantomas/packages.lock.json
@@ -30,12 +30,6 @@
"resolved": "0.15.0",
"contentHash": "NuUxFbycSCOhl0WzmNZ8ksSMrTHBFzTASkil+IOqXpqTXszokKjy6ihxMdjArGaC+AaLLq4nxfGVFLi6KWyFJg=="
},
- "FSharp.Analyzers.Build": {
- "type": "Direct",
- "requested": "[0.3.0, )",
- "resolved": "0.3.0",
- "contentHash": "twj4mNJLOEjHK6OQJCAbix2d8ODG5RySASejQ/v2fLgoqyRqYsXmceFaXb17ZE1pNrfenjwv/xpR+GembufaZA=="
- },
"FSharp.Core": {
"type": "Direct",
"requested": "[8.0.100, )",
@@ -44,9 +38,9 @@
},
"G-Research.FSharp.Analyzers": {
"type": "Direct",
- "requested": "[0.9.3, )",
- "resolved": "0.9.3",
- "contentHash": "V83sHl7ubgQ9HLjxto/rZbgNKGMMpHZ+E6tmWm1JAGfpNUaYWnKdAkpdKxxooHmE/804pIAPuVTpna5xLeX1dw=="
+ "requested": "[0.18.0, )",
+ "resolved": "0.18.0",
+ "contentHash": "axpIIOMOHUK/GS1s1q4thDTfcZxBVaQryPFDAURPX78TTLqHPF83USUgI4yM2cvIo+ZA7+c5SUWtkVXKkedlVQ=="
},
"Ignore": {
"type": "Direct",
@@ -56,9 +50,9 @@
},
"Ionide.Analyzers": {
"type": "Direct",
- "requested": "[0.9.0, )",
- "resolved": "0.9.0",
- "contentHash": "yCJHdPHJef/Yl7iPED8lRoxPjM1HXx1tielT7lp40FxOKURiLGziyhxfZqbo4WTYVKdSxOJv3+s2+ArJYuirvg=="
+ "requested": "[0.14.7, )",
+ "resolved": "0.14.7",
+ "contentHash": "xjYTHbb/aP6QPD9rJOZNJW3YN7KAegWAy42N61A9m7BVMspaSNEX8Y57Cey9ySWCrjvEaXKAnzVuyL9N3zZVLA=="
},
"Ionide.KeepAChangelog.Tasks": {
"type": "Direct",