java:S1142 message wording confusing

SQ 8.6

Rule java:S1142 says not to have too many returns in one method. The auto-generated message has confusing wording, as in this example:

At first I thought, where is “method 5”? Until I read it again. I think wording like:

“Reduce the number of returns of this method from 5 down to the maximum allowed 3.”

would be a little clearer. (IOW, remove the comma after the first count and add the word “from” before it.)

(I don’t know if the other languages, like Flex, have the same issue, so you might want to check.)

Thank you for reporting @MisterPi !

I have created a ticket about improving the wording.
https://jira.sonarsource.com/browse/SONARJAVA-4277

1 Like