Skip to content

[javascript] UnnecessaryBlock FP for function declaration #4129

@naveadkazi

Description

@naveadkazi

Affects PMD Version: Not sure, in codacy it give since 5.0

Rule:

Please provide the rule name and a link to the rule documentation:
https://pmd.github.io/latest/pmd_rules_ecmascript_codestyle.html#unnecessaryblock

Description:
Created a named exported function that returns an object. This function is pushed to codacy.com which uses PMD. Codacy reports it as an unnecessary block. I am not sure if this false positive and what I am missing here.

image

Code Sample demonstrating the issue:


Expected outcome:

PMD reports a violation at line 188 in the screenshot, but that's wrong. That's a false positive.

Running PMD through: Codacy

Metadata

Metadata

Assignees

No one assigned

    Labels

    a:false-positivePMD flags a piece of code that is not problematic

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions