-
Notifications
You must be signed in to change notification settings - Fork 73
Add LintFile method to API layer #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
MrLuje
wants to merge
33
commits into
fsprojects:master
Choose a base branch
from
MrLuje:lint_layer
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
3662671
add FSharpLint.Client project
MrLuje b6f41e4
add client tests
MrLuje 17de4f9
cleanup TestDaemonVersion
MrLuje d44a4da
update README.md
MrLuje e2c1746
remove reference from FSharpLint.Client to FSharpLint.Core (which inc…
MrLuje 0e3e18a
test: ensure FCS is not referenced by FSharpLint.Client
MrLuje 53848f1
add FSHARPLINT_SEARCH_PATH_OVERRIDE env var to override search location
MrLuje 85f2e75
PR feedback: -g -> --global
MrLuje 24f10c1
PR feedback: simplify DOTNET_CLI_UI_LANGUAGE env var usage
MrLuje e5972aa
PR feedback: clearer FSharpLintResponseCode
MrLuje a87b8a9
PR feedback: Folder check
MrLuje a3411da
PR feedback: UnexpectedException
MrLuje ed5370b
PR feedback: comment about Path.GetFullPath
MrLuje 65235ca
PR feedback: Path.GetFullPath readability
MrLuje 82f9428
PR feedback: reuse DirectoryInfo instance
MrLuje 95b7e06
Сlient: introduce File type
webwarrior-ws c80d4bd
FL0084
MrLuje db1578f
FL0043
MrLuje 9306567
FL0055
MrLuje 523e820
fix more rules
MrLuje e84ffc6
PR feedback: Folder FromFile/FromFolder
MrLuje c1fb125
WIP: remove disable-next-line RedundantNewKeyword
Mersho bb70e3c
fix more rules
MrLuje e88fa66
WIP lint
MrLuje 7723ddb
more tests
MrLuje 536b647
ignore LintError test
MrLuje 7fed644
test: more Lint call properties
MrLuje 62bd221
WIP test
MrLuje 675aa23
fix cancellationtoken
MrLuje 1f2b989
fix: daemon cache
MrLuje c423e9b
TODO WIP
MrLuje 04311c8
rebase from api_lint_version (IFSharpLintService)
MrLuje aefbd71
TO REMOVE
MrLuje File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| module FSharpLint.Client.Contracts | ||
|
|
||
| open System | ||
| open System.Threading | ||
| open System.Threading.Tasks | ||
|
|
||
| [<RequireQualifiedAccess>] | ||
| module Methods = | ||
| [<Literal>] | ||
| let Version = "fsharplint/version" | ||
|
|
||
| [<Literal>] | ||
| let LintFile = "fsharplint/lintfile" | ||
|
|
||
| type VersionRequest = | ||
| { | ||
| FilePath: string | ||
| } | ||
|
|
||
| type LintFileRequest = | ||
| { | ||
| FilePath: string | ||
| LintConfigPath: string option | ||
| } | ||
|
|
||
| type ClientRange = | ||
| class | ||
| val StartLine: int | ||
| val StartColumn: int | ||
| val EndLine: int | ||
| val EndColumn: int | ||
| new(startLine: int, startColumn: int, endLine: int, endColumn: int) = | ||
| { StartLine = startLine | ||
| StartColumn = startColumn | ||
| EndLine = endLine | ||
| EndColumn = endColumn } | ||
| end | ||
|
|
||
| type ClientSuggestedFix = { | ||
| /// Text to be replaced. | ||
| FromText:string | ||
|
|
||
| /// Location of the text to be replaced. | ||
| FromRange:ClientRange | ||
|
|
||
| /// Text to replace the `FromText`, i.e. the fix. | ||
| ToText:string | ||
| } | ||
|
|
||
| [<NoEquality; NoComparison>] | ||
| type ClientWarningDetails = { | ||
| /// Location of the code that prompted the suggestion. | ||
| Range:ClientRange | ||
|
|
||
| /// Suggestion message to describe the possible problem to the user. | ||
| Message:string | ||
|
|
||
| /// Information to provide an automated fix. | ||
| SuggestedFix:ClientSuggestedFix option | ||
| } | ||
|
|
||
| /// A lint "warning", sources the location of the warning with a suggestion on how it may be fixed. | ||
| [<NoEquality; NoComparison>] | ||
| type ClientLintWarning = { | ||
| /// Unique identifier for the rule that caused the warning. | ||
| RuleIdentifier:string | ||
|
|
||
| /// Unique name for the rule that caused the warning. | ||
| RuleName:string | ||
|
|
||
| /// Path to the file where the error occurs. | ||
| FilePath:string | ||
|
|
||
| /// Text that caused the error (the `Range` of the content of `FileName`). | ||
| ErrorText:string | ||
|
|
||
| /// Details for the warning. | ||
| Details:ClientWarningDetails | ||
| } | ||
|
|
||
| type FSharpLintResult = | ||
| | Content of string | ||
| | LintResult of ClientLintWarning list | ||
|
|
||
| type FSharpLintResponse = { | ||
| Code: int | ||
| FilePath: string | ||
| Result : FSharpLintResult | ||
| } | ||
|
|
||
| type IFSharpLintService = | ||
| interface | ||
| inherit IDisposable | ||
|
|
||
| abstract member VersionAsync: VersionRequest * ?cancellationToken: CancellationToken -> Task<FSharpLintResponse> | ||
| abstract member LintFileAsync: LintFileRequest * ?cancellationToken: CancellationToken -> Task<FSharpLintResponse> | ||
| end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| module FSharpLint.Client.Contracts | ||
|
|
||
| open System.Threading | ||
| open System.Threading.Tasks | ||
|
|
||
| module Methods = | ||
|
|
||
| [<Literal>] | ||
| val Version: string = "fsharplint/version" | ||
|
|
||
| [<Literal>] | ||
| val LintFile: string = "fsharplint/lintfile" | ||
|
|
||
| type VersionRequest = | ||
| { | ||
| FilePath: string | ||
| } | ||
|
|
||
| type LintFileRequest = | ||
| { | ||
| FilePath: string | ||
| LintConfigPath: string option | ||
| } | ||
|
|
||
|
|
||
| type ClientRange = | ||
| class | ||
| new: startLine: int * startColumn: int * endLine: int * endColumn: int -> ClientRange | ||
| val StartLine: int | ||
| val StartColumn: int | ||
| val EndLine: int | ||
| val EndColumn: int | ||
| end | ||
|
|
||
| type ClientSuggestedFix = { | ||
| /// Text to be replaced. | ||
| FromText:string | ||
|
|
||
| /// Location of the text to be replaced. | ||
| FromRange:ClientRange | ||
|
|
||
| /// Text to replace the `FromText`, i.e. the fix. | ||
| ToText:string | ||
| } | ||
|
|
||
| [<NoEquality; NoComparison>] | ||
| type ClientWarningDetails = { | ||
| /// Location of the code that prompted the suggestion. | ||
| Range:ClientRange | ||
|
|
||
| /// Suggestion message to describe the possible problem to the user. | ||
| Message:string | ||
|
|
||
| /// Information to provide an automated fix. | ||
| SuggestedFix:ClientSuggestedFix option | ||
| } | ||
|
|
||
| /// A lint "warning", sources the location of the warning with a suggestion on how it may be fixed. | ||
| [<NoEquality; NoComparison>] | ||
| type ClientLintWarning = { | ||
| /// Unique identifier for the rule that caused the warning. | ||
| RuleIdentifier:string | ||
|
|
||
| /// Unique name for the rule that caused the warning. | ||
| RuleName:string | ||
|
|
||
| /// Path to the file where the error occurs. | ||
| FilePath:string | ||
|
|
||
| /// Text that caused the error (the `Range` of the content of `FileName`). | ||
| ErrorText:string | ||
|
|
||
| /// Details for the warning. | ||
| Details:ClientWarningDetails | ||
| } | ||
|
|
||
| type FSharpLintResult = | ||
| | Content of string | ||
| | LintResult of ClientLintWarning list | ||
|
|
||
| type FSharpLintResponse = { | ||
| Code: int | ||
| FilePath: string | ||
| Result : FSharpLintResult | ||
| } | ||
|
|
||
| type IFSharpLintService = | ||
| inherit System.IDisposable | ||
|
|
||
| abstract VersionAsync: VersionRequest * ?cancellationToken: CancellationToken -> Task<FSharpLintResponse> | ||
| abstract LintFileAsync: LintFileRequest * ?cancellationToken: CancellationToken -> Task<FSharpLintResponse> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| <Project Sdk="Microsoft.NET.Sdk"> | ||
|
|
||
| <PropertyGroup> | ||
| <TargetFrameworks>net9.0;net8.0</TargetFrameworks> | ||
| <GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
| <IsPackable>true</IsPackable> | ||
| <RootNamespace>FSharpLint.Client</RootNamespace> | ||
| <EnableDefaultItems>false</EnableDefaultItems> | ||
| <Title>FSharpLint.Client</Title> | ||
| <Description>Companion library to format using FSharpLint tool.</Description> | ||
| <PackageTags>F#;fsharp;lint;FSharpLint;fslint;api</PackageTags> | ||
| </PropertyGroup> | ||
|
|
||
| <ItemGroup> | ||
| <Compile Include="Contracts.fsi" /> | ||
| <Compile Include="Contracts.fs" /> | ||
| <Compile Include="LSPFSharpLintServiceTypes.fsi" /> | ||
| <Compile Include="LSPFSharpLintServiceTypes.fs" /> | ||
| <Compile Include="FSharpLintToolLocator.fsi" /> | ||
| <Compile Include="FSharpLintToolLocator.fs" /> | ||
| <Compile Include="LSPFSharpLintService.fsi" /> | ||
| <Compile Include="LSPFSharpLintService.fs" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <ProjectReference Include="..\FSharpLint.Core\FSharpLint.Core.fsproj" /> | ||
| </ItemGroup> | ||
|
|
||
| <ItemGroup> | ||
| <PackageReference Include="FSharp.Core" /> | ||
| <PackageReference Include="SemanticVersioning" /> | ||
| <PackageReference Include="StreamJsonRpc" /> | ||
| <PackageReference Include="System.Text.Json" /> | ||
| </ItemGroup> | ||
|
|
||
| </Project> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrLuje let's reenable this now?