Package org.sonar.python.checks
Class CheckUtils
- java.lang.Object
-
- org.sonar.python.checks.CheckUtils
-
public class CheckUtils extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static booleanareEquivalent(Tree leftTree, Tree rightTree)static booleanclassHasInheritance(ClassDef classDef)static booleancontainsCallToLocalsFunction(Tree tree)static SymbolfindFirstParameterSymbol(FunctionDef functionDef)static ClassDefgetParentClassDef(Tree tree)static booleanisAbstract(FunctionDef funDef)static booleanisConstant(Expression condition)static booleanisConstantCollectionLiteral(Expression condition)static booleanisImmutableConstant(Expression condition)static booleanisNone(InferredType type)static booleanisSelf(Expression expression)Simple check whether the given expression is the "self" name expression.static booleanmustBeAProtocolLike(ClassDef classDef)Determines whether the given class must be a Protocol or a similar Protocol-like definition (e.g.
-
-
-
Method Detail
-
areEquivalent
public static boolean areEquivalent(@Nullable Tree leftTree, @Nullable Tree rightTree)
-
classHasInheritance
public static boolean classHasInheritance(ClassDef classDef)
-
containsCallToLocalsFunction
public static boolean containsCallToLocalsFunction(Tree tree)
-
isConstant
public static boolean isConstant(Expression condition)
-
isImmutableConstant
public static boolean isImmutableConstant(Expression condition)
-
isConstantCollectionLiteral
public static boolean isConstantCollectionLiteral(Expression condition)
-
isNone
public static boolean isNone(InferredType type)
-
mustBeAProtocolLike
public static boolean mustBeAProtocolLike(ClassDef classDef)
Determines whether the given class must be a Protocol or a similar Protocol-like definition (e.g.zope.interface.Interface).
-
isAbstract
public static boolean isAbstract(FunctionDef funDef)
-
isSelf
public static boolean isSelf(Expression expression)
Simple check whether the given expression is the "self" name expression. Carefully check the context when relying on this method! This implementation does not ensure that the name is actually referring to a method parameter or whether the surrounding method might be static, etc.
-
findFirstParameterSymbol
@CheckForNull public static Symbol findFirstParameterSymbol(FunctionDef functionDef)
-
-