use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_MethodNames method nameHasPrefixOrPostfixTag.
@Test
public void nameHasPrefixOrPostfixTag() throws CFLintScanException {
final String tagSrc = "<cfcomponent>\r\n" + "<cffunction name=\"methodNameArr\">\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(tagSrc, "test");
final List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("METHOD_HAS_PREFIX_OR_POSTFIX", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_MethodNames method nameIsTemporyScript.
@Test
public void nameIsTemporyScript() throws CFLintScanException {
final String scriptSrc = "component {\r\n" + "function temp() {\r\n" + "}\r\n" + "}";
CFLintResult lintresult = cfBugs.scan(scriptSrc, "test");
final List<BugInfo> result = lintresult.getIssues().get("METHOD_IS_TEMPORARY");
assertEquals(1, result.size());
assertEquals("METHOD_IS_TEMPORARY", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_MethodNames method nameTooWordyTag.
@Test
public void nameTooWordyTag() throws CFLintScanException {
final String tagSrc = "<cfcomponent>\r\n" + "<cffunction name=\"methodNameIsFarTooWordy\">\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(tagSrc, "test");
final List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("METHOD_TOO_WORDY", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_MethodNames method testUpercaseNameTag.
@Test
public void testUpercaseNameTag() throws CFLintScanException {
final String tagSrc = "<cfcomponent>\r\n" + "<cffunction name=\"UGLYNAME\">\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(tagSrc, "test");
final List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("METHOD_ALLCAPS_NAME", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_MethodNames method invalidCharsInNameScript.
@Test
public void invalidCharsInNameScript() throws CFLintScanException {
final String scriptSrc = "component {\r\n" + "function method$name() {\r\n" + "}\r\n" + "}";
CFLintResult lintresult = cfBugs.scan(scriptSrc, "test");
final List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("METHOD_INVALID_NAME", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
Aggregations