All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.cflint.plugins.core.LengthChecker Maven / Gradle / Ivy

Go to download

A static code analysis tool for ColdFusion (in the spirit of FindBugs and Lint). With CFLint, you are able to analyze your ColdFusion code base for code violations.

There is a newer version: 1.5.0
Show newest version
package com.cflint.plugins.core;

import com.cflint.BugList;
import com.cflint.plugins.CFLintScannerAdapter;
import com.cflint.plugins.Context;

/**
 * Check the length of a block of code.
 */
public class LengthChecker extends CFLintScannerAdapter {

    /**
     *  Check the length of a block of code.
     *
     * @param maxLength maximimum length.
     * @param message message to display.
     * @param context current context.
     * @param atLine  current line.
     * @param atOffset current offset.
     * @param linesLength no of lines.
     * @param bugs list of bugs.
     */
    protected void checkSize(final int maxLength, final String message, final Context context, final int atLine, final int atOffset, final int linesLength, final BugList bugs) {
        final String lengthThreshold = context.getConfiguration().getParameter(this,"length");
        int length = maxLength;

        if (lengthThreshold != null) {
            length = Integer.parseInt(lengthThreshold);
        }

        if (linesLength > length) {
            context.addMessage(message, Integer.toString(linesLength), this, atLine, atOffset);

        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy