Skip to content

Split reportCallIssue into more granular diagnostics for call argument validation #1858

Description

@PizzoUnicredit

Description

Split reportCallIssue into more granular diagnostics

Currently, many unrelated call-validation problems are reported through the generic reportCallIssue diagnostic. As a result, users who want to suppress generic overload-related diagnostics are forced to disable validation for many other useful call errors as well.

Examples:

a = "hello"
a.replace("")

Current diagnostic:

No overloads for "replace" match the provided arguments

Actual issue:

Missing required argument "new"

a = "hello"
a.replace("x", new="")

Current diagnostic:

No overloads for "replace" match the provided arguments

Actual issue:

Parameter "new" is positional-only

or:

Keyword argument "new" is not allowed

def func(a: str, b: str) -> None:
    pass

func("x")

Actual issue:

Missing required argument "b"

I would like argument-related diagnostics to be separated from overload-resolution diagnostics.

Ideally, the following categories could be configured independently:

  • Missing required arguments
  • Unknown keyword arguments
  • Positional-only parameter violations
  • Too many arguments
  • Overload mismatches

For example:

{
  "reportMissingArgument": "error",
  "reportUnknownKeywordArgument": "error",
  "reportPositionalOnlyViolation": "error",
  "reportTooManyArguments": "error",
  "reportOverloadMismatch": "warning"
}

My use case is that I would like to suppress generic overload-mismatch diagnostics while still keeping validation for missing arguments, unknown arguments, positional-only violations, and similar mistakes.

Even if separate configuration options are not added, it would still be a significant usability improvement if obvious cases were reported using their actual root cause rather than being surfaced as a generic overload-resolution failure.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type checking / lintingissues relating to existing diagnostic rules or proposals for new diagnostic rules

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions