Skip to content
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

Fix for issue #341 #608

Merged
merged 1 commit into from
Dec 7, 2023
Merged

Fix for issue #341 #608

merged 1 commit into from
Dec 7, 2023

Conversation

Thorium
Copy link
Member

@Thorium Thorium commented Nov 8, 2023

The cause of this crash is that there are multiple rules hit for a variable.
Right now what happens: FSharpLint crashes and doesn't produce output.

Instead, if we just ignore the failure of adding a rule failure to a single line of code, the lint-task would produce a result.
After fixing the first issue the end-user can re-run the lint again and see if the earlier ignored rule still hits or not.

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

@Thorium hi Tuomas, great contribution! Do you mind adding a regression test?

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

LGTM! Just 2 nits please:

  • In the test file, please add EOL before EOF.
  • Do you mind changing the order of your commits with interactive rebase? After that, push 1 by 1 (so I can see the 1st one with a red CI, and the 2nd fixing it).

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

After that, push 1 by 1 (so I can see the 1st one with a red CI, and the 2nd fixing it).

Oh, and for this to really happen, you need to enable GitHubActions in your fork, first (before pushing, after the interactive rebase).

@Thorium
Copy link
Member Author

Thorium commented Nov 21, 2023

You can test specific commits just by id git cherry-pick b80db49b7b2f when in master.
But, it turns out I cannot easily replicate the current runtime crash with an unit-test.
So, I removed the test.

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

You can test specific commits just by id git cherry-pick b80db49 when in master.

But I want GitHub to do it for me :) Can you enable GitHubActions in your fork please?

But, it turns out I cannot easily replicate the current runtime crash with an unit-test.

Mmm, then we should bring some fragment of code from ProvidedTypes.fs like you mentioned in the bug?

@Thorium
Copy link
Member Author

Thorium commented Nov 21, 2023

I was able already to fix ProvidedTypes.fs with the following workaround:

  • I added custom fsharplint.json where I removed so many rules that it didn't hit many duplicate rules at the same code line.
  • Then I fixed the issues it found.
  • Observe it's now hitting only single rules, so it can run with default config.

However, as a workaround without this fix, that's a quite un-inviting user experience for new users.

@knocte
Copy link
Collaborator

knocte commented Nov 21, 2023

However, as a workaround without this fix, that's a quite un-inviting user experience for new users.

Completely agree, but let's not lose scope here, we're talking about fixing issue #341 here. Can you rescue a previous version of ProvidedTypes.fs that reproduces the bug?

@Thorium
Copy link
Member Author

Thorium commented Nov 21, 2023

Can you rescue a previous version of ProvidedTypes.fs that reproduces the bug?

That's miles long. Rather use the code that is in the original issue. But it's not happening while in source-code (as you can see from the issue), rather when using external files only. Which means it should be an integration test and not a unit test. But I don't see the amount of work to add integration tests would be beneficial on resolving the issue.

@knocte
Copy link
Collaborator

knocte commented Nov 22, 2023

That's fair enough. I'll then merge this shortly, at least knowing it doesn't break any current tests.

I just need to figure out if I want to merge this before or after next release.

@knocte knocte merged commit 323223f into fsprojects:master Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants