Allow configuration of rule java:S5838

  • What language is this for?
  • Which rule?
  • Using SonarCloud

java:S5838 contains a lot of subrules, and I would like to exclude on of them, but currently it is not possible.

The rule I want to configure is the following one:


Sonar suggest to use isPositive() instead.

I would like to avoid that for the following reasons:

  • it increases the cognitive burden, as it forces the reader to ask themself if 0 is positive to understand the comparison (note that this convention depends on the field and the context: algebra precalculus - Is zero positive or negative? - Mathematics Stack Exchange, but that’s an issue with assertj itself)
  • it does not improve readability, as it may break the alignment when there are several comparisons in a row:

Hello @NathanEckert and welcome to the Sonar Community!

Thank you for the suggestion; you can track the progress on its resolution at [SONARJAVA-4954] - Jira.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.