From eb0fd5fe7c28639c1a6c467a876b1694738ed110 Mon Sep 17 00:00:00 2001 From: parham saremi <45370204+parhamsaremi@users.noreply.github.com> Date: Thu, 24 Nov 2022 20:16:00 +0330 Subject: [PATCH] FSharpLint: upgrade to latest version 0.21.3 (#53) Enabling FavourStaticEmptyFields rule (new in this version). --- .github/workflows/ci.yml | 2 +- NOnion/Cells/CellAuthChallenge.fs | 2 +- NOnion/Http/TorHttpClient.fs | 6 +++--- NOnion/Utility/Base32Util.fs | 8 ++++++-- fsharplint.json | 1 + 5 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8be4b1cd..2dfec2a6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,7 +40,7 @@ jobs: run: dotnet build --configuration Release --no-restore - name: fsharpLint run: | - dotnet tool install --global dotnet-fsharplint --version 0.21.2 + dotnet tool install --global dotnet-fsharplint --version 0.21.3 # path taken from https://stackoverflow.com/a/65367006/544947 $HOME/.dotnet/tools/dotnet-fsharplint lint NOnion.sln diff --git a/NOnion/Cells/CellAuthChallenge.fs b/NOnion/Cells/CellAuthChallenge.fs index a3c54c36..a232c7fc 100644 --- a/NOnion/Cells/CellAuthChallenge.fs +++ b/NOnion/Cells/CellAuthChallenge.fs @@ -25,7 +25,7 @@ type CellAuthChallenge = let challenge = reader.ReadBytes Constants.ChallangeLength let methodsCount = ReadBigEndianUInt16 reader |> int - let methods = readMethod [] methodsCount + let methods = readMethod List.Empty methodsCount { Challenge = challenge diff --git a/NOnion/Http/TorHttpClient.fs b/NOnion/Http/TorHttpClient.fs index d5e83914..e863ab00 100644 --- a/NOnion/Http/TorHttpClient.fs +++ b/NOnion/Http/TorHttpClient.fs @@ -40,7 +40,7 @@ type TorHttpClient(stream: TorStream, host: string) = "Accept-Encoding", supportedCompressionAlgorithms ] |> List.map(fun (k, v) -> sprintf "%s: %s\r\n" k v) - |> String.concat "" + |> String.concat String.Empty do! sprintf "GET %s HTTP/1.0\r\n%s\r\n" path headers @@ -134,7 +134,7 @@ type TorHttpClient(stream: TorStream, host: string) = "Content-Length", payload.Length.ToString() ] |> List.map(fun (k, v) -> sprintf "%s: %s\r\n" k v) - |> String.concat "" + |> String.concat String.Empty do! sprintf "POST %s HTTP/1.0\r\n%s\r\n%s" path headers payload @@ -187,7 +187,7 @@ type TorHttpClient(stream: TorStream, host: string) = |> Map.ofArray match headersMap.TryGetValue "Content-Encoding" with - | false, _ when body.Length = 0 -> return "" + | false, _ when body.Length = 0 -> return String.Empty | false, _ -> return failwith "PostString: Content-Encoding header is missing" | true, "identity" -> return body |> Encoding.UTF8.GetString diff --git a/NOnion/Utility/Base32Util.fs b/NOnion/Utility/Base32Util.fs index 2cb496a7..f7d07c45 100644 --- a/NOnion/Utility/Base32Util.fs +++ b/NOnion/Utility/Base32Util.fs @@ -96,7 +96,11 @@ module Base32Util = | x0 :: [] -> result @ quintupletToList 1 (x0, 0uy, 0uy, 0uy, 0uy) | [] -> result - data |> Array.toList |> parse [] |> List.toArray |> System.String.Concat + data + |> Array.toList + |> parse List.Empty + |> List.toArray + |> System.String.Concat /// Decodes a Base32 string to a UTF8 string let DecodeBase32 text = @@ -163,4 +167,4 @@ module Base32Util = tail | _ -> result - [ for c in text -> c ] |> parse [] |> List.toArray + [ for c in text -> c ] |> parse List.Empty |> List.toArray diff --git a/fsharplint.json b/fsharplint.json index 4de8cdfd..a1cd3b24 100644 --- a/fsharplint.json +++ b/fsharplint.json @@ -267,6 +267,7 @@ "tupleOfWildcards": { "enabled": true }, "favourTypedIgnore": { "enabled": true }, "favourReRaise": { "enabled": true }, + "favourStaticEmptyFields": { "enabled": true }, "favourConsistentThis": { "enabled": true, "config": {