Skip to content

fixed issues #187

New issue

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

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

Already on GitHub? # to your account

Merged
merged 2 commits into from
May 22, 2024
Merged

fixed issues #187

merged 2 commits into from
May 22, 2024

Conversation

ajay-dhangar
Copy link
Member

DESCRIPTION

Found variables that are declared but not used anywhere.

NOTE: In browser applications, DeepSource recommends the use of ESModules over regular text/javascript scripts. Currently, we don't support variables that are not explicitly exported, and are injected into other scripts by being included in an HTML file

Unused variables are most often the result of incomplete refactoring. They can lead to confusing code and minor performance hitches.

NOTE: If you have intentionally left a variable unused, we suggest you to prefix the variable name with a _ to prevent them from being flagged by DeepSource.

BAD PRACTICE:

// Write-only variables are not considered as used.
let y = 10;
y = 5;

// A variable that modifies only itself isn't considered used.
let z = 0;
z = z + 1;

// Unused argument
(function(x) {
    return 5;
})();

// Unused recursive functions also raise this issue.
function fact(n) {
    if (n < 2) return 1;
    return n * fact(n - 1);
}

// When a function definition destructures an array,
// unused entries from the array also cause warnings.
function getY([x, y]) {
    return y;
}

RECOMMENDED:

let x = 10;
alert(x);

((arg1) => {
    return arg1;
})();

let myFunc;
myFunc = (n) => {
    // this is legal
    if (n < 0) myFunc();
};

// this is also considered legal
console.log(declaredLater);
var declaredLater;

// Only the second argument from the descructured array is used.
function getY([, y]) {
    return y;
}

Copy link

vercel bot commented May 22, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
codeharborhub-github-io ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 22, 2024 0:18am

Copy link
Contributor

deepsource-io bot commented May 22, 2024

Here's the code health analysis summary for commits dbb081e..47d49ea. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
🎯 21 occurences resolved
View Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@ajay-dhangar ajay-dhangar self-assigned this May 22, 2024
@ajay-dhangar ajay-dhangar added the bug Something isn't working label May 22, 2024
@ajay-dhangar ajay-dhangar merged commit d1ea55a into main May 22, 2024
6 checks passed
@ajay-dhangar ajay-dhangar removed the request for review from narendra-dhangar May 31, 2024 08:39
@ajay-dhangar ajay-dhangar added GSSOC'24 GirlScript Summer of Code | Contributor level1 GirlScript Summer of Code | Contributor's Levels gssoc GirlScript Summer of Code | Contributor labels May 31, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working gssoc GirlScript Summer of Code | Contributor GSSOC'24 GirlScript Summer of Code | Contributor level1 GirlScript Summer of Code | Contributor's Levels
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant