## com.puppycrawl.tools.checkstyle
Class CheckStyleTask

    java.lang.Object
      org.apache.tools.ant.ProjectComponent
          org.apache.tools.ant.Task
              com.puppycrawl.tools.checkstyle.CheckStyleTask

All Implemented Interfaces:
  Cloneable

    public class CheckStyleTask

extends org.apache.tools.ant.Task

An implementation of a ANT task for calling checkstyle. See the documentation of the task for usage.

Author:
  Oliver Burn

Nested Class Summary
`static class` `CheckStyleTask.Formatter` Details about a formatter to be used.
`static class` `CheckStyleTask.FormatterType` Poor mans enumeration for the formatter types.
`static class` `CheckStyleTask.Listener` Represents a custom listener.
`static class` `CheckStyleTask.Property` Represents a property that consists of a key and value.

Field Summary

Fields inherited from class org.apache.tools.ant.Task
`target, taskName, taskType, wrapper`

Fields inherited from class org.apache.tools.ant.ProjectComponent
`description, location, project`

Constructor Summary
`CheckStyleTask()`

Method Summary
`void` `addFileset(org.apache.tools.ant.types.FileSet aFS)` Adds a set of files (nested fileset attribute).
`void` `addFormatter(CheckStyleTask.Formatter aFormatter)` Add a formatter.
`void` `addProperty(CheckStyleTask.Property aProperty)` Add an override property.
`org.apache.tools.ant.types.Path` `createClasspath()`
`void` `execute()`
`protected AuditListener[]` `getListeners()` Return the list of listeners set in this task.
`protected List<File>` `scanFileSets()` returns the list of files (full path name) to process.
`void` `setClasspath(org.apache.tools.ant.types.Path aClasspath)` Set the class path.
`void` `setClasspathRef(org.apache.tools.ant.types.Reference aClasspathRef)` Set the class path from a reference defined elsewhere.
`void` `setConfig(File aFile)`
`void` `setConfigURL(URL aURL)`
`void` `setFailOnViolation(boolean aFail)`
`void` `setFailureProperty(String aPropertyName)` Tells this task to set the named property to "true" when there is a violation.
`void` `setFile(File aFile)`
`void` `setMaxErrors(int aMaxErrors)` Sets the maximum number of errors allowed.
`void` `setMaxWarnings(int aMaxWarnings)` Sets the maximum number of warings allowed.
`void` `setOmitIgnoredModules(boolean aOmit)`
`void` `setProperties(File aProps)` Sets a properties file for use instead of individually setting them.

Methods inherited from class org.apache.tools.ant.Task
`bindToOwner, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, getTaskType, getWrapper, handleErrorFlush, handleErrorOutput, handleFlush, handleInput, handleOutput, init, isInvalid, log, log, log, log, maybeConfigure, perform, reconfigure, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName, setTaskType`

Methods inherited from class org.apache.tools.ant.ProjectComponent
`clone, getDescription, getLocation, getProject, setDescription, setLocation, setProject`

Methods inherited from class java.lang.Object
`equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### CheckStyleTask

    public CheckStyleTask()

Method Detail

### setFailureProperty

    public void setFailureProperty(String aPropertyName)

  Tells this task to set the named property to "true" when there is a violation.

  Parameters:
    `aPropertyName` - the name of the property to set in the event of an failure.

### setFailOnViolation

    public void setFailOnViolation(boolean aFail)

  Parameters:
    `aFail` - whether to fail if a violation is found

### setMaxErrors

    public void setMaxErrors(int aMaxErrors)

  Sets the maximum number of errors allowed. Default is 0.

  Parameters:
    `aMaxErrors` - the maximum number of errors allowed.

### setMaxWarnings

    public void setMaxWarnings(int aMaxWarnings)

  Sets the maximum number of warings allowed. Default is `Integer.MAX_VALUE`.

  Parameters:
    `aMaxWarnings` - the maximum number of warnings allowed.

### addFileset

    public void addFileset(org.apache.tools.ant.types.FileSet aFS)

  Adds a set of files (nested fileset attribute).

  Parameters:
    `aFS` - the file set to add

### addFormatter

    public void addFormatter(CheckStyleTask.Formatter aFormatter)

  Add a formatter.

  Parameters:
    `aFormatter` - the formatter to add for logging.

### addProperty

    public void addProperty(CheckStyleTask.Property aProperty)

  Add an override property.

  Parameters:
    `aProperty` - the property to add

### setClasspath

    public void setClasspath(org.apache.tools.ant.types.Path aClasspath)

  Set the class path.

  Parameters:
    `aClasspath` - the path to locate classes

### setClasspathRef

    public void setClasspathRef(org.apache.tools.ant.types.Reference aClasspathRef)

  Set the class path from a reference defined elsewhere.

  Parameters:
    `aClasspathRef` - the reference to an instance defining the classpath

### createClasspath

    public org.apache.tools.ant.types.Path createClasspath()

  Returns:
    a created path for locating classes

### setFile

    public void setFile(File aFile)

  Parameters:
    `aFile` - the file to be checked

### setConfig

    public void setConfig(File aFile)

  Parameters:
    `aFile` - the configuration file to use

### setConfigURL

    public void setConfigURL(URL aURL)

  Parameters:
    `aURL` - the URL of the configuration to use

### setOmitIgnoredModules

    public void setOmitIgnoredModules(boolean aOmit)

  Parameters:
    `aOmit` - whether to omit ignored modules

### setProperties

    public void setProperties(File aProps)

  Sets a properties file for use instead of individually setting them.

  Parameters:
    `aProps` - the properties File to use

### execute

    public void execute()
                 throws org.apache.tools.ant.BuildException

  Overrides:
    `execute` in class `org.apache.tools.ant.Task`
  Throws:
    `org.apache.tools.ant.BuildException`

### getListeners

    protected AuditListener[] getListeners()
                                    throws ClassNotFoundException,
                                           InstantiationException,
                                           IllegalAccessException,
                                           IOException

  Return the list of listeners set in this task.

  Returns:
    the list of listeners.
  Throws:
    `ClassNotFoundException` - if an error occurs
    `InstantiationException` - if an error occurs
    `IllegalAccessException` - if an error occurs
    `IOException` - if an error occurs

### scanFileSets

    protected List<File> scanFileSets()

  returns the list of files (full path name) to process.

  Returns:
    the list of files included via the filesets.

Copyright © 2001-2011. All Rights Reserved.