Class AbstractLinter

java.lang.Object
ro.isdc.wro.extensions.processor.support.linter.AbstractLinter
Direct Known Subclasses:
JsHint, JsLint

public abstract class AbstractLinter extends Object
Encapsulates common code for utilities like jsHint or jsLint.
Since:
1.4.2
Author:
Alex Objelean
  • Constructor Details

    • AbstractLinter

      public AbstractLinter()
  • Method Details

    • getWebjarLocator

      protected final WebjarUriLocator getWebjarLocator()
      Returns:
      WebjarUriLocator instance to retrieve webjars.
    • getScriptAsStream

      protected abstract InputStream getScriptAsStream() throws IOException
      Returns:
      the stream of the linter script. Override this method to provide a different script version.
      Throws:
      IOException - if the stream is invalid or unavailable.
    • validate

      public void validate(String data) throws LinterException
      Validates a js using jsHint and throws LinterException if the js is invalid. If no exception is thrown, the js is valid.
      Parameters:
      data - js content to process.
      Throws:
      LinterException
    • getLinterName

      protected abstract String getLinterName()
      Returns:
      the name of the function used to perform the lint operation.
    • setOptions

      public AbstractLinter setOptions(String... options)
      Parameters:
      options - the options to set
    • createDefaultOptions

      protected String createDefaultOptions()
      Returns:
      default options to use for linting.