-
Star
(210)
You must be signed in to star a gist -
Fork
(35)
You must be signed in to fork a gist
-
-
Save pylover/7870c235867cf22817ac5b096defb768 to your computer and use it in GitHub Desktop.
# Extracted using: $ unzip -p lib/pycharm.jar com/jetbrains/python/PyBundle.properties | grep -B1 INSP.NAME | grep '^#' | sed 's|Inspection||g' | sed -e 's|#\s\{,1\}|# noinspection |' | |
# noinspection PyPep8 | |
# noinspection PyPep8Naming | |
# noinspection PyTypeChecker | |
# noinspection PyAbstractClass | |
# noinspection PyArgumentEqualDefault | |
# noinspection PyArgumentList | |
# noinspection PyAssignmentToLoopOrWithParameter | |
# noinspection PyAttributeOutsideInit | |
# noinspection PyAugmentAssignment | |
# noinspection PyBroadException | |
# noinspection PyByteLiteral | |
# noinspection PyCallByClass | |
# noinspection PyChainedComparsons | |
# noinspection PyClassHasNoInit | |
# noinspection PyClassicStyleClass | |
# noinspection PyComparisonWithNone | |
# noinspection PyCompatibility | |
# noinspection PyDecorator | |
# noinspection PyDefaultArgument | |
# noinspection PyDictCreation | |
# noinspection PyDictDuplicateKeys | |
# noinspection PyDocstringTypes | |
# noinspection PyExceptClausesOrder | |
# noinspection PyExceptionInheritance | |
# noinspection PyFromFutureImport | |
# noinspection PyGlobalUndefined | |
# noinspection PyIncorrectDocstring | |
# noinspection PyInitNewSignature | |
# noinspection PyInterpreter | |
# noinspection PyListCreation | |
# noinspection PyMandatoryEncoding | |
# noinspection PyMethodFirstArgAssignment | |
# noinspection PyMethodMayBeStatic | |
# noinspection PyMethodOverriding | |
# noinspection PyMethodParameters | |
# noinspection PyMissingConstructor | |
# noinspection PyMissingOrEmptyDocstring | |
# noinspection PyNestedDecorators | |
# noinspection PynonAsciiChar | |
# noinspection PyNoneFunctionAssignment | |
# noinspection PyOldStyleClasses | |
# noinspection PyPackageRequirements | |
# noinspection PyPropertyAccess | |
# noinspection PyPropertyDefinition | |
# noinspection PyProtectedMember | |
# noinspection PyRaisingNewStyleClass | |
# noinspection PyRedeclaration | |
# noinspection PyRedundantParentheses | |
# noinspection PySetFunctionToLiteral | |
# noinspection PySimplifyBooleanCheck | |
# noinspection PySingleQuotedDocstring | |
# noinspection PyStatementEffect | |
# noinspection PyStringException | |
# noinspection PyStringFormat | |
# noinspection PySuperArguments | |
# noinspection PyTrailingSemicolon | |
# noinspection PyTupleAssignmentBalance | |
# noinspection PyTupleItemAssignment | |
# noinspection PyUnboundLocalVariable | |
# noinspection PyUnnecessaryBackslash | |
# noinspection PyUnreachableCode | |
# noinspection PyUnresolvedReferences | |
# noinspection PyUnusedLocal | |
# noinspection ReturnValueFromInit | |
# noinspection SpellCheckingInspection | |
# noinspection PyShadowingNames | |
# noinspection PyCallingNonCallable |
Adding myself to the question above...
Thanks for putting this up, amazingly helpful
Thanks for this list!
Thanks!!!
Thank you so much for this list!
There is no official documentation is available, The list above is extracted from Pycharm's binary.
You may re-run the command at the first line of the script to regenerate this list again.
Some documentation is available
https://www.jetbrains.com/help/pycharm/disabling-and-enabling-inspections.html#suppressing-comments
hi
what is this?
@pedramkabir It's a list of all builtin warnings, that PyCharm provides when inspecting your code.
With the line # noinspection PyBroadException
you can suppress the warning for specific line.
E.g.:
try:
do_something_that_may_raise_an_exception()
except Exception as e: # Here PyCharm tells you that this is no bueno
do_something_to_handle_it()
but with the list above you can tell PyCharm, that you don't give a damn about the warning:
try:
do_something_that_may_raise_an_exception()
# noinspection PyBroadException
except Exception as e:
do_something_to_handle_it()
Note, # noinspection PyUnusedLocal
corresponds to the inspection warning: "Parameter [param] value is not used"
Thank you for this! However, we can now use # noqa
as well:
https://youtrack.jetbrains.com/issue/PY-8656
https://blog.jetbrains.com/pycharm/2020/02/pycharm-2020-1-eap-4/
I tried today and it works in 2020.2.1 (Professional Edition).
@AliGhahraei thanks for posting this, I did not realize this was added. The #noinspection behavior wasn’t enough.
It made it harder than it should have been to easily leverage inspections across the project or at a commit. Hunting for case-specific comments to was no fun. It seemed like they sometimes not be offered by the context menu or be buried unintuitively.
I mean that’s why so many people have ended up here right.
Ultimately they clutter the code.
Some of the most bothersome to me recently have been false positive inspections in DRF like in a Serializer.
I think Scopes could still use a lot of work, the UX is still kinda funky and just needs more polishing.
@pedramkabir It's a list of all builtin warnings, that PyCharm provides when inspecting your code.
With the line# noinspection PyBroadException
you can suppress the warning for specific line.E.g.:
try: do_something_that_may_raise_an_exception() except Exception as e: # Here PyCharm tells you that this is no bueno do_something_to_handle_it()but with the list above you can tell PyCharm, that you don't give a damn about the warning:
try: do_something_that_may_raise_an_exception() # noinspection PyBroadException except Exception as e: do_something_to_handle_it()
thank you sir
it was helpful
As on December 14th 2020, some warnings, e.g. PyShadowingBuiltins
are not included. Luckily, official documentation now describes how you can do it. To suppress a particular inspection in PyCharm, place cursor at the problematic word, then press 'Alt+Enter' and wait context help to pop up. Press 'More actions', then small triangle at the right of 'Ignore ... ' line. Finally choose suppression type, e.g. 'Suppress for function'. Alternatively, you can place a # noqa
comment at the end of problematic line as mentioned by AliGhahraei.
@iotanbo Alas, there appear to be some inspections for which one is not offered this option. I have a stub class that has a method for __init__
that overrides the parent class's, not calling the super method. PyCharm does not offer the option to suppress this warning.
@rpgoldman There are definitely major gaps in Pycharm's warning vs recommended changes and suppression statements for specific inspections.
I have used the #noqa
end-of-line remark @iotanbo mentioned where there are no obvious ways to squelch a warning. Have you tried this?
@banagale Yes, I was able to get that to work, thanks.
Please add it to ignore spelling errors.
# noinspection SpellCheckingInspection
@daveusa31, done.
Please, add this to ignore shadowing warnings:
# noinspection PyShadowingNames
@gherolyants, done.
I just want to add to this.
Regarding the "Broad Exception" - I am running 2021.3.2 CE, also tested in 2022.1 EAP build 221.3427.103;
When using a try/except with # noinspection PyBroadException
- the comment must be at the top of the try
portion.
IE:
Good:
# noinspection PyBroadException
try:
print("Thing to try")
except Exception:
print("Exception!)
Bad:
try:
print("Thing to try")
# noinspection PyBroadException
except Exception:
print("Exception!)
please, add # noinspection PyCallingNonCallable
Note that # noinspection PyUnresolvedReferences
works for ignoring unused imports.
Good to know, but contact JetBrains for such kind of issues.
A very useful list of all #noinspection comments is here:
https://www.jetbrains.com/help/pycharm/disabling-and-enabling-inspections.html#comments-ref
Also, other useful PyCharm info about suppressing comments is here:
https://www.jetbrains.com/help/pycharm/disabling-and-enabling-inspections.html#suppressing-comments
I'm having the devil's time finding where this list is documented. A clue, please?