G-Research / fsharp-analyzers

Analyzers for F#
https://g-research.github.io/fsharp-analyzers/
Apache License 2.0
14 stars 1 forks source link

Support request: unexpected new analyzer failure when no relevant change was made #82

Closed Smaug123 closed 7 months ago

Smaug123 commented 7 months ago

Hi - I've got a new analyser failure on https://github.com/Smaug123/fsharp-prattparser/pull/9 which is a change completely unrelated to the analysers. I can't reproduce it locally on macOS. The failing run is https://github.com/Smaug123/fsharp-prattparser/actions/runs/8123334984/job/22203652378?pr=9#step:4:1 and the preceding successful run (two weeks ago) was https://github.com/Smaug123/fsharp-prattparser/actions/runs/7965613558/job/21745483323 .

Do your eyes see what might be going wrong here? The .NET SDK and fsharp-analyzers are both binary-identical between the two runs (as validated by Nix); I haven't validated that the version of G-Research.FSharp.Analyzers is binary-identical.

nojaf commented 7 months ago

Hi Patrick, thanks for reaching out! I was able to run the analyzers locally on my Windows machine.

One thing I'm not entirely sure is if we support wildcards in --analyzers-path ./.analyzerpackages/g-research.fsharp.analyzers/*/

https://github.com/ionide/FSharp.Analyzers.SDK/blob/0719b7296843dc552e68bf6143d565227f2c1b33/src/FSharp.Analyzers.Cli/Program.fs#L543-L554

The aborted output text does make me wonder if type-checking succeeded:

https://github.com/ionide/FSharp.Analyzers.SDK/blob/25ab689f9285a81ff1c782e9ac62abed0eab785c/src/FSharp.Analyzers.SDK/FSharp.Analyzers.SDK.fs#L252

I don't quite see any good reason it shouldn't. Would you mind re-running that build sometime? I'm curious if the behaviour is consistent or not.

Smaug123 commented 7 months ago

The wildcard should be interpreted by the shell, and the analysers should never even see it. (I'll verify that when I get home.) The error is consistent in the sense that I have several open PRs on that repo, all failing in the same way. Note that the analysers are the only failing step; in particular the dotnet build ran successfully in another step.

Actually now you mention it I can boot my Macbook into NixOS and get a testing environment that's pretty close to what the Action is running. I'll do that tonight.

Smaug123 commented 7 months ago

Yeah, I'm confident the * was interpreted by the shell as a glob and was expanded before fsharp-analyzers got to see it:

Loading analyzers from /home/runner/work/fsharp-prattparser/fsharp-prattparser/.analyzerpackages/g-research.fsharp.analyzers/0.9.3/

Smaug123 commented 7 months ago

Huh. When I added the .NET SDK to $PATH before running the analysers, it worked. I have no idea what changed underneath me, because it used to work fine without that, but that seems to reliably fix the problem. (Before that fix, the analysers reliably failed.)

nojaf commented 7 months ago

Hmm, this could explain why the design time build failed and thus type-checking no longer worked. I'm happy you found a solution. Was running out of ideas 😌.