saveourtool/diktat
GitHub で見る[`INVERSE_FUNCTION_PREFERRED`] should not replace `!ClosedRange.isEmpty()`
Open
#1,699 opened on 2023年6月22日
buggood first issue
Repository metrics
- Stars
- (571 stars)
- PR merge metrics
- (PR metrics pending)
説明
Describe the bug
Given the following code:
val range: ClosedRange<Int> = 0..1
check(!range.isEmpty())
Diktat suggests replacing this with the nonexistent ClosedRange.isNotEmpty() function:
[INVERSE_FUNCTION_PREFERRED] it is better to use inverse function: isNotEmpty() instead of !isEmpty() (diktat-ruleset:inverse-method)
Expected behavior
Rule should not be triggered when the isNotEmpty function does not exist.
Environment information
- diktat version: 1.2.5
- how is diktat run (CLI, plugin, etc.): CLI