Skip to content

whitespace around a comma rejected in rule lists #1013

Description

@jshwi

A rule list written with a space after the comma is not parsed as two rules.
_split_comma splits the commandline value and Comment splits a directive's
value, but neither strips the parts, so the second ref carries a leading space
and never matches a message.

The two surfaces then fail differently: the commandline rejects the run
outright, while a directive leaves the unmatched rule enabled and reports
SIG003 against it, so the user is told the wrong thing about a check that
still fires.

Reproducer

t.py:

def f(param1, param2) -> int:
    """Summary."""
    return 0
$ docsig --disable "SIG203, SIG503" t.py
unknown option to disable ' SIG503'
$ echo $?
2

Expected: exit 0, the same as --disable "SIG203,SIG503".

The same list in a directive:

# docsig: disable=SIG203, SIG503
def f(param1, param2) -> int:
    """Summary."""
    return 0
$ docsig t.py
t.py:2 in f
    SIG003: unknown module comment option for disable ' SIG503' (unknown-module-directive-option)
    SIG503: return missing from docstring (return-missing)
$ echo $?
1

Expected: exit 0 — both rules disabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions