Search in sources :

Example 6 with CFLintPluginInfo

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

the class TestCFTagUppercaseChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    PluginInfoRule pluginRule = new PluginInfoRule();
    pluginRule.setName("CFTagCaseChecker");
    conf.getRules().add(pluginRule);
    PluginMessage pluginMessage = new PluginMessage("CFTAG_PREFERRED_CASE");
    pluginMessage.setSeverity(Levels.ERROR);
    pluginMessage.setMessageText("Tag <${variable}> should be written in lowercase or camelCase for consistency in code.");
    pluginRule.getMessages().add(pluginMessage);
    CFLintPluginInfo pluginInfo = new CFLintPluginInfo();
    pluginInfo.getRules().add(pluginRule);
    pluginRule.setClassName("CFTagCaseChecker");
    pluginRule.addParameter("PreferCase", "upper");
    cfBugs = new CFLintAPI(new ConfigBuilder(pluginInfo).include("CFTAG_PREFERRED_CASE").build());
    cfBugs.setLogError(false);
}
Also used : CFLintAPI(com.cflint.api.CFLintAPI) CFLintPluginInfo(com.cflint.config.CFLintPluginInfo) CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) ConfigBuilder(com.cflint.config.ConfigBuilder) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 7 with CFLintPluginInfo

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

the class TestCFTagLowercaseChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    PluginInfoRule pluginRule = new PluginInfoRule();
    pluginRule.setName("CFTagCaseChecker");
    conf.getRules().add(pluginRule);
    PluginMessage pluginMessage = new PluginMessage("CFTAG_PREFERRED_CASE");
    pluginMessage.setSeverity(Levels.ERROR);
    pluginMessage.setMessageText("Tag <${variable}> should be written in lowercase or camelCase for consistency in code.");
    pluginRule.getMessages().add(pluginMessage);
    CFLintPluginInfo pluginInfo = new CFLintPluginInfo();
    pluginInfo.getRules().add(pluginRule);
    pluginRule.setClassName("CFTagCaseChecker");
    pluginRule.addParameter("PreferCase", "lower");
    cfBugs = new CFLintAPI(new ConfigBuilder(pluginInfo).include("CFTAG_PREFERRED_CASE").build());
    cfBugs.setLogError(false);
}
Also used : CFLintAPI(com.cflint.api.CFLintAPI) CFLintPluginInfo(com.cflint.config.CFLintPluginInfo) CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) ConfigBuilder(com.cflint.config.ConfigBuilder) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Example 8 with CFLintPluginInfo

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

the class TestCFCustomTagChecker method setUp.

@Before
public void setUp() throws Exception {
    final CFLintConfig conf = new CFLintConfig();
    final PluginInfoRule pluginRuleX = new PluginInfoRule();
    pluginRuleX.setName("CFXTagChecker");
    conf.getRules().add(pluginRuleX);
    final PluginMessage pluginMessageX = new PluginMessage("AVOID_USING_MYLIB:CFCUSTOMTAG_TAG");
    pluginMessageX.setSeverity(Levels.WARNING);
    pluginMessageX.setMessageText("Avoid Leaving <${tagName}> tags in committed code. Debug information should be ommited from release code");
    pluginRuleX.getMessages().add(pluginMessageX);
    pluginRuleX.addParameter("tagName", ".*:cfcustomtag");
    CFLintPluginInfo pluginInfo = new CFLintPluginInfo();
    pluginInfo.getRules().add(pluginRuleX);
    pluginRuleX.setClassName("CFXTagChecker");
    cfBugs = new CFLintAPI(new ConfigBuilder(pluginInfo).include("AVOID_USING_MYLIB:CFCUSTOMTAG_TAG").build());
    cfBugs.setLogError(false);
}
Also used : CFLintAPI(com.cflint.api.CFLintAPI) CFLintPluginInfo(com.cflint.config.CFLintPluginInfo) CFLintConfig(com.cflint.config.CFLintConfig) PluginMessage(com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage) ConfigBuilder(com.cflint.config.ConfigBuilder) PluginInfoRule(com.cflint.config.CFLintPluginInfo.PluginInfoRule) Before(org.junit.Before)

Aggregations

CFLintPluginInfo (com.cflint.config.CFLintPluginInfo)8 CFLintConfig (com.cflint.config.CFLintConfig)6 PluginInfoRule (com.cflint.config.CFLintPluginInfo.PluginInfoRule)5 PluginMessage (com.cflint.config.CFLintPluginInfo.PluginInfoRule.PluginMessage)5 ConfigBuilder (com.cflint.config.ConfigBuilder)4 CFLintAPI (com.cflint.api.CFLintAPI)3 Before (org.junit.Before)3 MarshallerException (com.cflint.xml.MarshallerException)2 IOException (java.io.IOException)2 PrintWriter (java.io.PrintWriter)2 JAXBException (javax.xml.bind.JAXBException)2 TransformerException (javax.xml.transform.TransformerException)2 CFLintChainedConfig (com.cflint.config.CFLintChainedConfig)1 CFLintConfigurationException (com.cflint.exception.CFLintConfigurationException)1 CFLintScanException (com.cflint.exception.CFLintScanException)1 FileInputStream (java.io.FileInputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileWriter (java.io.FileWriter)1 StringWriter (java.io.StringWriter)1 CommandLine (org.apache.commons.cli.CommandLine)1