Remove trailing white space

# trim_right

# Remove trailing white space

Description:

This transformation removes the trailing whitespace from each line of code.

It can be treated as a quick remedy for problems reported by rule L001.

Note: The transformation is performed in place, which means that the source files are modified.

Show source code for this transformation

Hide source code

    # trim each line by removing trailing whitespace

    foreach fileName [getSourceFileNames] {
        set lines [getAllLines $fileName]
        set newFile [open $fileName "w"]
        foreach line $lines {
            set newLine [string trimright $line]
            puts $newFile $newLine
        }
        close $newFile
    }

Transformation index