-
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.
- Fixed `KDOC_WITHOUT_THROWS_TAG` rule when it adds a @throws annotation to the function, which has `throw` inside try-catch block Closes #1718
- Loading branch information
1 parent
74af4c1
commit ab404b2
Showing
5 changed files
with
66 additions
and
20 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
17 changes: 17 additions & 0 deletions
17
...ckage/src/main/kotlin/com/saveourtool/diktat/kdoc/methods/KdocWithoutThrowsTagExpected.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,17 @@ | ||
package test.paragraph2.kdoc.`package`.src.main.kotlin.com.saveourtool.diktat.kdoc.methods | ||
|
||
/** | ||
* @param onSuccess | ||
* @param onFailure | ||
*/ | ||
fun parseInputNumber(onSuccess: (number: Int) -> Unit, onFailure: () -> Unit) { | ||
try { | ||
val input: Int = binding.inputEditText.text.toString().toInt() | ||
if (input < 0) | ||
throw NumberFormatException() | ||
|
||
onSuccess(input) | ||
} catch (e: NumberFormatException) { | ||
onFailure() | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
...package/src/main/kotlin/com/saveourtool/diktat/kdoc/methods/KdocWithoutThrowsTagTested.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,13 @@ | ||
package test.paragraph2.kdoc.`package`.src.main.kotlin.com.saveourtool.diktat.kdoc.methods | ||
|
||
fun parseInputNumber(onSuccess: (number: Int) -> Unit, onFailure: () -> Unit) { | ||
try { | ||
val input: Int = binding.inputEditText.text.toString().toInt() | ||
if (input < 0) | ||
throw NumberFormatException() | ||
|
||
onSuccess(input) | ||
} catch (e: NumberFormatException) { | ||
onFailure() | ||
} | ||
} |