Package: java.org.codenarc.rule

## [Java] Interface Rule

- Represents a source code analysis rule .

  Authors:
    Chris Mair

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `List<Violation>` | `applyTo(SourceCode sourceCode)` Apply this rule to the specified source and return a list of violations (or an empty List)
    `` | `int` | `getCompilerPhase()` @return the required compiler phase (as in org.codehaus.groovy.control.Phases) of the AST of the SourceCode handed to the rule via applyTo(SourceCode sourceCode)
    `` | `String` | `getName()` @return the unique id for this rule
    `` | `int` | `getPriority()` @return the priority of this rule; must be 1, 2 or 3

- - ### Method Detail

    - #### public List<Violation> applyTo(SourceCode sourceCode)

      Apply this rule to the specified source and return a list of violations (or an empty List)

      throws:
        Throwable could throw anything
      Parameters:
        `sourceCode` - - the source to apply this rule to
      Returns:
        the List of violations; may be empty

    - #### public int getCompilerPhase()

      Returns:
        the required compiler phase (as in org.codehaus.groovy.control.Phases) of the AST of the SourceCode handed to the rule via applyTo(SourceCode sourceCode)

    - #### public String getName()

      Returns:
        the unique id for this rule

    - #### public int getPriority()

      Returns:
        the priority of this rule; must be 1, 2 or 3