fsprojects / fsprojects/FSharpLint

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

Open
#800 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
F#
Stars
327
Forks
74
PR merge metrics
No merged PRs in 30d

Description

Given this current behaviour of fsharplint:

% dotnet fsharplint test 
ERROR: unrecognized argument: 'test'.
USAGE: fsharplint [--help] [--format <standard|msbuild>] [--version] [<subcommand> [<options>]]

SUBCOMMANDS:

    lint <options>        Runs FSharpLint against a file or a collection of files.

    Use 'fsharplint <subcommand> --help' for additional information.

OPTIONS:

    --format, -f <standard|msbuild>
                          Output format of the linter.
    --version             Prints current version.
    --help                display this list of options.

And this:

% dotnet fsharplint --hlep                                          
ERROR: unrecognized argument: '--hlep'.
USAGE: fsharplint [--help] [--format <standard|msbuild>] [--version] [<subcommand> [<options>]]

SUBCOMMANDS:

    lint <options>        Runs FSharpLint against a file or a collection of files.

    Use 'fsharplint <subcommand> --help' for additional information.

OPTIONS:

    --format, -f <standard|msbuild>
                          Output format of the linter.
    --version             Prints current version.
    --help                display this list of options.

And this:

% dotnet fsharplint lint --help
USAGE: fsharplint lint [--help] [--lint-config <lintConfig>] [--file-type <project|solution|file|source>] <target>

TARGET:

    <target>              Input to lint.

OPTIONS:

    --lint-config, -l <lintConfig>
                          Path to the config for the lint.
    --file-type <project|solution|file|source>
                          Input type the linter will run against. If this is not set, the file type will be inferred from the file extension.
    --help                display this list of options.

Then, it's only logical to assume that, executing command dotnet fsharplint lint --hlep (current results: ========== Linting <inline source> ==========\n========== Finished: 0 warnings ==========\n========== Summary: 0 warnings ==========) should return something like:

ERROR: unrecognized argument: '--hlep'.
USAGE: fsharplint lint [--help] [--lint-config <lintConfig>] [--file-type <project|solution|file|source>] <target>

TARGET:

    <target>              Input to lint.

OPTIONS:

    --lint-config, -l <lintConfig>
                          Path to the config for the lint.
    --file-type <project|solution|file|source>
                          Input type the linter will run against. If this is not set, the file type will be inferred from the file extension.
    --help                display this list of options.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with dotnet fsharplint lint --hlep, then locate the lint subcommand entry point and its argument parsing. Check how an unrecognized option falls through to inline-source linting. Done means invalid options produce the documented error and usage output instead of linting empty inline source.

Written by the indexing model from the issue text.

Assessment

Tech stack
fsharp
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.