Skip to content

Instantly share code, notes, and snippets.

@pylover
Forked from ar45/inspections.txt
Last active April 22, 2024 07:47
Show Gist options
  • Save pylover/7870c235867cf22817ac5b096defb768 to your computer and use it in GitHub Desktop.
Save pylover/7870c235867cf22817ac5b096defb768 to your computer and use it in GitHub Desktop.
PyCharm inspections
# 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
@rpgoldman
Copy link

@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.

@banagale
Copy link

banagale commented Feb 9, 2021

@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?

@rpgoldman
Copy link

@banagale Yes, I was able to get that to work, thanks.

@daveusa31
Copy link

Please add it to ignore spelling errors.
# noinspection SpellCheckingInspection

@pylover
Copy link
Author

pylover commented Apr 13, 2021

@daveusa31, done.

@gherolyants
Copy link

Please, add this to ignore shadowing warnings:

# noinspection PyShadowingNames

@pylover
Copy link
Author

pylover commented Sep 14, 2021

@gherolyants, done.

@jwshieldsGetty
Copy link

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!)

@s4ly
Copy link

s4ly commented Aug 16, 2022

please, add # noinspection PyCallingNonCallable

@jmugan
Copy link

jmugan commented Oct 5, 2023

Note that # noinspection PyUnresolvedReferences works for ignoring unused imports.

@pylover
Copy link
Author

pylover commented Oct 6, 2023

Good to know, but contact JetBrains for such kind of issues.

@ToolBoxSystems
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment