use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testCFScriptFor.
@Test
public void testCFScriptFor() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"rateBop\" >\r\n" + "<cfargument name=\"quote\">\r\n" + "\r\n" + "<cfscript>\r\n" + "for (i = 0; i < 100; i + 5) {\r\n" + "xx=123;\r\n" + "}\r\n" + "</cfscript>\r\n" + "</cffunction>" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(2, result.size());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testCFScriptCfc.
@Test
public void testCFScriptCfc() throws CFLintScanException {
final String cfcSrc = "/** \r\n" + "* Simple Component. \r\n" + "*/ \r\n" + "component { \r\n" + "/** \r\n" + "* Simple function. \r\n" + "*/ \r\n" + "public void function foo() { \r\n" + "xx=123; \r\n" + "} \r\n" + "}";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("MISSING_VAR", result.get(0).getMessageCode());
assertEquals(9, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testSimpleCFSETNoParse.
@Test
public void testSimpleCFSETNoParse() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + " <cfset x=123/>" + " <cfset var y=123/>\r\n" + "</cffunction>\r\n" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
// Note
assertEquals("MISSING_VAR", result.get(0).getMessageCode());
// parsing
// error
// fixed
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testCFScriptForUnVarred.
@Test
public void testCFScriptForUnVarred() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"func1\">\r\n" + " <cfscript>\r\n" + " for (a=1;a LTE arraylen(d); a=a+1) {\r\n" + " if(d[a].getName() EQ drawer){\r\n" + " return d[a];\r\n" + " }\r\n" + " }\r\n" + " </cfscript>\r\n" + "</cffunction>" + "</cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
List<BugInfo> result = lintresult.getIssues().values().iterator().next();
assertEquals(1, result.size());
assertEquals("MISSING_VAR", result.get(0).getMessageCode());
assertEquals(4, result.get(0).getLine());
}
use of com.cflint.api.CFLintResult in project CFLint by cflint.
the class TestCFBugs method testSimpleCFQUERYIssue30.
@Test
public void testSimpleCFQUERYIssue30() throws CFLintScanException {
final String cfcSrc = "<cfcomponent>\r\n" + "<cffunction name=\"test\">\r\n" + " <cfoutput query=\"qryPopups\" group=\"id\">\n" + " <cfif message NEQ \"\" and not(ListFind(arraytoList( arguments.quote.getErrorHandler().getShownErrors()),id))>\n" + " <cfoutput>#message####id#|</cfoutput>\n" + " <cfset arrayappend(arguments.quote.getErrorHandler().getShownErrors(),id)>\n" + " </cfif>\n" + " <cflog file=\"Quote_#quote.getOnlineNumber()#\" text=\"Popup:#message#,#id#\" type=\"informational\">\n" + " </cfoutput>\r\n" + "</cffunction>\r\n" + "/<cfcomponent>";
CFLintResult lintresult = cfBugs.scan(cfcSrc, "test");
assertEquals(0, lintresult.getIssues().size());
}
Aggregations