Why does codacy give `Unnecessary block` error for function declaration?

495 Views Asked by At

We are using codacy for static code analysis. On pushing a change to the js file, where we are declaring a function that returns an object, it is giving the below error.

screenshot of the codacy issue

Internally, codacy tells us this is reported since PMD 5.0. We are not sure if this is an actual issue in the code or in the analyzer. If it is a code issue then what is the correct way to solve this?

EDIT: Using PMD version 6.48.0

1

There are 1 best solutions below

0
nak On

This issue is Open with PMD here. https://github.com/pmd/pmd/issues/4129

There are workarounds mentioned. For the codacy side we need to disable the rule until it is fixed