Fix Sonar findings

* unused formal parameters
* inner assignments
* redundant modifier
* simplify conditional