Class CheckUtils

java.lang.Object
org.sonar.python.checks.utils.CheckUtils

public class CheckUtils extends Object
  • Method Details

    • areEquivalent

      public static boolean areEquivalent(@Nullable Tree leftTree, @Nullable Tree rightTree)
    • getParentClassDef

      @CheckForNull public static ClassDef getParentClassDef(Tree tree)
    • 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)