pylint-dev / pylint

It's not just a linter that annoys you!
https://pylint.readthedocs.io/en/latest/
GNU General Public License v2.0
5.33k stars 1.14k forks source link

Cannot disable 'cyclic-import' warning #9490

Open rpullm168 opened 8 months ago

rpullm168 commented 8 months ago

Bug description

Neither:
`# pylint: disable=cyclic-import`
nor:
`# pylint: disable=R0401`

squelches the "Cyclic import" warning.  Tried at all scopes, all the way up to global module scope, to no avail: warning is still emitted.

(The apparent cyclic import is a false positive that does not actually occur in runtime, which is not the bug I'm reporting.)

The warning can be successfully disabled by adding a `disable=cyclic-import` clause in the `.pylintrc` file, but that suppresses this check for all modules in the package directory, not desirable.

Configuration

No response

Command used

pylint setup.py

Pylint output

************* Module setup
setup.py:1:0: R0401: Cyclic import (ea_vault.vault_api -> ea_vault.vault_cache) (cyclic-import)

Expected behavior

(no warning)

Pylint version

pylint 3.1.0
astroid 3.1.0
Python 3.12.2 (c3.12.2:6abddd9f6a, Feb 6, 2024, 17:02:06) [Clang 13.0.0 (clang-1200.0.29.30)]

OS / Environment

macOS Darwin Kernel Version 21.3.0

Additional dependencies

No response

Pierre-Sassoulas commented 8 months ago

Related to #6983 and #850, we still need to permit to disable all of the cyclic-import in a cycle at once with a single local disable.