Class NestedForDepthCheck

  • All Implemented Interfaces:
    Configurable, Contextualizable

    public final class NestedForDepthCheck
    extends AbstractCheck

    Restricts nested for blocks to a specified depth.

    • Property max - Specify maximum allowed nesting depth. Type is int. Default value is 1.

    Parent is com.puppycrawl.tools.checkstyle.TreeWalker

    Violation Message Keys:

    • nested.for.depth
    Since:
    5.3
    • Field Detail

      • MSG_KEY

        public static final java.lang.String MSG_KEY
        A key is pointing to the warning message text in "messages.properties" file.
        See Also:
        Constant Field Values
      • max

        private int max
        Specify maximum allowed nesting depth.
      • depth

        private int depth
        Current nesting depth.