-
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
KDOC_WITHOUT_THROWS_TAG
add @throws
annotation when throw inside try-catch
#1862
Conversation
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #1862 +/- ##
============================================
- Coverage 78.55% 78.54% -0.02%
- Complexity 2456 2463 +7
============================================
Files 133 133
Lines 8654 8673 +19
Branches 2189 2198 +9
============================================
+ Hits 6798 6812 +14
Misses 882 882
- Partials 974 979 +5 ☔ View full report in Codecov by Sentry. |
JUnit Tests (Windows, EnricoMi/publish-unit-test-result-action@v2) 164 files ±0 164 suites ±0 7m 37s ⏱️ +7s Results for commit 5b479d8. ± Comparison against base commit 02c1a7c. ♻️ This comment has been updated with latest results. |
JUnit Tests (macOS, EnricoMi/publish-unit-test-result-action@v2) 164 files ±0 164 suites ±0 5m 17s ⏱️ -12s Results for commit 5b479d8. ± Comparison against base commit 02c1a7c. ♻️ This comment has been updated with latest results. |
diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/KdocMethods.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/main/kotlin/com/saveourtool/diktat/ruleset/rules/chapter2/kdoc/KdocMethods.kt
Outdated
Show resolved
Hide resolved
diktat-rules/src/test/kotlin/com/saveourtool/diktat/ruleset/chapter2/KdocMethodsFixTest.kt
Outdated
Show resolved
Hide resolved
.../package/src/main/kotlin/com/saveourtool/diktat/kdoc/methods/KdocWithoutThrowsTagExpected.kt
Outdated
Show resolved
Hide resolved
Discussed offline, lets cover with tests following cases
try {
// ...
throw(ex1)
// ...
} catch(ex1) {
} catch(ex2) {
} catch(ex3)
try {
// ...
throw NumberException
// ...
} catch(IlligalArgumentException) { since NumberException is child of IlligalArgumentException
try {
// ...
throw(ex1)
// ...
throw(ex2)
throw(ex3)
} catch(ex1) {
} catch(ex2) {
}
|
What's done:
KDOC_WITHOUT_THROWS_TAG
rule when it adds a @throws annotation to the function, which hasthrow
inside try-catch blockCloses #1718