Skip to content

Conversation

@faisal-hameed
Copy link

This pull request is focused on resolving occurrences of Sonar rule squid:S1132 - “Strings literals should be placed on the left side”.
You can find more information about the issue here: https://dev.eclipse.org/sonar/rules/show/squid:S1132

Please let me know if you have any questions.

Faisal.

@slandelle
Copy link
Contributor

I know this comes from good will, but...
Just applying generic rules without further thought has nothing to do with improving code quality.

Here, specifically:

  • Yoda style is everything but readable
  • some of the code you suggest to change is already protected against NPE when the parameter is expected to be optional. ex: turning algorithm == null || algorithm.equals("MD5") into algorithm == null || "MD5".equals(algorithm)
  • trying to blindly change code so that it doesn't crash with an NPE when an expected parameter is missing, but then behave in an unexpected manner is so very dangerous. I'd rather have an NPE, and then decide if it was a bug and that this parameter could rightfully be optional, instead of never being aware that this parameter is sometimes missing, being possibly a user error.

Those qualimetry tools can only raise some warnings that have then to be evaluated in the context of the application and the code. They are by no way silver bullets, and some of their rules are plain BS.

@slandelle slandelle closed this Nov 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants