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

Remove unused Variables #112

Merged
merged 5 commits into from
Dec 15, 2023
Merged

Remove unused Variables #112

merged 5 commits into from
Dec 15, 2023

Conversation

confused-Techie
Copy link
Member

This PR removes most of the unused variables within the codebase. Advised via the Codacy recommendations.

This also has a focus on imports mostly, and ignored any unused variables that begin with _ for the time being.

But for this PR while touching unrelated files, I hope keeping the purpose identical between all of them, it's not too hard to review.

Copy link
Member

@DeeDeeG DeeDeeG left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

CI passes, so generally the code still works. Missing imports would tend to error out early and loud, so I'm hoping CI is enough to catch these easily.

@confused-Techie
Copy link
Member Author

Thanks for the review @DeeDeeG!

@confused-Techie confused-Techie merged commit 98f00d0 into master Dec 15, 2023
@confused-Techie confused-Techie deleted the no-unused-vars branch December 15, 2023 21:18
@DeeDeeG
Copy link
Member

DeeDeeG commented Dec 15, 2023

ignored any unused variables that begin with _ for the time being

I was curious about these, but the few I found seem reasonable, and the convention about starting a var name with _ to mean "yes, this is unused intentionally at the moment" is understandable to me at least. I can agree with leaving those as-is at the moment.

I'm honestly not as clear why those are ever super useful in JavaScript, and one or two of those aren't even unused, so it seems incorrect to start them with _, (_gitName and _versionName in src/git.js), but eh, off-topic maybe? Unless we want to rename those to not start with _ -- I'd be okay with doing that here, but it feels kind of tangential to the point of this PR, so I won't push for it really.

@confused-Techie
Copy link
Member Author

@DeeDeeG Merged this just as soon as you commented. But a followup PR to address any incorrect uses of _ at the start of a variable name seems like an awesome idea.

But glad we are on the same page, it felt smart to leave these behind, since they are intentionally unused. As for the why, I feel like this convention comes up in most places where you are allowed to overload or underload the parameters of a function. Since leaving those unused values out could lead someone to misunderstand what parameters are expected, or could be available. I do see how it can make the API of some surfaces much easier to work with.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants