Skip to content

Commit

Permalink
chore: Disable fsharplint temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
vipentti committed Dec 1, 2024
1 parent 073d3e0 commit 51ab027
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 23 deletions.
2 changes: 0 additions & 2 deletions .nuke/build.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,11 @@
"enum": [
"CheckCsharpier",
"CheckFantomas",
"CheckFSharpLint",
"Compile",
"FormatCsharpier",
"FormatFantomas",
"InstallCsharpier",
"InstallFantomas",
"InstallFSharpLint",
"InstallLinters",
"Lint",
"Pack",
Expand Down
31 changes: 19 additions & 12 deletions build/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using Nuke.Common;
using Nuke.Common.CI.GitHubActions;
using Nuke.Common.Execution;
Expand Down Expand Up @@ -38,7 +37,7 @@ class Build :
NukeBuild,
IUseCsharpier,
IUseFantomas,
IUseFSharpLint,
//IUseFSharpLint,
IUseCustomLinters,
IHazSolution,
ITest,
Expand Down Expand Up @@ -70,20 +69,20 @@ public T From<T>()

bool IUseCsharpier.UseGlobalTool => false;
bool IUseFantomas.UseGlobalTool => false;
bool IUseFSharpLint.UseGlobalTool => false;
//bool IUseFSharpLint.UseGlobalTool => false;

IEnumerable<AbsolutePath> IUseFantomas.DirectoriesToFormat => new[]
{
IEnumerable<AbsolutePath> IUseFantomas.DirectoriesToFormat =>
[
RootDirectory / "src",
RootDirectory / "tests",
};
];

IEnumerable<IProvideLinter> IUseCustomLinters.Linters => new IProvideLinter[]
{
IEnumerable<IProvideLinter> IUseCustomLinters.Linters =>
[
From<IUseCsharpier>().Linter,
From<IUseFantomas>().Linter,
From<IUseFSharpLint>().Linter,
};
//From<IUseFSharpLint>().Linter,
];

// csharpier-ignore
public Target RestoreTools => _ => _
Expand Down Expand Up @@ -297,7 +296,10 @@ public interface IUseFSharpLint : INukeBuild, IHazSolution
{
bool UseGlobalTool { get; }

IEnumerable<AbsolutePath> FilesToFormat => new[] { Solution.Path };
IEnumerable<AbsolutePath> FilesToFormat => Solution
.AllProjects
.Where(it => it.Path.Extension.Contains("fsproj"))
.Select(it => it.Path);

// csharpier-ignore
Target CheckFSharpLint => _ => _
Expand Down Expand Up @@ -330,7 +332,12 @@ void RunFormat(AbsolutePath path)
{
DotNet(
arguments: toolname + $" lint {path}",
logInvocation: true
logInvocation: true,
environmentVariables: new Dictionary<string, string>
{
// https://github.com/fsprojects/FSharpLint/issues/687
["DOTNET_ROLL_FORWARD"] = "latestMajor",
}
);
}
}
Expand Down
4 changes: 2 additions & 2 deletions build/_build.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Nuke.Common" Version="9.0.1" />
<PackageReference Include="Nuke.Components" Version="9.0.1" />
<PackageReference Include="Nuke.Common" Version="8.1.4" />
<PackageReference Include="Nuke.Components" Version="8.1.4" />
<PackageReference Include="Vipentti.Nuke.Components" Version="0.5.2" />
</ItemGroup>

Expand Down
12 changes: 12 additions & 0 deletions src/Visp.Cli/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"profiles": {
"Visp.Cli": {
"commandName": "Project"
},
"Debug.Cli": {
"commandName": "Project",
"commandLineArgs": ".\\visp\\tests\\include\\include-macros-0.visp --debug-tokens",
"workingDirectory": "$(SolutionDir)"
}
}
}
17 changes: 10 additions & 7 deletions src/Visp.Compiler/ParseUtils.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ open System.Collections.Generic

type NestedTokenizer =
{ mutable index: int
tokens: IReadOnlyList<token>
}
tokens: IReadOnlyList<token> }

member t.ReadNext() =
if t.index < t.tokens.Count then
Expand All @@ -32,6 +31,7 @@ let rec mkTokenizerWithArgs args =

let handle_next (args: LexArgs) next =
let mutable actual = next

match next with
| QUOTE_SYM -> args.mode <- LexMode.TokenStream TokenStreamMode.QuoteSym
| QUOTE_KW -> // args.mode <- LexMode.TokenStream TokenStreamMode.Quote
Expand Down Expand Up @@ -124,16 +124,15 @@ let rec mkTokenizerWithArgs args =
let mutable token_list = []
let mutable include_tokenizers: NestedTokenizer list = []

let read_next_nested_token () =
let read_next_nested_token () =
match include_tokenizers with
| [] -> None
| it :: rest ->
match it.ReadNext() with
| None ->
include_tokenizers <- rest
None
| Some (tok) ->
Some(tok)
| Some(tok) -> Some(tok)

let read_next_token_list_token buf =
match token_list with
Expand Down Expand Up @@ -166,11 +165,13 @@ let rec mkTokenizerWithArgs args =

while loop do
let next = next_token buf

match next with
| STRING (it, _ ,_) ->
| STRING(it, _, _) ->
includes <- it :: includes
()
| _ -> ()

loop <- next <> RPAREN
()
// includes <- List.rev includes
Expand All @@ -184,6 +185,7 @@ let rec mkTokenizerWithArgs args =
let tokz = getNestedTokens buf.EndPos.FileName it false
include_tokenizers <- tokz :: include_tokenizers
includes <- rest

()

// Includes will not be part of the final parse result
Expand Down Expand Up @@ -211,10 +213,11 @@ and private getNestedTokens rootFile filePath dbg =

while not lexbuf.IsPastEndOfStream do
let next = tokenizer lexbuf

if next <> EOF then
arr.Add(next)

{ tokens = arr; index = 0}
{ tokens = arr; index = 0 }

and mkTokenizer dbg =
mkTokenizerWithArgs
Expand Down

0 comments on commit 51ab027

Please sign in to comment.