Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ecmascript] GlobalVariable check fails, when use async function #3231

Open
kraussjo opened this issue Apr 21, 2021 · 0 comments
Open

[ecmascript] GlobalVariable check fails, when use async function #3231

kraussjo opened this issue Apr 21, 2021 · 0 comments
Labels
a:false-positive PMD flags a piece of code that is not problematic

Comments

@kraussjo
Copy link

kraussjo commented Apr 21, 2021

Affects PMD Version:
6.33.0+
7.0.0

GlobalVariable check fails although value is set correctly, when a "async function" is used and the variable is declarated with var/let.

Code Sample demonstrating the issue:

Error is shown (GlobalVariable: Avoid using global variables):

async function getFilter(argDimensionId, argParentValue) {
    
    let params = {};
    params['dimensionId'] = argDimensionId;
    if (argParentValue !== undefined) {
        params['parentCode'] = argParentValue;
    }  

....

}

No error is shown:

function getFilter(argDimensionId, argParentValue) {
    
    let params = {};
    params['dimensionId'] = argDimensionId;
    if (argParentValue !== undefined) {
        params['parentCode'] = argParentValue;
    }  

...

}
@kraussjo kraussjo added the a:bug PMD crashes or fails to analyse a file. label Apr 21, 2021
@adangel adangel added a:false-positive PMD flags a piece of code that is not problematic and removed a:bug PMD crashes or fails to analyse a file. labels Apr 21, 2021
@jsotuyod jsotuyod added the needs:pmd7-revalidation The issue hasn't yet been retested vs PMD 7 and may be stale label Mar 17, 2024
@jsotuyod jsotuyod removed the needs:pmd7-revalidation The issue hasn't yet been retested vs PMD 7 and may be stale label Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:false-positive PMD flags a piece of code that is not problematic
Projects
None yet
Development

No branches or pull requests

3 participants