PyCharm's code inspection is a useful tool, but sometimes it gets things wrong. I know you can disable whole classes of warnings via settings, but what if you just want to dismiss a specific instance of a warning at a particular line?
Dismiss PyCharm code inspection warning for particular line of code
Asked Answered
1. Alt + Enter while cursor standing on problematic place.
2. Select appropriate entry from appeared popup menu.
3. Expand submenu (click on small triangle on the right side .. or just press arrow right key on keyboard.
4. Choose "Suppress for statement" from there.
In the end special comment will be added just before that line that would temporarily turn off that specific inspection for next statement.
This is how it looks in PhpStorm (sorry, I'm not PyCharm or Python user):
Emphasis on typing right-arrow. In PyCharm 4.5 clicking the small triangle does not work to install a
# noinspection
comment. Instead it engages the default solution. –
Honeysucker To just suppress the warning in the editor, there's also a lazy suppression option which is to use the comment noqa on the same line, such as:
from application import routes # noqa
Here is duplicate question that has more answers.
© 2022 - 2024 — McMap. All rights reserved.
Alt+Enter
while cursor standing on problematic place; 2) Select appropriate entry from appeared popup menu; 3) Expand submenu (click on small triangle on the right side .. or justarrow right
key on keyboard; 4) ChooseSuppress for statement
from there. This is how it looks in PhpStorm: postimg.org/image/o4xvaapv3 – Auritaself.my_property
and in the setter you doself._my_property
By the way, it's justoption+enter
if you're on a mac. – Monkfish