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

Removing "No Operand in Assignment" Usage #120

Merged
merged 10 commits into from
Jan 10, 2024
Merged

Conversation

confused-Techie
Copy link
Member

With PPM now properly setup on Codacy, the next two biggest suggestions are the following:

  • No Unused Vars: For this one I've added a small bit of configuration to the eslint config file, to not apply this rule if the variable begins with an underscore, which should solve solve that issue by and large for us.
  • No Assignment in Operand: This issue is less invasive than it appears. While there are some instances where variables are assigned a value within an operand, other situations were found such as old CoffeeScript is not operators that weren't decaffed cleanly, and also a single instance of what appears to be a typo of = rather than ==

With this issues addressed, we don't expect to see any change in hope behavior ourselves.

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.

Overall looking good, I think this one change is meant to be assignment not comparison, though.

Thanks for doing this, IMO these complicated lines really do make more sense separated into more lines.

src/publish.js Outdated Show resolved Hide resolved
src/list.js Show resolved Hide resolved
src/upgrade.js Outdated
Comment on lines 56 to 55
if (pack = this.getIntalledPackage(name)) {
let pack = this.getInstalledPackage(name);
Copy link
Member

@DeeDeeG DeeDeeG Jan 5, 2024

Choose a reason for hiding this comment

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

You'll probably be surprised why this was failing the tests: the actual function name in this file has been getIntalledPackage (note the typo, a missing "s" in "intalled") this whole time, since 2014 (atom/apm@c8d61000#diff-0aa64babcef87ba238fed061035f2fe14c587092a7339b55c5e4033c37370d70R46).

(Regarding the singular getIntalledPackage, not to be confused with the plural getInstalledPackages ("Packages") which has/had no typo.)

So, we can either revert the spelling here to the previous (typoed but defined) function name here, or rename the function elsewhere in the file that this line calls, so as to not have a typo in its name, lol.

But yeah, this broke tests by fixing a typo, I honestly did not see that coming.

Thanks again for working on this! Nice to see readability improvements to the code!!!!!! We sure need it, as debugging this PR has helped prove, IMO!!! Thank you!

src/upgrade.js Outdated Show resolved Hide resolved
Co-authored-by: DeeDeeG <[email protected]>
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.

Yeeeeeeeeeaaaaaaaaaah 😎

let's do it

(More readable code that at least mostly makes sense is both a good thing and has historically been all too rare in ppm repo. We've come a long way!!!!!!!)

@DeeDeeG DeeDeeG merged commit b084b11 into master Jan 10, 2024
11 checks passed
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