Class AbstractRegexCheck

java.lang.Object
org.sonar.plugins.python.api.PythonSubscriptionCheck
org.sonar.python.checks.regex.AbstractRegexCheck
All Implemented Interfaces:
PythonCheck, SubscriptionCheck
Direct Known Subclasses:
AnchorPrecedenceCheck, DuplicatesInCharacterClassCheck, EmptyAlternativeCheck, EmptyGroupCheck, EmptyStringRepetitionCheck, GraphemeClustersInClassesCheck, GroupReplacementCheck, ImpossibleBackReferenceCheck, ImpossibleBoundariesCheck, InvalidRegexCheck, MultipleWhitespaceCheck, OctalEscapeCheck, PossessiveQuantifierContinuationCheck, RedosCheck, RedundantRegexAlternativesCheck, RegexComplexityCheck, RegexLookaheadCheck, ReluctantQuantifierCheck, ReluctantQuantifierWithEmptyContinuationCheck, SingleCharacterAlternationCheck, SingleCharCharacterClassCheck, StringReplaceCheck, SuperfluousCurlyBraceCheck, UnquantifiedNonCapturingGroupCheck, UnusedGroupNamesCheck, VerboseRegexCheck

public abstract class AbstractRegexCheck extends PythonSubscriptionCheck
  • Field Details

    • regexContext

      protected RegexContext regexContext
    • reportedRegexTrees

      protected final Set<org.sonarsource.analyzer.commons.regex.ast.RegexSyntaxElement> reportedRegexTrees
  • Constructor Details

    • AbstractRegexCheck

      public AbstractRegexCheck()
  • Method Details

    • lookedUpFunctions

      protected Map<String,Integer> lookedUpFunctions()
      Should return a map whose keys are the functions the check is interested in, and the values are the position of the flags parameter. Set the position of the flags parameter to null if there is none.
    • initialize

      public void initialize(SubscriptionCheck.Context context)
    • checkRegex

      public abstract void checkRegex(org.sonarsource.analyzer.commons.regex.RegexParseResult regexParseResult, CallExpression regexFunctionCall)
    • mapPythonFlag

      public static Optional<Integer> mapPythonFlag(QualifiedExpression ch)
    • addIssue

      public PythonCheck.PreciseIssue addIssue(org.sonarsource.analyzer.commons.regex.ast.RegexSyntaxElement regexTree, String message, @Nullable Integer cost, List<org.sonarsource.analyzer.commons.regex.RegexIssueLocation> secondaries)