Class CheckstyleConfiguration

  • All Implemented Interfaces:
    com.puppycrawl.tools.checkstyle.api.Configuration, Serializable

    public class CheckstyleConfiguration
    extends Object
    implements com.puppycrawl.tools.checkstyle.api.Configuration
    Dynamic alternative to the default immutable checkstyle configuration, used to add single checks to the treeWalker "super"-check.
    See Also:
    Serialized Form
    • Constructor Detail

      • CheckstyleConfiguration

        public CheckstyleConfiguration​(String name)
      • CheckstyleConfiguration

        public CheckstyleConfiguration​(com.puppycrawl.tools.checkstyle.api.Configuration conf,
                                       Set<String> allowedLeavesIdentifiers)
        Parameters:
        conf - the original checkstyle configuration
        allowedLeavesIdentifiers - if not null, this set restricts the checkstyle configuration to those in the set (format: <module>#<id>, while the <id> is optional).
    • Method Detail

      • getListOfConfiguredCheckIdentifiers

        public List<String> getListOfConfiguredCheckIdentifiers()
      • containsCheck

        public boolean containsCheck​(String identifier)
        Checks if the Configuration contains a Subconfiguration/Module with the given identifier. Ignores the Configuration this method is called on.
        Parameters:
        identifier - identifier of the Subconfiguration/Module/Check.
      • getSubConfigurationByIdentifier

        public CheckstyleConfiguration getSubConfigurationByIdentifier​(String identifier)
        Gets the first Subconfiguration/Module/Check with the given identifier in post-order. Ignores the Configuration this method is called on.
        Parameters:
        identifier - given identifier
        Returns:
        the found subconfiguration (or null, if not found)
      • getAttributeNames

        public String[] getAttributeNames()
        Specified by:
        getAttributeNames in interface com.puppycrawl.tools.checkstyle.api.Configuration
      • getPropertyNames

        public String[] getPropertyNames()
        Specified by:
        getPropertyNames in interface com.puppycrawl.tools.checkstyle.api.Configuration
      • getAttribute

        public String getAttribute​(String name)
                            throws com.puppycrawl.tools.checkstyle.api.CheckstyleException
        Specified by:
        getAttribute in interface com.puppycrawl.tools.checkstyle.api.Configuration
        Throws:
        com.puppycrawl.tools.checkstyle.api.CheckstyleException
      • getProperty

        public String getProperty​(String name)
                           throws com.puppycrawl.tools.checkstyle.api.CheckstyleException
        Specified by:
        getProperty in interface com.puppycrawl.tools.checkstyle.api.Configuration
        Throws:
        com.puppycrawl.tools.checkstyle.api.CheckstyleException
      • setAttribute

        public void setAttribute​(String attributeName,
                                 String value)
      • getChildren

        public com.puppycrawl.tools.checkstyle.api.Configuration[] getChildren()
        Specified by:
        getChildren in interface com.puppycrawl.tools.checkstyle.api.Configuration
      • getName

        public String getName()
        Specified by:
        getName in interface com.puppycrawl.tools.checkstyle.api.Configuration
      • getIdentifier

        public String getIdentifier()
      • getMessages

        public com.google.common.collect.ImmutableMap<String,​String> getMessages()
        Specified by:
        getMessages in interface com.puppycrawl.tools.checkstyle.api.Configuration
      • setMetadata

        public void setMetadata​(CheckMetadata metadata)
      • isReplaceTabs

        public boolean isReplaceTabs​(String identifier)
      • getMaxReportsPerFile

        public int getMaxReportsPerFile​(String identifier)
      • getCiteLinesBefore

        public int getCiteLinesBefore​(String identifier)
      • getCiteLinesAfter

        public int getCiteLinesAfter​(String identifier)