-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ignoreLines feature for filtering the input file #307
Merged
Merged
Changes from 11 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
e8caeb6
feature/ignoreLines
f73884e
feature/ignoreLines
7206eb8
Merge branch 'main' into feature/ignoreLines
sanyavertolet 6166aaf
feature/ignoreLines
8d5ee0c
feature/ignoreLines
73afaa8
Merge branch 'main' into feature/ignoreLines
sanyavertolet ca67047
feature/ignoreLines
dc3e033
Merge remote-tracking branch 'origin/feature/ignoreLines' into featur…
6a1b838
Merge branch 'main' into feature/ignoreLines
sanyavertolet b52e00f
feature/ignoreLines
7512208
feature/ignoreLines
a96da0b
Merge branch 'main' into feature/ignoreLines
sanyavertolet 1316dc0
feature/ignoreLines
e6f16ad
feature/ignoreLines
dca01fb
feature/ignoreLines
f3c84a5
feature/ignoreLines
cc3e3fa
feature/ignoreLines
81aa3cf
feature/ignoreLines
1c70ad9
feature/ignoreLines
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...iktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLines/Bug1Expected.kt
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,21 @@ | ||
package org.cqfn.save.IgnoreLinesTest.IgnoreLines | ||
|
||
class D { | ||
val x = 0 | ||
|
||
/** | ||
* @return | ||
*/ | ||
fun bar(): Bar { | ||
val qux = 42 | ||
return Bar(qux) | ||
} | ||
} | ||
|
||
/** | ||
* @param foo | ||
*/ | ||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
// ;warn:0: [TEST] JUST_A_TEST |
12 changes: 12 additions & 0 deletions
12
...in-diktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLines/Bug1Test.kt
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,12 @@ | ||
package test.smoke.src.main.kotlin | ||
|
||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
|
||
class D {val x = 0 | ||
fun bar(): Bar {val qux = 42; return Bar(qux)} | ||
} | ||
// ;warn:0: [TEST] JUST_A_TEST | ||
// IGNORE_ME | ||
# I WILL DISSAPEAR AS WELL |
7 changes: 7 additions & 0 deletions
7
...tlin-diktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLines/save.toml
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 @@ | ||
[general] | ||
tags = ["FixIgnoreLines"] | ||
description = "Test for ignoreLines option in Fix" | ||
suiteName = "Autofix: Smoke Tests" | ||
|
||
[fix] | ||
ignoreLines = ["^// IGNORE.*", "^#.*"] |
22 changes: 22 additions & 0 deletions
22
...ix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLinesIsEmpty/Bug1Expected.kt
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,22 @@ | ||
package org.cqfn.save.IgnoreLinesTest.IgnoreLinesIsEmpty | ||
|
||
class D { | ||
val x = 0 | ||
|
||
/** | ||
* @return | ||
*/ | ||
fun bar(): Bar { | ||
val qux = 42 | ||
return Bar(qux) | ||
} | ||
} | ||
|
||
/** | ||
* @param foo | ||
*/ | ||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
// ;warn:0: [TEST] JUST_A_TEST | ||
// IGNORE_ME |
11 changes: 11 additions & 0 deletions
11
...at/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLinesIsEmpty/Bug1Test.kt
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 @@ | ||
package test.smoke.src.main.kotlin | ||
|
||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
|
||
class D {val x = 0 | ||
fun bar(): Bar {val qux = 42; return Bar(qux)} | ||
} | ||
// ;warn:0: [TEST] JUST_A_TEST | ||
// IGNORE_ME |
7 changes: 7 additions & 0 deletions
7
...ktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/IgnoreLinesIsEmpty/save.toml
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 @@ | ||
[general] | ||
tags = ["smoke"] | ||
description = "Smoke tests for diktat" | ||
suiteName = "Autofix: Smoke Tests" | ||
|
||
[fix] | ||
ignoreLines = [] |
21 changes: 21 additions & 0 deletions
21
...tat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/NoIgnoreLines/Bug1Expected.kt
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,21 @@ | ||
package org.cqfn.save.IgnoreLinesTest.NoIgnoreLines | ||
|
||
class D { | ||
val x = 0 | ||
|
||
/** | ||
* @return | ||
*/ | ||
fun bar(): Bar { | ||
val qux = 42 | ||
return Bar(qux) | ||
} | ||
} | ||
|
||
/** | ||
* @param foo | ||
*/ | ||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
// IGNORE_ME |
11 changes: 11 additions & 0 deletions
11
...-diktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/NoIgnoreLines/Bug1Test.kt
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 @@ | ||
package test.smoke.src.main.kotlin | ||
|
||
fun readFile(foo: Foo) { | ||
var bar: Bar | ||
} | ||
|
||
class D {val x = 0 | ||
fun bar(): Bar {val qux = 42; return Bar(qux)} | ||
} | ||
// ;warn:0: [TEST] JUST_A_TEST | ||
// IGNORE_ME |
6 changes: 6 additions & 0 deletions
6
...in-diktat/fix/smoke/src/main/kotlin/org/cqfn/save/IgnoreLinesTest/NoIgnoreLines/save.toml
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 @@ | ||
[general] | ||
tags = ["smoke"] | ||
description = "Smoke tests for diktat" | ||
suiteName = "Autofix: Smoke Tests" | ||
|
||
[fix] |
6 changes: 6 additions & 0 deletions
6
examples/kotlin-diktat/fix/smoke/src/main/kotlin/org/cqfn/save/chapter1/save.toml
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 @@ | ||
[general] | ||
tags = ["smoke"] | ||
description = "Smoke tests for diktat" | ||
suiteName = "Autofix: Smoke Tests" | ||
|
||
[fix] |
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 |
---|---|---|
|
@@ -5,4 +5,3 @@ | |
expectedWarningsPattern = "// ;warn:?(.*):(\\d*): (.+)" | ||
timeOutMillis = 30000 | ||
|
||
|
16 changes: 16 additions & 0 deletions
16
examples/kotlin-diktat/warn/chapter1/IgnoreLinesTest/EnumTestDetection.kt
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,16 @@ | ||
package org.cqfn.diktat.test.resources.test.paragraph1.naming.enum_ | ||
|
||
// ;warn:3:1: [MISSING_KDOC_TOP_LEVEL] all public and internal top-level classes and functions should have Kdoc: EnumTestDetection (cannot be auto-corrected) | ||
// ;warn:30: [WRONG_DECLARATIONS_ORDER] declarations of constants and enum members should be sorted alphabetically: enum entries order is incorrect | ||
// ;warn:10:5: [ENUMS_SEPARATED] enum is incorrectly formatted: enums must end with semicolon | ||
enum class EnumTestDetection { | ||
// ;warn:$line+1:5: [ENUM_VALUE] enum values should be{{ in }}selected UPPER_CASE snake/PascalCase format: paSC_SAl_l | ||
paSC_SAl_l, | ||
|
||
// ;warn:5: [ENUM_VALUE] enum values{{ should }}be in selected{{ UPPER_CASE }}snake/PascalCase format: PascAsl_f | ||
PascAsl_f | ||
// ;warn:$line-2:5: [ENUMS_SEPARATED] enum is incorrectly formatted: last enum entry must end with a comma | ||
|
||
// ;warn:1:9: {{.*}}[PACKAGE_NAME_INCORRECT_PREFIX] package name should start from company's domain: org.cqfn.save{{.*}} | ||
} | ||
// ;warn:0:0: [YOU SHOULD NOT SEE THIS] this warning should not be shown |
7 changes: 7 additions & 0 deletions
7
examples/kotlin-diktat/warn/chapter1/IgnoreLinesTest/save.toml
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 @@ | ||
[general] | ||
tags = ["WarnIgnoreLines"] | ||
description = "Test suite that checks if filtering by regex work." | ||
|
||
[warn] | ||
testNameRegex = "^E.*T.*D.*" | ||
ignoreLines = [".*// ;warn:0:0: \\[YOU SHOULD NOT SEE THIS\\] this warning should not be shown.*"] |
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
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
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
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why
@Transient
? I though that we deserialize this value from toml configThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The point it that we deserialize
ignoreLines
from toml config.ignoreLinesPatterns
is initialized withignoreLines
that we parse from config so it is not deserialized directly from toml.