Class RegexpSinglelineCheck

All Implemented Interfaces:
Configurable, Contextualizable, FileSetCheck

Checks that a specified pattern matches a single-line in any file type.

Rationale: This check can be used to prototype checks and to find common bad practice such as calling ex.printStacktrace(), System.out.println(), System.exit(), etc.

Since:
5.0
  • Field Details

    • format

      private String format
      Specify the format of the regular expression to match.
    • message

      private String message
      Specify the message which is used to notify about violations, if empty then default (hard-coded) message is used.
    • minimum

      private int minimum
      Specify the minimum number of matches required in each file.
    • maximum

      private int maximum
      Specify the maximum number of matches required in each file.
    • ignoreCase

      private boolean ignoreCase
      Control whether to ignore case when searching.
    • detector

      The detector to use.
  • Constructor Details

  • Method Details

    • beginProcessing

      public void beginProcessing(String charset)
      Description copied from interface: FileSetCheck
      Called when about to be called to process a set of files.
      Specified by:
      beginProcessing in interface FileSetCheck
      Overrides:
      beginProcessing in class AbstractFileSetCheck
      Parameters:
      charset - the character set used to read the files.
    • processFiltered

      protected void processFiltered(File file, FileText fileText)
      Description copied from class: AbstractFileSetCheck
      Called to process a file that matches the specified file extensions.
      Specified by:
      processFiltered in class AbstractFileSetCheck
      Parameters:
      file - the file to be processed
      fileText - the contents of the file.
    • setFormat

      public void setFormat(String format)
      Setter to specify the format of the regular expression to match.
      Parameters:
      format - the format of the regular expression to match.
      Since:
      5.0
    • setMessage

      public void setMessage(String message)
      Setter to specify the message which is used to notify about violations, if empty then default (hard-coded) message is used.
      Parameters:
      message - the message to report for a match.
      Since:
      5.0
    • setMinimum

      public void setMinimum(int minimum)
      Setter to specify the minimum number of matches required in each file.
      Parameters:
      minimum - the minimum number of matches required in each file.
      Since:
      5.0
    • setMaximum

      public void setMaximum(int maximum)
      Setter to specify the maximum number of matches required in each file.
      Parameters:
      maximum - the maximum number of matches required in each file.
      Since:
      5.0
    • setIgnoreCase

      public void setIgnoreCase(boolean ignoreCase)
      Setter to control whether to ignore case when searching.
      Parameters:
      ignoreCase - whether to ignore case when searching.
      Since:
      5.0