Skip to content

Commit 798b699

Browse files
committed
fix more rules
1 parent 2da5c06 commit 798b699

File tree

9 files changed

+22
-16
lines changed

9 files changed

+22
-16
lines changed

src/FSharpLint.Client/Contracts.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ type FSharpLintResponse = {
2323
Result : FSharpLintResult
2424
}
2525

26-
type FSharpLintService =
26+
type IFSharpLintService =
2727
interface
2828
inherit IDisposable
2929

src/FSharpLint.Client/Contracts.fsi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ type FSharpLintResponse = {
2222
Result : FSharpLintResult
2323
}
2424

25-
type FSharpLintService =
25+
type IFSharpLintService =
2626
inherit System.IDisposable
2727

2828
abstract VersionAsync: VersionRequest * ?cancellationToken: CancellationToken -> Task<FSharpLintResponse>

src/FSharpLint.Client/FSharpLintToolLocator.fs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ let private startProcess (ps: ProcessStartInfo) : Result<Process, ProcessStartEr
5858

5959
let private runToolListCmd (workingDir: Folder) (globalFlag: bool) : Result<string list, DotNetToolListError> =
6060
let ps = ProcessStartInfo("dotnet")
61-
ps.WorkingDirectory <- Folder.unwrap workingDir
61+
ps.WorkingDirectory <- Folder.Unwrap workingDir
6262
ps.EnvironmentVariables.["DOTNET_CLI_UI_LANGUAGE"] <- "en-us" //ensure we have predictible output for parsing
6363

6464
let toolArguments =
@@ -198,7 +198,7 @@ let createFor (startInfo: FSharpLintToolStartInfo) : Result<RunningFSharpLintToo
198198
| FSharpLintToolStartInfo.LocalTool(workingDirectory: Folder) ->
199199
ProcessStartInfo(
200200
FileName = "dotnet",
201-
WorkingDirectory = Folder.unwrap workingDirectory,
201+
WorkingDirectory = Folder.Unwrap workingDirectory,
202202
Arguments = $"{FSharpLintToolName} --daemon")
203203
| FSharpLintToolStartInfo.GlobalTool ->
204204
let userProfile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile)
@@ -223,9 +223,12 @@ let createFor (startInfo: FSharpLintToolStartInfo) : Result<RunningFSharpLintToo
223223

224224
match startProcess processStart with
225225
| Ok daemonProcess ->
226+
// fsharplint:disable-next-line RedundantNewKeyword
226227
let handler = new HeaderDelimitedMessageHandler(
227228
daemonProcess.StandardInput.BaseStream,
228229
daemonProcess.StandardOutput.BaseStream)
230+
231+
// fsharplint:disable-next-line RedundantNewKeyword
229232
let client = new JsonRpc(handler)
230233

231234
do client.StartListening()

src/FSharpLint.Client/LSPFSharpLintService.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ let private getFolderFor filePath (): Result<Folder, FSharpLintServiceError> =
150150
let handleFile filePath =
151151
if not (isPathAbsolute filePath) then
152152
Error FSharpLintServiceError.FilePathIsNotAbsolute
153-
else match Folder.from filePath with
153+
else match Folder.From filePath with
154154
| None -> Error FSharpLintServiceError.FileDoesNotExist
155155
| Some folder -> Ok folder
156156

@@ -236,7 +236,7 @@ type LSPFSharpLintService() =
236236
let cts = new CancellationTokenSource()
237237
let agent = createAgent cts.Token
238238

239-
interface FSharpLintService with
239+
interface IFSharpLintService with
240240
member this.Dispose() =
241241
if not cts.IsCancellationRequested then
242242
agent.PostAndReply Reset |> ignore
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module FSharpLint.Client.LSPFSharpLintService
22

33
type LSPFSharpLintService =
4-
interface Contracts.FSharpLintService
4+
interface Contracts.IFSharpLintService
55

66
new: unit -> LSPFSharpLintService

src/FSharpLint.Client/LSPFSharpLintServiceTypes.fs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ type FSharpLintVersion = FSharpLintVersion of string
2727
type FSharpLintExecutableFile = FSharpLintExecutableFile of File
2828
type Folder = private Folder of string
2929
with
30-
static member from (filePath: string) =
30+
static member From (filePath: string) =
3131
if File.Exists(filePath) then
3232
// Path.GetFullPath to resolve path like /foo/bar/../baz
3333
let folder = ((filePath |> Path.GetFullPath |> FileInfo).Directory)
@@ -37,7 +37,7 @@ with
3737
None
3838
else
3939
None
40-
static member unwrap(Folder f) = f
40+
static member Unwrap(Folder f) = f
4141

4242
[<RequireQualifiedAccess>]
4343
type FSharpLintToolStartInfo =

src/FSharpLint.Client/LSPFSharpLintServiceTypes.fsi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ type FSharpLintExecutableFile = FSharpLintExecutableFile of File
1919

2020
type Folder = private Folder of string
2121
with
22-
static member from: string -> Folder option
23-
static member unwrap: Folder -> string
22+
static member From: string -> Folder option
23+
static member Unwrap: Folder -> string
2424

2525
[<RequireQualifiedAccess>]
2626
type FSharpLintToolStartInfo =

src/FSharpLint.Console/Program.fs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ let private start (arguments:ParseResults<ToolArgs>) (toolsPath:Ionide.ProjInfo.
9292
()
9393

9494
if arguments.Contains ToolArgs.Daemon then
95+
// fsharplint:disable-next-line RedundantNewKeyword
9596
let daemon = new FSharpLintDaemon(Console.OpenStandardOutput(), Console.OpenStandardInput())
9697
AppDomain.CurrentDomain.ProcessExit.Add(fun _ -> (daemon :> IDisposable).Dispose())
9798

tests/FSharpLint.Client.Tests/TestClient.fs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ open Contracts
77
open LSPFSharpLintService
88
open LSPFSharpLintServiceTypes
99

10+
// fsharplint:disable RedundantNewKeyword
11+
1012
let (</>) x y = Path.Combine(x, y)
1113

1214
let basePath = TestContext.CurrentContext.TestDirectory </> ".." </> ".." </> ".." </> ".." </> ".."
@@ -37,7 +39,7 @@ type ToolLocationOverride(toolStatus: ToolStatus) =
3739
if File.Exists tempFolder then
3840
File.Delete tempFolder
3941

40-
let runVersionCall filePath (service: FSharpLintService) =
42+
let runVersionCall filePath (service: IFSharpLintService) =
4143
async {
4244
let request =
4345
{
@@ -53,7 +55,7 @@ let TestDaemonNotFound() =
5355
using (new ToolLocationOverride(ToolStatus.NotAvailable)) <| fun _ ->
5456

5557
let testHintsFile = basePath </> "tests" </> "FSharpLint.FunctionalTest.TestedProject" </> "FSharpLint.FunctionalTest.TestedProject.NetCore" </> "TestHints.fs"
56-
let fsharpLintService: FSharpLintService = new LSPFSharpLintService() :> FSharpLintService
58+
let fsharpLintService: IFSharpLintService = new LSPFSharpLintService() :> IFSharpLintService
5759
let versionResponse = runVersionCall testHintsFile fsharpLintService
5860

5961
Assert.AreEqual(LanguagePrimitives.EnumToValue FSharpLintResponseCode.ErrToolNotFound, versionResponse.Code)
@@ -63,7 +65,7 @@ let TestDaemonVersion() =
6365
using (new ToolLocationOverride(ToolStatus.Available)) <| fun _ ->
6466

6567
let testHintsFile = basePath </> "tests" </> "FSharpLint.FunctionalTest.TestedProject" </> "FSharpLint.FunctionalTest.TestedProject.NetCore" </> "TestHints.fs"
66-
let fsharpLintService: FSharpLintService = new LSPFSharpLintService() :> FSharpLintService
68+
let fsharpLintService: IFSharpLintService = new LSPFSharpLintService() :> IFSharpLintService
6769
let versionResponse = runVersionCall testHintsFile fsharpLintService
6870

6971
match versionResponse.Result with
@@ -77,7 +79,7 @@ let TestFilePathShouldBeAbsolute() =
7779
using (new ToolLocationOverride(ToolStatus.Available)) <| fun _ ->
7880

7981
let testHintsFile = ".." </> "tests" </> "FSharpLint.FunctionalTest.TestedProject" </> "FSharpLint.FunctionalTest.TestedProject.NetCore" </> "TestHints.fs"
80-
let fsharpLintService: FSharpLintService = new LSPFSharpLintService() :> FSharpLintService
82+
let fsharpLintService: IFSharpLintService = new LSPFSharpLintService() :> IFSharpLintService
8183
let versionResponse = runVersionCall testHintsFile fsharpLintService
8284

8385
Assert.AreEqual(LanguagePrimitives.EnumToValue FSharpLintResponseCode.ErrFilePathIsNotAbsolute, versionResponse.Code)
@@ -87,7 +89,7 @@ let TestFileShouldExists() =
8789
using (new ToolLocationOverride(ToolStatus.Available)) <| fun _ ->
8890

8991
let testHintsFile = basePath </> "tests" </> "FSharpLint.FunctionalTest.TestedProject" </> "FSharpLint.FunctionalTest.TestedProject.NetCore" </> "TestHintsOOOPS.fs"
90-
let fsharpLintService: FSharpLintService = new LSPFSharpLintService() :> FSharpLintService
92+
let fsharpLintService: IFSharpLintService = new LSPFSharpLintService() :> IFSharpLintService
9193
let versionResponse = runVersionCall testHintsFile fsharpLintService
9294

9395
Assert.AreEqual(LanguagePrimitives.EnumToValue FSharpLintResponseCode.ErrFileNotFound, versionResponse.Code)

0 commit comments

Comments
 (0)