Merge pull request #19812 from joefarebrother/python-qual-tagging

Python: Tag quality queries with `quality` and sub category.
This commit is contained in:
Taus
2025-06-19 16:30:51 +02:00
committed by GitHub
97 changed files with 409 additions and 140 deletions

View File

@@ -1,8 +1,99 @@
ql/python/ql/src/Classes/ConflictingAttributesInBaseClasses.ql
ql/python/ql/src/Classes/DefineEqualsWhenAddingAttributes.ql
ql/python/ql/src/Classes/EqualsOrHash.ql
ql/python/ql/src/Classes/InconsistentMRO.ql
ql/python/ql/src/Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
ql/python/ql/src/Classes/MissingCallToDel.ql
ql/python/ql/src/Classes/MissingCallToInit.ql
ql/python/ql/src/Classes/MutatingDescriptor.ql
ql/python/ql/src/Classes/SubclassShadowing.ql
ql/python/ql/src/Classes/SuperclassDelCalledMultipleTimes.ql
ql/python/ql/src/Classes/SuperclassInitCalledMultipleTimes.ql
ql/python/ql/src/Classes/WrongNameForArgumentInClassInstantiation.ql
ql/python/ql/src/Classes/WrongNumberArgumentsInClassInstantiation.ql
ql/python/ql/src/Exceptions/CatchingBaseException.ql
ql/python/ql/src/Exceptions/EmptyExcept.ql
ql/python/ql/src/Exceptions/IllegalExceptionHandlerType.ql
ql/python/ql/src/Exceptions/IllegalRaise.ql
ql/python/ql/src/Exceptions/IncorrectExceptOrder.ql
ql/python/ql/src/Exceptions/NotImplementedIsNotAnException.ql
ql/python/ql/src/Expressions/CallToSuperWrongClass.ql
ql/python/ql/src/Expressions/CompareConstants.ql
ql/python/ql/src/Expressions/CompareIdenticalValues.ql
ql/python/ql/src/Expressions/CompareIdenticalValuesMissingSelf.ql
ql/python/ql/src/Expressions/Comparisons/UselessComparisonTest.ql
ql/python/ql/src/Expressions/ContainsNonContainer.ql
ql/python/ql/src/Expressions/DuplicateKeyInDictionaryLiteral.ql
ql/python/ql/src/Expressions/EqualsNone.ql
ql/python/ql/src/Expressions/ExpectedMappingForFormatString.ql
ql/python/ql/src/Expressions/ExplicitCallToDel.ql
ql/python/ql/src/Expressions/Formatting/MixedExplicitImplicitIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/UnusedArgumentIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/UnusedNamedArgumentIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/WrongNameInArgumentsFor3101Format.ql
ql/python/ql/src/Expressions/Formatting/WrongNumberArgumentsFor3101Format.ql
ql/python/ql/src/Expressions/HashedButNoHash.ql
ql/python/ql/src/Expressions/IncorrectComparisonUsingIs.ql
ql/python/ql/src/Expressions/NonCallableCalled.ql
ql/python/ql/src/Expressions/Regex/BackspaceEscape.ql
ql/python/ql/src/Expressions/Regex/DuplicateCharacterInSet.ql
ql/python/ql/src/Expressions/Regex/MissingPartSpecialGroup.ql
ql/python/ql/src/Expressions/Regex/UnmatchableCaret.ql
ql/python/ql/src/Expressions/Regex/UnmatchableDollar.ql
ql/python/ql/src/Expressions/UnintentionalImplicitStringConcatenation.ql
ql/python/ql/src/Expressions/UnnecessaryLambda.ql
ql/python/ql/src/Expressions/UnsupportedFormatCharacter.ql
ql/python/ql/src/Expressions/WrongNameForArgumentInCall.ql
ql/python/ql/src/Expressions/WrongNumberArgumentsForFormat.ql
ql/python/ql/src/Expressions/WrongNumberArgumentsInCall.ql
ql/python/ql/src/Functions/ConsistentReturns.ql
ql/python/ql/src/Functions/ExplicitReturnInInit.ql
ql/python/ql/src/Functions/IncorrectRaiseInSpecialMethod.ql
ql/python/ql/src/Functions/IncorrectlyOverriddenMethod.ql
ql/python/ql/src/Functions/IncorrectlySpecifiedOverriddenMethod.ql
ql/python/ql/src/Functions/InitIsGenerator.ql
ql/python/ql/src/Functions/IterReturnsNonIterator.ql
ql/python/ql/src/Functions/IterReturnsNonSelf.ql
ql/python/ql/src/Functions/ModificationOfParameterWithDefault.ql
ql/python/ql/src/Functions/NonCls.ql
ql/python/ql/src/Functions/NonSelf.ql
ql/python/ql/src/Functions/OverlyComplexDelMethod.ql
ql/python/ql/src/Functions/ReturnConsistentTupleSizes.ql
ql/python/ql/src/Functions/SignatureOverriddenMethod.ql
ql/python/ql/src/Functions/SignatureSpecialMethods.ql
ql/python/ql/src/Functions/UseImplicitNoneReturnValue.ql
ql/python/ql/src/Imports/EncodingError.ql
ql/python/ql/src/Imports/ImportandImportFrom.ql
ql/python/ql/src/Imports/ModuleImportsItself.ql
ql/python/ql/src/Imports/MultipleImports.ql
ql/python/ql/src/Imports/SyntaxError.ql
ql/python/ql/src/Imports/UnintentionalImport.ql
ql/python/ql/src/Imports/UnusedImport.ql
ql/python/ql/src/Lexical/CommentedOutCode.ql
ql/python/ql/src/Resources/FileNotAlwaysClosed.ql
ql/python/ql/src/Statements/AssertOnTuple.ql
ql/python/ql/src/Statements/ConstantInConditional.ql
ql/python/ql/src/Statements/IterableStringOrSequence.ql
ql/python/ql/src/Statements/MismatchInMultipleAssignment.ql
ql/python/ql/src/Statements/ModificationOfLocals.ql
ql/python/ql/src/Statements/NestedLoopsSameVariable.ql
ql/python/ql/src/Statements/NestedLoopsSameVariableWithReuse.ql
ql/python/ql/src/Statements/NonIteratorInForLoop.ql
ql/python/ql/src/Statements/RedundantAssignment.ql
ql/python/ql/src/Statements/ShouldUseWithStatement.ql
ql/python/ql/src/Statements/SideEffectInAssert.ql
ql/python/ql/src/Statements/StatementNoEffect.ql
ql/python/ql/src/Statements/TopLevelPrint.ql
ql/python/ql/src/Statements/UnnecessaryElseClause.ql
ql/python/ql/src/Statements/UnnecessaryPass.ql
ql/python/ql/src/Statements/UnreachableCode.ql
ql/python/ql/src/Statements/UnusedExceptionObject.ql
ql/python/ql/src/Statements/UseOfExit.ql
ql/python/ql/src/Testing/ImpreciseAssert.ql
ql/python/ql/src/Variables/GlobalAtModuleLevel.ql
ql/python/ql/src/Variables/LoopVariableCapture/LoopVariableCapture.ql
ql/python/ql/src/Variables/MultiplyDefined.ql
ql/python/ql/src/Variables/SuspiciousUnusedLoopIterationVariable.ql
ql/python/ql/src/Variables/UndefinedExport.ql
ql/python/ql/src/Variables/UnusedLocalVariable.ql
ql/python/ql/src/Variables/UnusedModuleVariable.ql

View File

@@ -1,8 +1,99 @@
ql/python/ql/src/Classes/ConflictingAttributesInBaseClasses.ql
ql/python/ql/src/Classes/DefineEqualsWhenAddingAttributes.ql
ql/python/ql/src/Classes/EqualsOrHash.ql
ql/python/ql/src/Classes/InconsistentMRO.ql
ql/python/ql/src/Classes/InitCallsSubclass/InitCallsSubclassMethod.ql
ql/python/ql/src/Classes/MissingCallToDel.ql
ql/python/ql/src/Classes/MissingCallToInit.ql
ql/python/ql/src/Classes/MutatingDescriptor.ql
ql/python/ql/src/Classes/SubclassShadowing.ql
ql/python/ql/src/Classes/SuperclassDelCalledMultipleTimes.ql
ql/python/ql/src/Classes/SuperclassInitCalledMultipleTimes.ql
ql/python/ql/src/Classes/WrongNameForArgumentInClassInstantiation.ql
ql/python/ql/src/Classes/WrongNumberArgumentsInClassInstantiation.ql
ql/python/ql/src/Exceptions/CatchingBaseException.ql
ql/python/ql/src/Exceptions/EmptyExcept.ql
ql/python/ql/src/Exceptions/IllegalExceptionHandlerType.ql
ql/python/ql/src/Exceptions/IllegalRaise.ql
ql/python/ql/src/Exceptions/IncorrectExceptOrder.ql
ql/python/ql/src/Exceptions/NotImplementedIsNotAnException.ql
ql/python/ql/src/Expressions/CallToSuperWrongClass.ql
ql/python/ql/src/Expressions/CompareConstants.ql
ql/python/ql/src/Expressions/CompareIdenticalValues.ql
ql/python/ql/src/Expressions/CompareIdenticalValuesMissingSelf.ql
ql/python/ql/src/Expressions/Comparisons/UselessComparisonTest.ql
ql/python/ql/src/Expressions/ContainsNonContainer.ql
ql/python/ql/src/Expressions/DuplicateKeyInDictionaryLiteral.ql
ql/python/ql/src/Expressions/EqualsNone.ql
ql/python/ql/src/Expressions/ExpectedMappingForFormatString.ql
ql/python/ql/src/Expressions/ExplicitCallToDel.ql
ql/python/ql/src/Expressions/Formatting/MixedExplicitImplicitIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/UnusedArgumentIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/UnusedNamedArgumentIn3101Format.ql
ql/python/ql/src/Expressions/Formatting/WrongNameInArgumentsFor3101Format.ql
ql/python/ql/src/Expressions/Formatting/WrongNumberArgumentsFor3101Format.ql
ql/python/ql/src/Expressions/HashedButNoHash.ql
ql/python/ql/src/Expressions/IncorrectComparisonUsingIs.ql
ql/python/ql/src/Expressions/NonCallableCalled.ql
ql/python/ql/src/Expressions/Regex/BackspaceEscape.ql
ql/python/ql/src/Expressions/Regex/DuplicateCharacterInSet.ql
ql/python/ql/src/Expressions/Regex/MissingPartSpecialGroup.ql
ql/python/ql/src/Expressions/Regex/UnmatchableCaret.ql
ql/python/ql/src/Expressions/Regex/UnmatchableDollar.ql
ql/python/ql/src/Expressions/UnintentionalImplicitStringConcatenation.ql
ql/python/ql/src/Expressions/UnnecessaryLambda.ql
ql/python/ql/src/Expressions/UnsupportedFormatCharacter.ql
ql/python/ql/src/Expressions/WrongNameForArgumentInCall.ql
ql/python/ql/src/Expressions/WrongNumberArgumentsForFormat.ql
ql/python/ql/src/Expressions/WrongNumberArgumentsInCall.ql
ql/python/ql/src/Functions/ConsistentReturns.ql
ql/python/ql/src/Functions/ExplicitReturnInInit.ql
ql/python/ql/src/Functions/IncorrectRaiseInSpecialMethod.ql
ql/python/ql/src/Functions/IncorrectlyOverriddenMethod.ql
ql/python/ql/src/Functions/IncorrectlySpecifiedOverriddenMethod.ql
ql/python/ql/src/Functions/InitIsGenerator.ql
ql/python/ql/src/Functions/IterReturnsNonIterator.ql
ql/python/ql/src/Functions/IterReturnsNonSelf.ql
ql/python/ql/src/Functions/ModificationOfParameterWithDefault.ql
ql/python/ql/src/Functions/NonCls.ql
ql/python/ql/src/Functions/NonSelf.ql
ql/python/ql/src/Functions/OverlyComplexDelMethod.ql
ql/python/ql/src/Functions/ReturnConsistentTupleSizes.ql
ql/python/ql/src/Functions/SignatureOverriddenMethod.ql
ql/python/ql/src/Functions/SignatureSpecialMethods.ql
ql/python/ql/src/Functions/UseImplicitNoneReturnValue.ql
ql/python/ql/src/Imports/EncodingError.ql
ql/python/ql/src/Imports/ImportandImportFrom.ql
ql/python/ql/src/Imports/ModuleImportsItself.ql
ql/python/ql/src/Imports/MultipleImports.ql
ql/python/ql/src/Imports/SyntaxError.ql
ql/python/ql/src/Imports/UnintentionalImport.ql
ql/python/ql/src/Imports/UnusedImport.ql
ql/python/ql/src/Lexical/CommentedOutCode.ql
ql/python/ql/src/Resources/FileNotAlwaysClosed.ql
ql/python/ql/src/Statements/AssertOnTuple.ql
ql/python/ql/src/Statements/ConstantInConditional.ql
ql/python/ql/src/Statements/IterableStringOrSequence.ql
ql/python/ql/src/Statements/MismatchInMultipleAssignment.ql
ql/python/ql/src/Statements/ModificationOfLocals.ql
ql/python/ql/src/Statements/NestedLoopsSameVariable.ql
ql/python/ql/src/Statements/NestedLoopsSameVariableWithReuse.ql
ql/python/ql/src/Statements/NonIteratorInForLoop.ql
ql/python/ql/src/Statements/RedundantAssignment.ql
ql/python/ql/src/Statements/ShouldUseWithStatement.ql
ql/python/ql/src/Statements/SideEffectInAssert.ql
ql/python/ql/src/Statements/StatementNoEffect.ql
ql/python/ql/src/Statements/TopLevelPrint.ql
ql/python/ql/src/Statements/UnnecessaryElseClause.ql
ql/python/ql/src/Statements/UnnecessaryPass.ql
ql/python/ql/src/Statements/UnreachableCode.ql
ql/python/ql/src/Statements/UnusedExceptionObject.ql
ql/python/ql/src/Statements/UseOfExit.ql
ql/python/ql/src/Testing/ImpreciseAssert.ql
ql/python/ql/src/Variables/GlobalAtModuleLevel.ql
ql/python/ql/src/Variables/LoopVariableCapture/LoopVariableCapture.ql
ql/python/ql/src/Variables/MultiplyDefined.ql
ql/python/ql/src/Variables/SuspiciousUnusedLoopIterationVariable.ql
ql/python/ql/src/Variables/UndefinedExport.ql
ql/python/ql/src/Variables/UnusedLocalVariable.ql
ql/python/ql/src/Variables/UnusedModuleVariable.ql

View File

@@ -2,9 +2,9 @@
* @name Conflicting attributes in base classes
* @description When a class subclasses multiple base classes and more than one base class defines the same attribute, attribute overriding may result in unexpected behavior by instances of this class.
* @kind problem
* @tags reliability
* maintainability
* modularity
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name `__eq__` not overridden when adding attributes
* @description When adding new attributes to instances of a class, equality for that class needs to be defined.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Inconsistent equality and hashing
* @description Defining equality for a class without also defining hashability (or vice-versa) violates the object model.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-581
* @problem.severity warning

View File

@@ -2,7 +2,8 @@
* @name Inconsistent method resolution order
* @description Class definition will raise a type error at runtime due to inconsistent method resolution order(MRO)
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity high

View File

@@ -2,8 +2,10 @@
* @name Missing call to `__del__` during object destruction
* @description An omitted call to a super-class `__del__` method may lead to class instances not being cleaned up properly.
* @kind problem
* @tags efficiency
* @tags quality
* reliability
* correctness
* performance
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Missing call to `__init__` during object initialization
* @description An omitted call to a super-class `__init__` method may lead to objects of this class not being fully initialized.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Mutation of descriptor in `__get__` or `__set__` method.
* @description Descriptor objects can be shared across many instances. Mutating them can cause strange side effects or race conditions.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -4,7 +4,8 @@
* method, hides the method in the subclass.
* @kind problem
* @problem.severity error
* @tags maintainability
* @tags quality
* reliability
* correctness
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Multiple calls to `__del__` during object destruction
* @description A duplicated call to a super-class `__del__` method may lead to class instances not be cleaned up properly.
* @kind problem
* @tags efficiency
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Multiple calls to `__init__` during object initialization
* @description A duplicated call to a super-class `__init__` method may lead to objects of this class not being properly initialized.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity high

View File

@@ -4,7 +4,8 @@
* parameter of the __init__ method of the class being
* instantiated, will result in a TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-628
* @problem.severity error

View File

@@ -3,7 +3,8 @@
* @description Using too many or too few arguments in a call to the `__init__`
* method of a class will result in a TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-685
* @problem.severity error

View File

@@ -2,9 +2,9 @@
* @name Except block handles 'BaseException'
* @description Handling 'BaseException' means that system exits and keyboard interrupts may be mis-handled.
* @kind problem
* @tags reliability
* readability
* convention
* @tags quality
* reliability
* error-handling
* external/cwe/cwe-396
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,8 +2,9 @@
* @name Empty except
* @description Except doesn't do anything and has no comment
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* error-handling
* external/cwe/cwe-390
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,9 +2,9 @@
* @name Non-exception in 'except' clause
* @description An exception handler specifying a non-exception type will never handle any exception.
* @kind problem
* @tags reliability
* correctness
* types
* @tags quality
* reliability
* error-handling
* @problem.severity error
* @sub-severity low
* @precision very-high

View File

@@ -2,9 +2,9 @@
* @name Illegal raise
* @description Raising a non-exception object or type will result in a TypeError being raised instead.
* @kind problem
* @tags reliability
* correctness
* types
* @tags quality
* reliability
* error-handling
* @problem.severity error
* @sub-severity high
* @precision very-high

View File

@@ -3,8 +3,9 @@
* @description Handling general exceptions before specific exceptions means that the specific
* handlers are never executed.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* error-handling
* external/cwe/cwe-561
* @problem.severity error
* @sub-severity low

View File

@@ -6,8 +6,9 @@
* @sub-severity high
* @precision very-high
* @id py/raise-not-implemented
* @tags reliability
* maintainability
* @tags quality
* reliability
* error-handling
*/
import python

View File

@@ -2,9 +2,9 @@
* @name First argument to super() is not enclosing class
* @description Calling super with something other than the enclosing class may cause incorrect object initialization.
* @kind problem
* @tags reliability
* maintainability
* convention
* @tags quality
* reliability
* correctness
* external/cwe/cwe-687
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Comparison of constants
* @description Comparison of constants is always constant, but is harder to read than a simple constant.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-570
* external/cwe/cwe-571

View File

@@ -2,10 +2,9 @@
* @name Comparison of identical values
* @description Comparison of identical values, the intent of which is unclear.
* @kind problem
* @tags reliability
* correctness
* @tags quality
* maintainability
* readability
* convention
* external/cwe/cwe-570
* external/cwe/cwe-571
* @problem.severity warning

View File

@@ -2,8 +2,9 @@
* @name Maybe missing 'self' in comparison
* @description Comparison of identical values, the intent of which is unclear.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-570
* external/cwe/cwe-571
* @problem.severity warning

View File

@@ -2,7 +2,9 @@
* @name Redundant comparison
* @description The result of a comparison is implied by a previous comparison.
* @kind problem
* @tags useless-code
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-561
* external/cwe/cwe-570
* external/cwe/cwe-571

View File

@@ -2,7 +2,8 @@
* @name Membership test with a non-container
* @description A membership test, such as 'item in sequence', with a non-container on the right hand side will raise a 'TypeError'.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Duplicate key in dict literal
* @description Duplicate key in dict literal. All but the last will be lost.
* @kind problem
* @tags reliability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-561
* @problem.severity warning

View File

@@ -2,8 +2,10 @@
* @name Testing equality to None
* @description Testing whether an object is 'None' using the == operator is inefficient and potentially incorrect.
* @kind problem
* @tags efficiency
* maintainability
* @tags quality
* reliability
* correctness
* performance
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Formatted object is not a mapping
* @description The formatted object must be a mapping when the format includes a named specifier; otherwise a TypeError will be raised."
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name `__del__` is called explicitly
* @description The `__del__` special method is called by the virtual machine when an object is being finalized. It should not be called explicitly.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity low

View File

@@ -3,7 +3,8 @@
* @description Using implicit and explicit numbering in string formatting operations, such as '"{}: {1}".format(a,b)', will raise a ValueError.
* @kind problem
* @problem.severity error
* @tags reliability
* @tags quality
* reliability
* correctness
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Unused argument in a formatting call
* @description Including surplus arguments in a formatting call makes code more difficult to read and may indicate an error.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity warning
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Unused named argument in formatting call
* @description Including surplus keyword arguments in a formatting call makes code more difficult to read and may indicate an error.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity warning
* @sub-severity high

View File

@@ -4,7 +4,8 @@
* where the names of format items in the format string differs from the names of the values to be formatted will raise a KeyError.
* @kind problem
* @problem.severity error
* @tags reliability
* @tags quality
* reliability
* correctness
* @sub-severity low
* @precision high

View File

@@ -3,7 +3,8 @@
* @description A string formatting operation, such as '"{0}: {1}, {2}".format(a,b)',
* where the number of values to be formatted is too few for the format string will raise an IndexError.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Unhashable object hashed
* @description Hashing an object which is not hashable will result in a TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Comparison using is when operands support `__eq__`
* @description Comparison using 'is' when equivalence is not the same as identity
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity low

View File

@@ -2,9 +2,9 @@
* @name Non-callable called
* @description A call to an object which is not a callable will raise a TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* types
* @problem.severity error
* @sub-severity high
* @precision high

View File

@@ -3,7 +3,9 @@
* @description Using '\b' to escape the backspace character in a regular expression is confusing
* since it could be mistaken for a word boundary assertion.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* readability
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Duplication in regular expression character class
* @description Duplicate characters in a class have no effect and may indicate an error in the regular expression.
* @kind problem
* @tags reliability
* @tags quality
* maintainability
* readability
* @problem.severity warning
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Missing part of special group in regular expression
* @description Incomplete special groups are parsed as normal groups and are unlikely to match the intended strings.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Unmatchable caret in regular expression
* @description Regular expressions containing a caret '^' in the middle cannot be matched, whatever the input.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Unmatchable dollar in regular expression
* @description Regular expressions containing a dollar '$' in the middle cannot be matched, whatever the input.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,9 +2,9 @@
* @name Implicit string concatenation in a list
* @description Omitting a comma between strings causes implicit concatenation which is confusing in a list.
* @kind problem
* @tags reliability
* @tags quality
* maintainability
* convention
* readability
* external/cwe/cwe-665
* @problem.severity warning
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Unnecessary lambda
* @description A lambda is used that calls through to a function without modifying any parameters
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Unsupported format character
* @description An unsupported format character in a format string
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -4,7 +4,8 @@
* parameter of the called function or method, will result in a
* TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-628
* @problem.severity error

View File

@@ -3,7 +3,8 @@
* @description A string formatting operation, such as '"%s: %s, %s" % (a,b)', where the number of conversion specifiers in the
* format string differs from the number of values to be formatted will raise a TypeError.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-685
* @problem.severity error

View File

@@ -2,7 +2,8 @@
* @name Wrong number of arguments in a call
* @description Using too many or too few arguments in a call to a function will result in a TypeError at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-685
* @problem.severity error

View File

@@ -2,8 +2,9 @@
* @name Explicit returns mixed with implicit (fall through) returns
* @description Mixing implicit and explicit returns indicates a likely error as implicit returns always return 'None'.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* @problem.severity recommendation
* @sub-severity high
* @precision high

View File

@@ -2,7 +2,8 @@
* @name `__init__` method returns a value
* @description Explicitly returning a value from an `__init__` method will raise a TypeError.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,9 +2,9 @@
* @name Non-standard exception raised in special method
* @description Raising a non-standard exception in a special method alters the expected interface of that method.
* @kind problem
* @tags reliability
* maintainability
* convention
* @tags quality
* reliability
* error-handling
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,9 @@
* @name Mismatch between signature and use of an overriding method
* @description Method has a different signature from the overridden method and, if it were called, would be likely to cause an error.
* @kind problem
* @tags maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -3,7 +3,9 @@
* @description Method has a signature that differs from both the signature of its overriding methods and
* the arguments with which it is called, and if it were called, would be likely to cause an error.
* @kind problem
* @tags maintainability
* @tags quality
* reliability
* correctness
* @problem.severity recommendation
* @sub-severity high
* @precision high

View File

@@ -2,7 +2,8 @@
* @name `__init__` method is a generator
* @description `__init__` method is a generator.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name `__iter__` method returns a non-iterator
* @description The `__iter__` method returns a non-iterator which, if used in a 'for' loop, would raise a 'TypeError'.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -3,8 +3,9 @@
* @description Modifying the default value of a parameter can lead to unexpected
* results.
* @kind path-problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,11 +2,9 @@
* @name Overly complex `__del__` method
* @description `__del__` methods may be called at arbitrary times, perhaps never called at all, and should be simple.
* @kind problem
* @tags efficiency
* @tags quality
* maintainability
* complexity
* statistical
* non-attributable
* @problem.severity recommendation
* @sub-severity low
* @precision high

View File

@@ -2,9 +2,9 @@
* @name Returning tuples with varying lengths
* @description A function that potentially returns tuples of different lengths may indicate a problem.
* @kind problem
* @tags reliability
* maintainability
* quality
* @tags quality
* reliability
* correctness
* @problem.severity recommendation
* @sub-severity high
* @precision high

View File

@@ -4,7 +4,8 @@
* number and type of parameters has the potential to cause an error when there is a mismatch.
* @kind problem
* @problem.severity warning
* @tags reliability
* @tags quality
* reliability
* correctness
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,9 @@
* @name Use of the return value of a procedure
* @description The return value of a procedure (a function that does not return a value) is used. This is confusing to the reader as the value (None) has no meaning.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* readability
* @problem.severity warning
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Encoding error
* @description Encoding errors cause failures at runtime and prevent analysis of the code.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,9 @@
* @name Module is imported with 'import' and 'import from'
* @description A module is imported with the "import" and "import from" statements
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* readability
* @problem.severity recommendation
* @sub-severity low
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Module imports itself
* @description A module imports itself
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Module is imported more than once
* @description Importing a module a second time has no effect and impairs readability
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,7 +2,8 @@
* @name Syntax error
* @description Syntax errors cause failures at runtime and prevent analysis of the code.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity high

View File

@@ -3,8 +3,9 @@
* @description Importing a module using 'import *' may unintentionally pollute the global
* namespace if the module does not define `__all__`
* @kind problem
* @tags maintainability
* modularity
* @tags quality
* maintainability
* readability
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Unused import
* @description Import is not required as it is not used
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity recommendation
* @sub-severity high

View File

@@ -2,9 +2,9 @@
* @name Commented-out code
* @description Commented-out code makes the remaining code more difficult to read.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* readability
* documentation
* @problem.severity recommendation
* @sub-severity high
* @precision high

View File

@@ -2,10 +2,10 @@
* @name File is not always closed
* @description Opening a file without ensuring that it is always closed may lead to data loss or resource leaks.
* @kind problem
* @tags efficiency
* @tags quality
* reliability
* correctness
* resources
* quality
* performance
* external/cwe/cwe-772
* @problem.severity warning
* @sub-severity high

View File

@@ -2,8 +2,9 @@
* @name Asserting a tuple
* @description Using an assert statement to test a tuple provides no validity checking.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* external/cwe/cwe-670
* @problem.severity error
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Constant in conditional expression or statement
* @description The conditional is always true or always false
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-561
* external/cwe/cwe-570

View File

@@ -2,9 +2,9 @@
* @name Iterable can be either a string or a sequence
* @description Iteration over either a string or a sequence in the same loop can cause errors that are hard to find.
* @kind problem
* @tags reliability
* maintainability
* non-local
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -3,9 +3,9 @@
* @description Assigning multiple variables without ensuring that you define a
* value for each variable causes an exception at runtime.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* types
* @problem.severity error
* @sub-severity low
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Modification of dictionary returned by locals()
* @description Modifications of the dictionary returned by locals() are not propagated to the local variables of a function.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity low

View File

@@ -3,8 +3,9 @@
* @description Nested loops in which the target variable is the same for each loop make
* the behavior of the loops difficult to understand.
* @kind problem
* @tags maintainability
* correctness
* @tags quality
* maintainability
* readability
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -3,7 +3,8 @@
* @description Redefining a variable in an inner loop and then using
* the variable in an outer loop causes unexpected behavior.
* @kind problem
* @tags maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -2,9 +2,9 @@
* @name Non-iterable used in for loop
* @description Using a non-iterable as the object in a 'for' loop causes a TypeError.
* @kind problem
* @tags reliability
* @tags quality
* reliability
* correctness
* types
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,8 +2,9 @@
* @name Redundant assignment
* @description Assigning a variable to itself is useless and very likely indicates an error in the code.
* @kind problem
* @tags reliability
* useless-code
* @tags quality
* reliability
* correctness
* external/cwe/cwe-563
* @problem.severity error
* @sub-severity low

View File

@@ -3,9 +3,9 @@
* @description Using a 'try-finally' block to ensure only that a resource is closed makes code more
* difficult to read.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* readability
* convention
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -3,8 +3,9 @@
* @description Side-effects in assert statements result in differences between normal
* and optimized behavior.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Statement has no effect
* @description A statement has no effect
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-561
* @problem.severity recommendation

View File

@@ -2,9 +2,9 @@
* @name Use of a print statement at module level
* @description Using a print statement at module scope (except when guarded by `if __name__ == '__main__'`) will cause surprising output when the module is imported.
* @kind problem
* @tags reliability
* maintainability
* convention
* @tags quality
* reliability
* correctness
* @problem.severity recommendation
* @sub-severity high
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Unnecessary 'else' clause in loop
* @description An 'else' clause in a 'for' or 'while' statement that does not contain a 'break' is redundant.
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity warning
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Unnecessary pass
* @description Unnecessary 'pass' statement
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity warning
* @sub-severity low

View File

@@ -2,7 +2,8 @@
* @name Unreachable code
* @description Code is unreachable
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-561
* @problem.severity warning

View File

@@ -2,8 +2,9 @@
* @name Unused exception object
* @description An exception object is created, but is not used.
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* error-handling
* @problem.severity error
* @sub-severity low
* @precision very-high

View File

@@ -2,7 +2,9 @@
* @name Use of exit() or quit()
* @description exit() or quit() may fail if the interpreter is run with the -S option.
* @kind problem
* @tags maintainability
* @tags quality
* reliability
* correctness
* @problem.severity warning
* @sub-severity low
* @precision very-high

View File

@@ -2,8 +2,9 @@
* @name Imprecise assert
* @description Using 'assertTrue' or 'assertFalse' rather than a more specific assertion can give uninformative failure messages.
* @kind problem
* @tags maintainability
* testability
* @tags quality
* maintainability
* readability
* @problem.severity recommendation
* @sub-severity high
* @precision very-high

View File

@@ -2,7 +2,8 @@
* @name Use of 'global' at module level
* @description Use of the 'global' statement at module level
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* @problem.severity warning
* @sub-severity low

View File

@@ -2,8 +2,9 @@
* @name Loop variable capture
* @description Capturing a loop variable is not the same as capturing its value, and can lead to unexpected behavior or bugs.
* @kind path-problem
* @tags correctness
* quality
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Variable defined multiple times
* @description Assignment to a variable occurs multiple times without any intermediate use of that variable
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-563
* @problem.severity warning

View File

@@ -2,7 +2,8 @@
* @name Suspicious unused loop iteration variable
* @description A loop iteration variable is unused, which suggests an error.
* @kind problem
* @tags maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low

View File

@@ -3,8 +3,9 @@
* @description Including an undefined attribute in `__all__` causes an exception when
* the module is imported using '*'
* @kind problem
* @tags reliability
* maintainability
* @tags quality
* reliability
* correctness
* @problem.severity error
* @sub-severity low
* @precision high

View File

@@ -2,7 +2,8 @@
* @name Unused local variable
* @description Local variable is defined but not used
* @kind problem
* @tags maintainability
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-563
* @problem.severity recommendation

View File

@@ -2,7 +2,8 @@
* @name Unused global variable
* @description Global variable is defined but not used
* @kind problem
* @tags efficiency
* @tags quality
* maintainability
* useless-code
* external/cwe/cwe-563
* @problem.severity recommendation

View File

@@ -0,0 +1,5 @@
---
category: queryMetadata
---
* The tag `quality` has been added to multiple Python quality queries for consistency. They have all been given a tag for one of the two top-level categories `reliability` or `maintainability`, and a tag for a sub-category. See [Query file metadata and alert message style guide](https://github.com/github/codeql/blob/main/docs/query-metadata-style-guide.md#quality-query-sub-category-tags) for more information about these categories.