diff --git a/src/main/java/com/cflint/plugins/core/WriteDumpChecker.java b/src/main/java/com/cflint/plugins/core/WriteDumpChecker.java index 0aeea0eea..54ba616bf 100644 --- a/src/main/java/com/cflint/plugins/core/WriteDumpChecker.java +++ b/src/main/java/com/cflint/plugins/core/WriteDumpChecker.java @@ -1,9 +1,11 @@ package com.cflint.plugins.core; +import javax.swing.plaf.synth.SynthScrollBarUI; + import ro.fortsoft.pf4j.Extension; import net.htmlparser.jericho.Element; - import cfml.parsing.cfscript.CFExpression; +import cfml.parsing.cfscript.CFFunctionExpression; import cfml.parsing.cfscript.script.CFExpressionStatement; import cfml.parsing.cfscript.script.CFScriptStatement; @@ -16,29 +18,45 @@ public class WriteDumpChecker extends CFLintScannerAdapter { final String severity = "INFO"; + + @Override - public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) { - if (expression instanceof CFExpressionStatement) { - String code = ((CFExpressionStatement) expression).getExpression().Decompile(0); - int lineNo = ((CFExpressionStatement) expression).getLine() + context.startLine() - 1; - - if (code.toLowerCase().contains("writedump(")) { + public void expression(final CFExpression expression, final Context context, + final BugList bugs) { + + if(expression instanceof CFFunctionExpression){ + final CFFunctionExpression functionExpression = (CFFunctionExpression) expression; + if(functionExpression.getFunctionName().equalsIgnoreCase("writeDump")){ + final int lineNo = functionExpression.getLine() + context.startLine() - 1; writeDump(lineNo, context, bugs); } } + } - @Override - public void element(final Element element, final Context context, final BugList bugs) { - if (element.getName().equals("cfset")) { - String content = element.getStartTag().getTagContent().toString(); - int lineNo = element.getSource().getRow(element.getBegin()); +// @Override +// public void expression(final CFScriptStatement expression, final Context context, final BugList bugs) { +// if (expression instanceof CFExpressionStatement) { +// String code = ((CFExpressionStatement) expression).getExpression().Decompile(0); +// int lineNo = ((CFExpressionStatement) expression).getLine() + context.startLine() - 1; +// +// if (code.toLowerCase().contains("writedump(")) { +// writeDump(lineNo, context, bugs); +// } +// } +// } - if (content.toLowerCase().contains("writedump(")) { - writeDump(lineNo, context, bugs); - } - } - } +// @Override +// public void element(final Element element, final Context context, final BugList bugs) { +// if (element.getName().equals("cfset")) { +// String content = element.getStartTag().getTagContent().toString(); +// int lineNo = element.getSource().getRow(element.getBegin()); +// +// if (content.toLowerCase().contains("writedump(")) { +// writeDump(lineNo, context, bugs); +// } +// } +// } protected void writeDump(final int lineNo, final Context context, final BugList bugs) { bugs.add(new BugInfo.BugInfoBuilder().setLine(lineNo).setMessageCode("AVOID_USING_WRITEDUMP")