forked from cflint/CFLint
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add test with empty rule set and test for ignore:line fix
this add the current source and a check for an ignore line where a bug is found eventually we should maybe add the option of outputting the whole line in question so this is a start toward that closes cflint#741
- Loading branch information
Showing
7 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.cflint; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
|
||
import org.junit.Before; | ||
import org.junit.Test; | ||
|
||
import com.cflint.api.CFLintAPI; | ||
import com.cflint.api.CFLintResult; | ||
import com.cflint.config.ConfigBuilder; | ||
import com.cflint.exception.CFLintScanException; | ||
|
||
public class TestIgnoreLine { | ||
|
||
private CFLintAPI cfBugs; | ||
|
||
@Before | ||
public void setUp() throws Exception { | ||
final ConfigBuilder configBuilder = new ConfigBuilder(); | ||
cfBugs = new CFLintAPI(configBuilder.build()); | ||
} | ||
|
||
@Test | ||
public void testIgnoreLines() throws CFLintScanException { | ||
final String scriptSrc = "component { // cflint ignore:line\n" + | ||
" function functionFour() { // cflint ignore:line\n" + | ||
" if (a == 1) { // cflint ignore:line\n" + | ||
" b = // cflint ignore:line\n" + | ||
" }\n" + | ||
" }\n" + | ||
"}"; | ||
cfBugs.setLogError(true); | ||
CFLintResult lintresult = cfBugs.scan(scriptSrc, "test"); | ||
assertEquals(0, lintresult.getIssues().size()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"rule" : [ ], | ||
"excludes" : [ ], | ||
"includes" : [{}], | ||
"inheritParent" : false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
component { | ||
function functionFour() { | ||
if (a == 1) { | ||
b = 1; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/resources/com/cflint/tests/IgnoresAll/ignoreAll.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version" : "", | ||
"timestamp" : 0, | ||
"issues" : [ ], | ||
"counts" : { | ||
"totalFiles" : 0, | ||
"totalLines" : 0, | ||
"countByCode" : [ ], | ||
"countBySeverity" : [ ] | ||
} | ||
} |
7 changes: 7 additions & 0 deletions
7
src/test/resources/com/cflint/tests/IgnoresAll/ignoreLines.cfc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
component { // cflint ignore:line | ||
function functionFour() { // cflint ignore:line | ||
if (a == 1) { // cflint ignore:line | ||
b = 1; // cflint ignore:line | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/test/resources/com/cflint/tests/IgnoresAll/ignoreLines.expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"version" : "", | ||
"timestamp" : 0, | ||
"issues" : [ ], | ||
"counts" : { | ||
"totalFiles" : 0, | ||
"totalLines" : 0, | ||
"countByCode" : [ ], | ||
"countBySeverity" : [ ] | ||
} | ||
} |