Skip to content

Make pylint consider disable params when checking for line length #4802

Closed
@DanielNoord

Description

@DanielNoord

Current problem

As discussed in #1682 pylint currently does not consider the length of the disable params when checking for line length.
For example, when max-length is set to 80 the following code would not raise a line-too-long warning.

Line with length of 80 columns  # pylint: disable=not-callable

According to the issue, this is due to:
https://github.com/PyCQA/pylint/blob/14da5ce258d3818037304a6e0f61aba1462e251d/pylint/checkers/format.py#L1004
Which seems fair.

However, this is not what users might intuitively expect from this warning, as a comment in that issue shows. Some users might want the max-length to also include comments.
Although #4797 fixes some of the issues in the original issue, it does not solve this particular issue. This issue serves to track it.

Desired solution

Make pylint consider comments when checking for max-length of lines.

Open question:
What should be default behaviour? Including comments or excluding comments? Current behaviour is excluding, but I would argue that it would be more intuitive to include them. Especially now that users can use disable-next to split comments and code over multiple lines.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: line-too-longIssues related to 'line-too-long'Documentation 📗Needs PRThis issue is accepted, sufficiently specified and now needs an implementation

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions