Open rnveach opened 7 years ago
@rnveach One more example:
try {
...
}
catch (IOException | UnsupportedOperationException | Exception e) { // violation
...
}
try {
...
}
catch (IOException
| UnsupportedOperationException
| Exception e) { // OK
...
}
The above specified example is a bit fanatic, that is why there should be a way to avoid that violation (for example, exclude the token from check's toke set). The example needs investigation. I'm not sure whether Cobertura and Jacoco can distinguish 'branches' of catch block.
(always require new line before &&/||)
Not only &&/||
, but also ==
, :
, |
are target tokens. There may be many nuances that cannot be covered by OperatorWrap.
Taken from discussion at https://github.com/checkstyle/checkstyle/pull/4148#discussion_r109515706 :
Code coverage branches should be on their own line.
This will help with code coverage reporting. Reports currently use the same styling as the source code. This is fine until 1 line contains multiple branches. If not all coverage is hit, it makes it harder to determine which branch is failing as it doesn't single out the specific condition.
We should look into either creating this as a new check or see if this is just a specialized configuration of http://checkstyle.sourceforge.net/config_whitespace.html#OperatorWrap (always require new line before
&&
/||
) .The following cases should be reported as violations:
The following cases should not be report:
@MEZk @romani Feel free to review and think up any weird situations we should examine and add.