Search in sources :

Example 6 with CFLintConfig

use of com.cflint.config.CFLintConfig in project CFLint by cflint.

the class TestCFModuleTagChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    final PluginInfoRule pluginRuleX = new PluginInfoRule();
    pluginRuleX.setName("CFXTagChecker");
    pluginRuleX.addParameter("tagName", "cfmodule");
    conf.getRules().add(pluginRuleX);
    final PluginMessage pluginMessageX = new PluginMessage("AVOID_USING_CFMODULE_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", "cfmodule");
    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)

Example 7 with CFLintConfig

use of com.cflint.config.CFLintConfig 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 8 with CFLintConfig

use of com.cflint.config.CFLintConfig 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 9 with CFLintConfig

use of com.cflint.config.CFLintConfig 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 10 with CFLintConfig

use of com.cflint.config.CFLintConfig 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)

Aggregations

CFLintConfig (com.cflint.config.CFLintConfig)37 PluginMessage (com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage)34 PluginInfoRule (com.cflint.config.CFLintPluginInfo.PluginInfoRule)33 Before (org.junit.Before)33 CFXTagChecker (com.cflint.plugins.core.CFXTagChecker)6 VarScoper (com.cflint.plugins.core.VarScoper)5 FunctionXChecker (com.cflint.plugins.core.FunctionXChecker)3 FileInputStream (java.io.FileInputStream)3 IOException (java.io.IOException)3 CFLintChainedConfig (com.cflint.config.CFLintChainedConfig)2 CFLintPluginInfo (com.cflint.config.CFLintPluginInfo)2 ArgDefChecker (com.cflint.plugins.core.ArgDefChecker)2 CFTagCaseChecker (com.cflint.plugins.core.CFTagCaseChecker)2 QueryParamChecker (com.cflint.plugins.core.QueryParamChecker)2 FileNotFoundException (java.io.FileNotFoundException)2 JAXBException (javax.xml.bind.JAXBException)2 TransformerException (javax.xml.transform.TransformerException)2 CFLint (com.cflint.CFLint)1 HTMLOutput (com.cflint.HTMLOutput)1 TextOutput (com.cflint.TextOutput)1