Fix some codeclimate findings

fix some code climate warnings

This is a part of https://www.openproject.org/work_packages/2664
(though, the mentioned work_package needs some more pull requests, so a single PR does not grow too much)

A changelog-entry may be created with the last PR of that work_package.