FSharpLint icon indicating copy to clipboard operation
FSharpLint copied to clipboard

Add NoAsyncRunSynchronouslyInLibrary rule

Open webwarrior-ws opened this issue 3 months ago • 6 comments

Added new NoAsyncRunSynchronouslyInLibrary rule and tests for it.

webwarrior-ws avatar Nov 17 '25 13:11 webwarrior-ws

Make rule pass new tests by checking all nodes in the file for test attributes

But we don't want the check to be just about the file but about the whole assembly.

knocte avatar Nov 18 '25 11:11 knocte

Make rule pass new tests by checking all nodes in the file for test attributes

But we don't want the check to be just about the file but about the whole assembly.

The whole assembly check will only work when linting project or solution.

webwarrior-ws avatar Nov 18 '25 11:11 webwarrior-ws

The whole assembly check will only work when linting project or solution.

I know. That's why we don't recommend (show a warning) when only linting files.

knocte avatar Nov 18 '25 11:11 knocte

BTW, in my comment (https://github.com/fsprojects/FSharpLint/pull/785#issuecomment-3547185545) I'm quoting some text from a commit msg, that either should be fixed (changed the wording), or implemented properly.

knocte avatar Nov 18 '25 11:11 knocte

BTW, in my comment (https://github.com/fsprojects/FSharpLint/pull/785#issuecomment-3547185545) I'm quoting some text from a commit msg, that either should be fixed (changed the wording), or implemented properly.

After you have fixed the above, let's add 2 more commits:

  • 1st will be, in all cases where you have changed the API of FSharpLint.Core in this PR (for example to change Foo(): Bar to AsyncFoo(): Async<Bar>), reintroduce the old method/function: Foo() that will simply call Async.RunSyncronously AsyncFoo(). CI of this commit will obviously fail on SelfCheck.
  • 2nd commit will decorate all these methods with an Obsolete attrib, will also change the rule to ignore methods/functions with this attrib, add 2 more tests, and its CI should be green.

knocte avatar Nov 18 '25 12:11 knocte

Rebased.

webwarrior-ws avatar Nov 20 '25 12:11 webwarrior-ws

And let's rebase this again

knocte avatar Jan 06 '26 09:01 knocte

And let's rebase this again

Rebased

webwarrior-ws avatar Jan 06 '26 09:01 webwarrior-ws

let's squash commit Revert "Benchmarks: suppress rule" because:

  • its commit msg got obsolete, after the rebases
  • there shouldn't be reverts of commits that live in the same PR

knocte avatar Jan 06 '26 10:01 knocte