From 1941dff1f1b00e8a226fd0e1b6609bd623d0f24d Mon Sep 17 00:00:00 2001 From: Justin Mclean Date: Mon, 5 Oct 2015 19:14:32 +1100 Subject: [PATCH 1/3] Test for cfabort tag --- .../java/com/cflint/TestCFAbortChecker.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 src/test/java/com/cflint/TestCFAbortChecker.java diff --git a/src/test/java/com/cflint/TestCFAbortChecker.java b/src/test/java/com/cflint/TestCFAbortChecker.java new file mode 100644 index 000000000..0045ce4fe --- /dev/null +++ b/src/test/java/com/cflint/TestCFAbortChecker.java @@ -0,0 +1,47 @@ +package com.cflint; + +import static org.junit.Assert.assertEquals; + +import java.io.IOException; + +import org.junit.Before; +import org.junit.Test; + +import cfml.parsing.reporting.ParseException; + +import com.cflint.config.CFLintPluginInfo.PluginInfoRule; +import com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage; +import com.cflint.config.ConfigRuntime; +import com.cflint.plugins.core.CFXTagChecker; + +public class TestCFAbortChecker { + + private CFLint cfBugs; + + @Before + public void setUp() { + final ConfigRuntime conf = new ConfigRuntime(); + final PluginInfoRule pluginRule = new PluginInfoRule(); + pluginRule.setName("CFXTagChecker"); + pluginRule.addParameter("tagName", "cfabort"); + conf.getRules().add(pluginRule); + final PluginMessage pluginMessage = new PluginMessage("AVOID_USING_CFABORT_TAG"); + pluginMessage.setSeverity("INFO"); + pluginMessage.setMessageText("Avoid Leaving <${tagName}> tags in committed code."); + pluginRule.getMessages().add(pluginMessage); + final CFXTagChecker checker = new CFXTagChecker(); + checker.setParameter("tagName", "cfabort"); + cfBugs = new CFLint(conf, checker); + } + + @Test + public void test_BAD() throws ParseException, IOException { + + final String cfcSrc = ""; + cfBugs.process(cfcSrc, "test"); + assertEquals(1, cfBugs.getBugs().getBugList().size()); + assertEquals("Avoid Leaving tags in committed code.", + cfBugs.getBugs().getFlatBugList().get(0).getMessage()); + } + +} From 476c2855149a8c82fe473cce96c348db15fc13a5 Mon Sep 17 00:00:00 2001 From: Justin Mclean Date: Mon, 5 Oct 2015 19:15:04 +1100 Subject: [PATCH 2/3] Added rule for cfabort tag --- src/main/resources/cflint.definition.xml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/resources/cflint.definition.xml b/src/main/resources/cflint.definition.xml index 64100bee5..83cc99350 100644 --- a/src/main/resources/cflint.definition.xml +++ b/src/main/resources/cflint.definition.xml @@ -73,6 +73,13 @@ + + + Avoid Leaving <${tagName}> tags in committed code. Did you accidently leave a cfabort in the code? + INFO + + + Avoid using <${tagName}> tags. Use cfquery and cfstoredproc instead. From 3257b165492fe963bfa07a2505e035f033863a99 Mon Sep 17 00:00:00 2001 From: ryaneberly Date: Tue, 6 Oct 2015 06:42:33 -0400 Subject: [PATCH 3/3] Fix cfabort checker definition. cfdump -> cfabort --- src/main/resources/cflint.definition.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/cflint.definition.xml b/src/main/resources/cflint.definition.xml index 83cc99350..51412426b 100644 --- a/src/main/resources/cflint.definition.xml +++ b/src/main/resources/cflint.definition.xml @@ -78,7 +78,7 @@ Avoid Leaving <${tagName}> tags in committed code. Did you accidently leave a cfabort in the code? INFO - +