package com.cflint.plugins.core;

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

import cfml.parsing.cfscript.CFExpression;
import cfml.parsing.cfscript.CFFunctionExpression;
import ro.fortsoft.pf4j.Extension;

@Extension
public class FunctionXChecker extends CFLintScannerAdapter {

    @Override
    public void expression(final CFExpression expression, final Context context, final BugList bugs) {
        if (expression instanceof CFFunctionExpression) {
            final String cfmlFunctionCheck = getParameter("functionName");

            final CFFunctionExpression functionExpression = (CFFunctionExpression) expression;
            if (functionExpression.getName().equalsIgnoreCase(cfmlFunctionCheck)) {
                // int lineNo = expression.getLine() + context.startLine() - 1;
                // structNew(lineNo, context, bugs);
                context.addMessage("AVOID_USING_" + cfmlFunctionCheck.toUpperCase(), cfmlFunctionCheck);

            }
        }
    }

}

@@ -268,16 +268,59 @@
 nsion;%0A%0A
+/**%0A * Avoid using function X checker.%0A */%0A
 @Extensi
@@ -384,16 +384,212 @@
 pter %7B%0A%0A
+    /**%0A     * Check an CF expression for use of function X.%0A     *%0A     * @param expression expresison to check.%0A     * @param context expresion context.%0A     * @param bugs list of bugs.%0A     */%0A
     @Ove
@@ -1014,141 +1014,8 @@
 ) %7B%0A
-                // int lineNo = expression.getLine() + context.startLine() - 1;%0A                // structNew(lineNo, context, bugs);%0A
     

add javadocs and remove commented out code