kitodo / kitodo-ugh

Kitodo.UGH Library
2 stars 10 forks source link

Fix several issues reported by static code analysis #44

Closed stweil closed 7 years ago

stweil commented 7 years ago

Signed-off-by: Stefan Weil sw@weilnetz.de

stweil commented 7 years ago

@henning-gerhardt, I did not find a style guide in the wiki. Could you please help me with a URL pointing to it?

henning-gerhardt commented 7 years ago

Coding guidelines are available under following link: http://www.kitodo.org/fileadmin/groups/kitodo/Dokumente/Kitodo-EntwicklerLeitfaden2016.pdf (nothing new, should already well known).

stweil commented 7 years ago

There exists a German documentation called Leitfaden für Kitodo-Entwickler (guide for Kitodo developers).

It does not contain a rule how to write Java conditionals.

It contains some rules for Kitodo.Production. According to these rules the AmbySoft Inc. Coding Standards for Java are required. These standards do not require parentheses for simple conditionals like the one in this PR. They suggest using parentheses for more complex conditionals. That is fine. They also suggest putting constants on the left side (null == refs). That's a bad idea. So even that standards should only be used cum grano salis.

For Kitodo.UGH there are currently no explicit rules. Therefore I suggest sticking to existing conventions for that project.

henning-gerhardt commented 7 years ago

Kitodo.UGH and Kitodo.ContentServer are IMHO parts of Kitodo.Production, so rules of Kitodo.Production apply here too. Must everything written down? Coding style should be a readable style and this include for me round brackets around every condition.

I will accept this PR this time and for similar changes.