-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New Rule COMMENTS_BY_KDOC was implemented (#1350)
* New Rule COMMENTS_BY_KDOC was implemented ### What's done: * New Rule COMMENTS_BY_KDOC was added to check if code block contains kdoc comments * and fix it by converting to block comment * tests and docs were added * Closes: #828
- Loading branch information
1 parent
65335c7
commit 48f0c3d
Showing
17 changed files
with
529 additions
and
2,282 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
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
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
40 changes: 40 additions & 0 deletions
40
diktat-rules/src/test/resources/test/paragraph2/kdoc/KdocBlockCommentExpected.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,40 @@ | ||
package test.paragraph2.kdoc | ||
|
||
/** | ||
* Converts this AST node and all its children to pretty string representation | ||
*/ | ||
@Suppress("AVOID_NESTED_FUNCTIONS") | ||
fun Example.prettyPrint(level: Int = 0, maxLevel: Int = -1): String { | ||
/** | ||
* AST operates with \n only, so we need to build the whole string representation and then change line separator | ||
*/ | ||
fun Example.doPrettyPrint(level: Int, maxLevel: Int): String { | ||
return "test" + level + maxLevel | ||
} | ||
return doPrettyPrint(level, maxLevel).replace("\n", System.lineSeparator()) | ||
} | ||
|
||
/** | ||
* right place for kdoc | ||
*/ | ||
class Example { | ||
/** | ||
* right place for kdoc | ||
*/ | ||
fun doGood() { | ||
/* | ||
* wrong place for kdoc | ||
*/ | ||
/* | ||
* right place for block comment | ||
*/ | ||
// right place for eol comment | ||
1 + 2 | ||
/** | ||
* Converts this AST node and all its children to pretty string representation | ||
*/ | ||
fun Example.prettyPrint(level: Int = 0, maxLevel: Int = -1): String { | ||
return "test" | ||
} | ||
} | ||
} |
Oops, something went wrong.