-
Notifications
You must be signed in to change notification settings - Fork 39
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
Fix bug with incorrect package name fixing #877
Merged
kgevorkyan
merged 6 commits into
master
from
bugfix/incorrect_package_name_fix_with_annotations
May 12, 2021
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bcfd878
Fix bug with incorrect package name fixing
kgevorkyan d003832
Add recommendations according review
kgevorkyan 9331884
Improve algorithm, add more tests
kgevorkyan 96e449e
Fix bug in smoke test
kgevorkyan e838549
Add recommendations
kgevorkyan 1e14fda
Merge branch 'master' into bugfix/incorrect_package_name_fix_with_ann…
kgevorkyan 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ import org.cqfn.diktat.ruleset.rules.chapter3.files.TopLevelOrderRule | |
import org.cqfn.diktat.util.FixTestBase | ||
|
||
import generated.WarningNames | ||
import org.junit.jupiter.api.Disabled | ||
import org.junit.jupiter.api.Tag | ||
import org.junit.jupiter.api.Test | ||
|
||
|
@@ -19,4 +20,12 @@ class TopLevelOrderRuleFixTest : FixTestBase("test/paragraph3/top_level", ::TopL | |
fun `should fix top level order with comment`() { | ||
fixAndCompare("TopLevelWithCommentExpected.kt", "TopLevelWithCommentTest.kt") | ||
} | ||
|
||
// FixMe: | ||
@Disabled | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add reason ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done |
||
@Test | ||
@Tag(WarningNames.TOP_LEVEL_ORDER) | ||
fun `should fix top level order with header kdoc`() { | ||
fixAndCompare("TopLevelWithHeaderKdocExpected.kt", "TopLevelWithHeaderKdocTest.kt") | ||
} | ||
} |
1 change: 0 additions & 1 deletion
1
...paragraph1/naming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingExpected.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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package org.cqfn.diktat.some.name | ||
|
||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
|
7 changes: 7 additions & 0 deletions
7
...ing/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationExpected.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,7 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
|
||
package org.cqfn.diktat.some.name | ||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
6 changes: 6 additions & 0 deletions
6
...ng/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationExpected2.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,6 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") // comment | ||
package org.cqfn.diktat.some.name | ||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
9 changes: 9 additions & 0 deletions
9
...ng/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationExpected3.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,9 @@ | ||
/** | ||
* comment | ||
*/ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
package org.cqfn.diktat.some.name | ||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
6 changes: 6 additions & 0 deletions
6
.../naming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationTest.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,6 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
|
||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
5 changes: 5 additions & 0 deletions
5
...naming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationTest2.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,5 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") // comment | ||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
8 changes: 8 additions & 0 deletions
8
...naming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithAnnotationTest3.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,8 @@ | ||
/** | ||
* comment | ||
*/ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
} |
7 changes: 7 additions & 0 deletions
7
...ming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithoutImportExpected.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,7 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
package org.cqfn.diktat.some.name | ||
|
||
val a = 5 | ||
|
||
class TestPackageName { | ||
} |
5 changes: 5 additions & 0 deletions
5
...1/naming/package/src/main/kotlin/org/cqfn/diktat/some/name/FixMissingWithoutImportTest.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,5 @@ | ||
@file:Suppress("CONSTANT_UPPERCASE") | ||
val a = 5 | ||
|
||
class TestPackageName { | ||
} |
1 change: 0 additions & 1 deletion
1
.../test/resources/test/paragraph1/naming/package/src/main/kotlin/some/FixMissingExpected.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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
package org.cqfn.diktat.some | ||
|
||
import org.cqfn.diktat.ktlint.core.Rule | ||
|
||
class TestPackageName { | ||
|
9 changes: 9 additions & 0 deletions
9
diktat-rules/src/test/resources/test/paragraph3/top_level/TopLevelWithHeaderKdocExpected.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,9 @@ | ||
/** | ||
* Header Kdoc | ||
*/ | ||
|
||
package test.paragraph3.top_level | ||
|
||
import org.cqfn.diktat.bar | ||
|
||
class A {} |
9 changes: 9 additions & 0 deletions
9
diktat-rules/src/test/resources/test/paragraph3/top_level/TopLevelWithHeaderKdocTest.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,9 @@ | ||
package test.paragraph3.top_level | ||
|
||
/** | ||
* Header Kdoc | ||
*/ | ||
|
||
import org.cqfn.diktat.bar | ||
|
||
class A {} |
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.
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.
Thanks, changed