Search in sources :

Example 6 with PluginInfoRule

use of com.cflint.config.CFLintPluginInfo.PluginInfoRule in project CFLint by cflint.

the class TestCFAbortChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    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);
    cfBugs = new CFLint(conf);
}
Also used : CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 7 with PluginInfoRule

use of com.cflint.config.CFLintPluginInfo.PluginInfoRule in project CFLint by cflint.

the class TestCFBugs method setUp.

@Before
public void setUp() throws IOException {
    CFLintConfig conf = new CFLintConfig();
    PluginInfoRule pluginRule = new PluginInfoRule();
    pluginRule.setName("VarScoper");
    conf.getRules().add(pluginRule);
    PluginMessage pluginMessage = new PluginMessage("MISSING_VAR");
    pluginMessage.setSeverity("ERROR");
    pluginMessage.setMessageText("Variable ${variable} is not declared with a var statement.");
    pluginRule.getMessages().add(pluginMessage);
    pluginRule = new PluginInfoRule();
    pluginRule.setName("GlobalVarChecker");
    conf.getRules().add(pluginRule);
    pluginMessage = new PluginMessage("GLOBAL_VAR");
    pluginMessage.setSeverity("WARNING");
    pluginMessage.setMessageText("Identifier ${variable} is global, referencing in a CFC or function should be avoided.");
    pluginRule.getMessages().add(pluginMessage);
    pluginRule = new PluginInfoRule();
    pluginRule.setName("NestedCFOutput");
    conf.getRules().add(pluginRule);
    pluginMessage = new PluginMessage("NESTED_CFOUTPUT");
    pluginMessage.setSeverity("ERROR");
    pluginMessage.setMessageText("Nested CFOutput, outer CFOutput has @query.");
    pluginRule.getMessages().add(pluginMessage);
    pluginRule = new PluginInfoRule();
    pluginRule.setName("TypedQueryNew");
    conf.getRules().add(pluginRule);
    pluginMessage = new PluginMessage("QUERYNEW_DATATYPE");
    pluginMessage.setSeverity("WARNING");
    pluginMessage.setMessageText("QueryNew statement should specify datatypes.");
    pluginRule.getMessages().add(pluginMessage);
    cfBugs = new CFLint(conf);
    cfBugs.setLogError(true);
}
Also used : CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 8 with PluginInfoRule

use of com.cflint.config.CFLintPluginInfo.PluginInfoRule in project CFLint by cflint.

the class TestCFBugsTagless method setUp.

@Before
public void setUp() throws IOException {
    CFLintConfig conf = new CFLintConfig();
    PluginInfoRule pluginRule = new PluginInfoRule();
    pluginRule.setName("VarScoper");
    conf.getRules().add(pluginRule);
    PluginMessage pluginMessage = new PluginMessage("MISSING_VAR");
    pluginMessage.setSeverity("ERROR");
    pluginMessage.setMessageText("Variable ${variable} is not declared with a var statement.");
    pluginRule.getMessages().add(pluginMessage);
    cfBugs = new CFLint(conf);
}
Also used : CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 9 with PluginInfoRule

use of com.cflint.config.CFLintPluginInfo.PluginInfoRule in project CFLint by cflint.

the class TestCFBugs_VarScoper_Names method setUp.

@Before
public void setUp() {
    CFLintConfig conf = new CFLintConfig();
    PluginInfoRule pluginRule = new PluginInfoRule();
    pluginRule.setName("VarScoper");
    conf.getRules().add(pluginRule);
    PluginMessage pluginMessage = new PluginMessage("MISSING_VAR");
    pluginMessage.setSeverity("ERROR");
    pluginMessage.setMessageText("Variable ${variable} is not declared with a var statement.");
    pluginRule.getMessages().add(pluginMessage);
    cfBugs = new CFLint(conf, new VarScoper());
}
Also used : CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) VarScoper(com.cflint.plugins.core.VarScoper) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 10 with PluginInfoRule

use of com.cflint.config.CFLintPluginInfo.PluginInfoRule in project CFLint by cflint.

the class TestCFDumpChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    final PluginInfoRule pluginRuleX = new PluginInfoRule();
    pluginRuleX.setName("CFXTagChecker");
    pluginRuleX.addParameter("tagName", "cfdump");
    conf.getRules().add(pluginRuleX);
    final PluginMessage pluginMessageX = new PluginMessage("AVOID_USING_CFDUMP_TAG");
    pluginMessageX.setSeverity("WARNING");
    pluginMessageX.setMessageText("Avoid Leaving <${tagName}> tags in committed code. Debug information should be ommited from release code");
    pluginRuleX.getMessages().add(pluginMessageX);
    final CFXTagChecker checker = new CFXTagChecker();
    checker.setParameter("tagName", "cfdump");
    cfBugs = new CFLint(conf, checker);
}
Also used : CFXTagChecker(com.cflint.plugins.core.CFXTagChecker) CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Aggregations

PluginInfoRule (com.cflint.config.CFLintPluginInfo.PluginInfoRule)37 PluginMessage (com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage)37 CFLintConfig (com.cflint.config.CFLintConfig)33 Before (org.junit.Before)32 CFXTagChecker (com.cflint.plugins.core.CFXTagChecker)6 VarScoper (com.cflint.plugins.core.VarScoper)4 FunctionXChecker (com.cflint.plugins.core.FunctionXChecker)3 RuleGroup (com.cflint.config.CFLintPluginInfo.RuleGroup)2 ArgDefChecker (com.cflint.plugins.core.ArgDefChecker)2 CFTagCaseChecker (com.cflint.plugins.core.CFTagCaseChecker)2 QueryParamChecker (com.cflint.plugins.core.QueryParamChecker)2 Test (org.junit.Test)2 CFExpression (cfml.parsing.cfscript.CFExpression)1 CFStatement (cfml.parsing.cfscript.CFStatement)1 CFScriptStatement (cfml.parsing.cfscript.script.CFScriptStatement)1 BugInfoBuilder (com.cflint.BugInfo.BugInfoBuilder)1 CFLintChainedConfig (com.cflint.config.CFLintChainedConfig)1 CFLintPluginInfo (com.cflint.config.CFLintPluginInfo)1 CFLintScanner (com.cflint.plugins.CFLintScanner)1 ArgHintChecker (com.cflint.plugins.core.ArgHintChecker)1