Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

noqa isn't well respected #2270

Open
barseghyanartur opened this issue Jun 9, 2024 · 0 comments
Open

noqa isn't well respected #2270

barseghyanartur opened this issue Jun 9, 2024 · 0 comments

Comments

@barseghyanartur
Copy link

Filename: example.py

from typing import Any, Dict

from django.conf import settings
from django.contrib.auth.models import (  # noqa
    Group,  # noqa
    User,  # noqa
)  # noqa
from django.utils import timezone
from django.utils.text import slugify

Filename: pyproject.toml

[tool.isort]
profile = "black"
combine_as_imports = true
multi_line_output = 3
force_single_line = false
include_trailing_comma = true
force_grid_wrap = 0
use_parentheses = true
ensure_newline_before_comments = true
line_length = 80
honor_noqa = true
known_first_party = [
    "address",
    "article",
    "config",
    "data",
    "fake_address",
    "fake_band",
]
known_third_party = ["fake"]
skip = ["wsgi.py", "builddocs/"]

I obviously don't want isort to touch any line with noqa present. But isort does make changes. It forces it into from django.contrib.auth.models import Group, User (which normally would be good, but I want it my way in this case for a reason).

At best, it moves my entire block with pragma comments as the very last import statement. But that's also not what I want. I want my noqa imports to remain in place where they are and be untouched.

Is there a way to achieve this? I had to disable isort for now, but I would rather not do that as a long term solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant