Domanda

What actuallly does severity level set as "inherit" mean in a checkstyle rule?

tried googling a lot couldn't find an actual definition for this-

È stato utile?

Soluzione

The Checkstyle rules are configured in a small, but important hierarchy. Checker is at the top, one of its "children" is Treewalker, and so on. Properties can be defined for individual checks, but also for these "parent checks". Thus, your run-of-the-mill Checkstyle configuration file looks like this:

<module name="Checker">
    <property name="severity" value="warning"/>  <!-- NOTE THIS -->
    <module name="TreeWalker">
        <property name="tabWidth" value="4"/>
        <module name="JavadocMethod">
            <property name="scope" value="public"/>
        </module>
    <!-- and so on -->
    </module>
    <!-- and so on -->
</module>

As you can see, there is the severity property of Checker, the topmost module. If a check somewhere lower in the hierarchy has its severity set to inherit (which is the same as not setting anything), then its severity will be, in this example, warning.

Altri suggerimenti

Command line properties and ant Checkstyle task properties apply to the root Checker module. Also, properties are inherited in the module hierarchy.

See Checkstyle documentation for further details.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top