Line cannot be too long

# L004

# Line cannot be too long

Description:

The source code line should not exceed some reasonable length.

Recognized parameters:

Name | Default | Description
--- | --- | ---
`max-line-length` | `100` | Maximum length of source code line.

Compliance: Inspirel

Show source code for this rule

Hide source code

    # Line cannot be too long

    set maxLength [getParameter "max-line-length" 100]

    foreach f [getSourceFileNames] {
        set lineNumber 1
        foreach line [getAllLines $f] {
            if {[string length $line] > $maxLength} {
                report $f $lineNumber "line is longer than ${maxLength} characters"
            }
            incr lineNumber
        }
    }

Rule index