Skip to content

D100 with --add-noqa breaks shebang lines #14442

@pjspereira

Description

@pjspereira

The —add-noqa breaks shebang lines with the D100 rule on files with no module documentation. Can the shebang line be ignored and the D100 error be assigned to the second line, if it exists?

Example output from ruff check --add-noqa --select D100 --isolated .:

#!/usr/bin/env python  # noqa: D100

import sys

if __name__==__main__’:
    print(sys.argv)

If this script is marked executable, the noqa comment will be passed as a filename to python, which will crash the interpreter, since the file does not exist.

Keywords: shebang D100
Ruff version: 0.6.4

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinghelp wantedContributions especially welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions