use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_TooManyArguments method testLargeNumberScriptBased.
@Test
public void testLargeNumberScriptBased() throws CFLintScanException {
final String cfcSrc = "component {\r\n" + "public void function someFunction(argumentOne, argumentTwo, argumentThree," + "argumentFour, argumentFive, argumentSix, argumentSeven," + "argumentEight, argumentNine, intargumentTen, argumentEleven) {\r\n" + " var a = 1;\r\n" + "}\r\n" + "}";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
final List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("EXCESSIVE_ARGUMENTS", result.get(0).getMessageCode());
assertEquals(2, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_VarScoper method testCFProcParam_InOut.
@Test
public void testCFProcParam_InOut() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + " <cfset var yy=\"\"/>\r\n" + " <cfstoredproc name=\"yy\" >\r\n" + " <cfprocparam variable=\"xx\" type=\"inout\">\r\n" + " </cfstoredproc>\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(1, lintresult.getIssues().size());
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("MISSING_VAR", result.get(0).getMessageCode());
assertEquals("xx", result.get(0).getVariable());
assertEquals(5, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_VarScoper method testScript_UnVard.
@Test
public void testScript_UnVard() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + " <cfscript>\r\n" + " yy = 123;\r\n" + " </cfscript>\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(1, lintresult.getIssues().size());
List<BugInfo> result = lintresult.getIssues().get("MISSING_VAR");
assertEquals(1, result.size());
assertEquals("MISSING_VAR", result.get(0).getMessageCode());
assertEquals("yy", result.get(0).getVariable());
assertEquals(4, result.get(0).getLine());
assertEquals(4, result.get(0).getLine());
assertEquals(Levels.ERROR, result.get(0).getSeverity());
assertEquals("Variable yy is not declared with a var statement.", result.get(0).getMessage());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_VarScoper method testCFFeed_Read_Vard.
// @Test
// public void testCFProcParam_In() throws CFLintScanException{
// final String cfcSrc = "<cfcomponent>\r\n" +
// "<cffunction name=\"test\">\r\n" +
// " <cfset var yy=\"\"/>\r\n" +
// " <cfstoredproc name=\"yy\" >\r\n" +
// " <cfprocparam variable=\"xx\" type=\"in\">\r\n" +
// " </cfstoredproc>\r\n" +
// "</cffunction>\r\n" +
// "</cfcomponent>";
// CFLintResult lintresult = cfBugs.scan(cfcSrc,"test");
// assertEquals(0,lintresult.getIssues().size());
// }
@Test
public void testCFFeed_Read_Vard() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + " <cfset var yy=\"\"/>\r\n" + " <cffeed query=\"yy\" action=\"read\">\r\n" + " </cffeed>\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(0, lintresult.getIssues().size());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs_VarScoper method testScript_UnVard_ArrayFalsePositive.
@Test
public void testScript_UnVard_ArrayFalsePositive() throws CFLintScanException {
final String cfcSrc = "<cffunction name=\"x\"><cfset var myRet = [] />\n" + "\n" + "<cfstoredproc>\n" + " <cfprocresult name=\"myRet[1]\" resultset=\"1\" />\n" + " <cfprocresult name=\"myRet[2]\" resultset=\"2\" />\n" + " <cfprocresult name=\"myRet[3]\" resultset=\"3\" />\n" + "</cfstoredproc></cffunction>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(0, lintresult.getIssues().size());
}
Aggregations