Skip to content

"# noqa" is ignored when per-file-ignores is provided #3972

@DmytroLitvinov

Description

@DmytroLitvinov

Hi there.
I am trying to integrate ruff as a possible replacement of flake8 and I see that behavior of per-file-ignores option is not the same as in flake8.

  • flake8 settings
[flake8]
max-line-length = 120
per-file-ignores =
    __init__.py:F401,F403

flake8 respects noqa in that case, but not ruff. Not sure is it expected behavior for ruff or not?

  • Code snippet to reproduce the issue:
# __init__.py file
"""
See what is changed since then - https://github.com/ui/django-post_office/compare/3fead089a4e7e7fc2ae5ab56383f4ebf64c8777b...master  # noqa: E501
After you adapt it, then please change hash commit in url.
"""
  • Ruff settings:
# pyproject.toml
[tool.ruff]
line-length = 120
# Sync with flake8 configuration
[tool.ruff.per-file-ignores]
"__init__.py" = ["F401", "F403"]
  • Ruff version: 0.0.261
  • Ruff issue: __init__.py:2:121: E501 Line too long (144 > 120 characters)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions