Skip to content

Conversation

@webwarrior-ws
Copy link
Contributor

@webwarrior-ws webwarrior-ws commented Jan 7, 2026

If unknown named argument is passed to "fsharplint lint" or several targets are passed instead of one, show "unrecognized argument" error and print usage.

Fixes #800


[<Test>]
member _.InvalidArgument() =
let invalidArgument = $"lint --framework net8.0"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@webwarrior-ws please remove this part of the test, it's too confusing

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced with "--invalidArg someValue"

@webwarrior-ws
Copy link
Contributor Author

CI failure unrelated to the PR.

@knocte
Copy link
Collaborator

knocte commented Jan 7, 2026

CI failure unrelated to the PR.

Kinda disagree. Anyway let's just cherry-pick commit ee14b6d here to make it pass, and we will rebase later depending on what PR we merge first.

@webwarrior-ws
Copy link
Contributor Author

CI failure unrelated to the PR.

Kinda disagree. Anyway let's just cherry-pick commit ee14b6d here to make it pass, and we will rebase later depending on what PR we merge first.

No, that error I already fixed. Now it's failing FailwithWithBadArgumentsDuplicateExceptionMessage test.

@knocte
Copy link
Collaborator

knocte commented Jan 7, 2026

Let's look at the logs to investigate. Save the logs to your computer. After that, let's retry CI again to see if the error is deterministic.

@webwarrior-ws
Copy link
Contributor Author

Let's look at the logs to investigate. Save the logs to your computer. After that, let's retry CI again to see if the error is deterministic.

CI of the last commit in the branch is green. Also I remember seeing this error in CI from time to time without particular reason.

@knocte
Copy link
Collaborator

knocte commented Jan 9, 2026

CI of the last commit in the branch is green.

Ok, that proves that the issue is non-deterministic.

Also I remember seeing this error in CI from time to time without particular reason.

You're referring to this bug: #763 and I fixed it (or mitigated it, in case this error is the same) here: 8c60856

So, as I said, please gather the logs of this failed run to investigate them (before pushing anything here and losing them). If the issue is the same as bug 763, upload those logs to that github issue and reopen it, and we continue investigating there.

@knocte
Copy link
Collaborator

knocte commented Jan 9, 2026

Fixes #800

That github issue also says in the title "... instead of fallingback to <inline source>"? So I think this PR should also have a commit that makes fsharplint stop falling back to inline source when target type cannot be determined.

@webwarrior-ws
Copy link
Contributor Author

CI of the last commit in the branch is green.

Ok, that proves that the issue is non-deterministic.

Also I remember seeing this error in CI from time to time without particular reason.

You're referring to this bug: #763 and I fixed it (or mitigated it, in case this error is the same) here: 8c60856

So, as I said, please gather the logs of this failed run to investigate them (before pushing anything here and losing them). If the issue is the same as bug 763, upload those logs to that github issue and reopen it, and we continue investigating there.

Added comment to issue 763 with logs of failed run. I don't have permissions to reopen it.

@webwarrior-ws
Copy link
Contributor Author

Fixes #800

That github issue also says in the title "... instead of fallingback to <inline source>"? So I think this PR should also have a commit that makes fsharplint stop falling back to inline source when target type cannot be determined.

Added a commit for that.

Added a test that checks if passing invalid argument(s) to
"fsharplint lint" results in "unrecognized argument" error.
If unknown named argument is passed to "fsharplint lint" or
several targets are passed instead of one, show
"unrecognized argument" error and print usage.

Declare parser beforehand so that it can be used in other
functions e.g. to print usage.

Fixes fsprojects#800
Also lint single file instead of project because project is
using .NET 9 and that leads to error:
```
The current .NET SDK does not support targeting .NET 9.0.  Either target .NET 8.0 or lower, or use a version of the .NET SDK that supports .NET 9.0. Download the .NET SDK from https://aka.ms/dotnet/download
```
When target type cannot be determined. Instead, show an error
prompting to explicitly set input type using --file-type
parameter.
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.

Should check for existence of --argument instead of fallingback to <inline source>?

2 participants