Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.puppycrawl.tools.checkstyle.filters
Class SuppressWithNearbyCommentFilter

    java.lang.Object
      com.puppycrawl.tools.checkstyle.api.AutomaticBean
          com.puppycrawl.tools.checkstyle.filters.SuppressWithNearbyCommentFilter

All Implemented Interfaces:
  Configurable, Contextualizable, Filter

    public class SuppressWithNearbyCommentFilter

extends AutomaticBean
implements Filter

A filter that uses nearby comments to suppress audit events.

This check is philosophically similar to `SuppressionCommentFilter`. Unlike `SuppressionCommentFilter`, this filter does not require pairs of comments. This check may be used to suppress warnings in the current line:

        offendingLine(for, whatever, reason); // SUPPRESS ParameterNumberCheck

or it may be configured to span multiple lines, either forward:

        // PERMIT MultipleVariableDeclarations NEXT 3 LINES
        double x1 = 1.0, y1 = 0.0, z1 = 0.0;
        double x2 = 0.0, y2 = 1.0, z2 = 0.0;
        double x3 = 0.0, y3 = 0.0, z3 = 1.0;

or reverse:

       try {
         thirdPartyLibrary.method();
       } catch (RuntimeException e) {
         // ALLOW ILLEGAL CATCH BECAUSE third party API wraps everything
         // in RuntimeExceptions.
         ...
       }

See `SuppressionCommentFilter` for usage notes.

Author:
  Mick Killianey

Nested Class Summary
`class` | `SuppressWithNearbyCommentFilter.Tag` A Tag holds a suppression comment and its location.

Constructor Summary
`SuppressWithNearbyCommentFilter()` Constructs a SuppressionCommentFilter.

Method Summary
`boolean` | `accept(AuditEvent aEvent)` Determines whether or not a filtered AuditEvent is accepted.
`FileContents` | `getFileContents()`
`void` | `setCheckC(boolean aCheckC)` Set whether to look in C comments.
`void` | `setCheckCPP(boolean aCheckCPP)` Set whether to look in C++ comments.
`void` | `setCheckFormat(String aFormat)` Set the format for a check.
`void` | `setCommentFormat(String aFormat)` Set the format for a comment that turns off reporting.
`void` | `setFileContents(FileContents aFileContents)` Set the FileContents for this filter.
`void` | `setInfluenceFormat(String aFormat)` Set the format for the influence of this check.
`void` | `setMessageFormat(String aFormat)` Set the format for a message.

Methods inherited from class com.puppycrawl.tools.checkstyle.api.AutomaticBean
`configure, contextualize, finishLocalSetup, getConfiguration, setupChild`

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

Constructor Detail

### SuppressWithNearbyCommentFilter

    public SuppressWithNearbyCommentFilter()

  Constructs a SuppressionCommentFilter. Initializes comment on, comment off, and check formats to defaults.

Method Detail

### setCommentFormat

    public void setCommentFormat(String aFormat)
                          throws org.apache.commons.beanutils.ConversionException

  Set the format for a comment that turns off reporting.

  Parameters:
    `aFormat` - a `String` value.
  Throws:
    `org.apache.commons.beanutils.ConversionException` - unable to parse aFormat.

### getFileContents

    public FileContents getFileContents()

  Returns:
    the FileContents for this filter.

### setFileContents

    public void setFileContents(FileContents aFileContents)

  Set the FileContents for this filter.

  Parameters:
    `aFileContents` - the FileContents for this filter.

### setCheckFormat

    public void setCheckFormat(String aFormat)
                        throws org.apache.commons.beanutils.ConversionException

  Set the format for a check.

  Parameters:
    `aFormat` - a `String` value
  Throws:
    `org.apache.commons.beanutils.ConversionException` - unable to parse aFormat

### setMessageFormat

    public void setMessageFormat(String aFormat)
                          throws org.apache.commons.beanutils.ConversionException

  Set the format for a message.

  Parameters:
    `aFormat` - a `String` value
  Throws:
    `org.apache.commons.beanutils.ConversionException` - unable to parse aFormat

### setInfluenceFormat

    public void setInfluenceFormat(String aFormat)
                            throws org.apache.commons.beanutils.ConversionException

  Set the format for the influence of this check.

  Parameters:
    `aFormat` - a `String` value
  Throws:
    `org.apache.commons.beanutils.ConversionException` - unable to parse aFormat

### setCheckCPP

    public void setCheckCPP(boolean aCheckCPP)

  Set whether to look in C++ comments.

  Parameters:
    `aCheckCPP` - `true` if C++ comments are checked.

### setCheckC

    public void setCheckC(boolean aCheckC)

  Set whether to look in C comments.

  Parameters:
    `aCheckC` - `true` if C comments are checked.

### accept

    public boolean accept(AuditEvent aEvent)

  Determines whether or not a filtered AuditEvent is accepted.

  Specified by:
    `accept` in interface `Filter`
  Parameters:
    `aEvent` - the AudtiEvent to filter.
  Returns:
    true if the aEvent is accepted.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2011. All Rights Reserved.