Skip to content

Conversation

@lhazard434
Copy link

@lhazard434 lhazard434 commented Sep 5, 2025

P1B: Starter Task: Refactoring PR

Use this pull request template to briefly answer the questions below in one to two sentences each.
Feel free to delete this text at the top after filling out the template.

You are not permitted to use generative AI services (e.g., ChatGPT) to compose the answers.
Any such use will be treated as a violation of academic integrity.

1. Issue

Please provide a link to the associated GitHub issue:

#163

Full path to the refactored file:
src/user/follow.js

What do you think this file does?
I think that this handles the following system in NodeBB, similar to a social media site.

What is the scope of your refactoring within that file?
I dealt with the export function

Which Qlty‑reported issue did you address?
Function with many returns (count = 9): exports

2. Refactoring

How did the specific issue you chose impact the codebase’s adaptability?
The more return statements there are the harder it becomes to debug when there is a problem

What changes did you make to resolve the issue?
I some logic that was duplicated in the function.

How do your changes improve adaptability? Did you consider alternatives?
In the future if there are bugs it will be easier to debug.

3. Validation

How did you trigger the refactored code path from the UI?
I just put it in so whenever there is a follow it should log my name.

Attach a screenshot of the logs and UI demonstrating the trigger.
I forgot my login for NodeBB, so I can't test if it works

Attach a screenshot of qlty smells --no-snippets <full/path/to/file.js> showing fewer reported issues after the changes.
Screenshot 2025-09-04 230426

@coveralls
Copy link

Pull Request Test Coverage Report for Build 17482358259

Details

  • 23 of 24 (95.83%) changed or added relevant lines in 1 file are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.02%) to 78.547%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/user/follow.js 23 24 95.83%
Files with Coverage Reduction New Missed Lines %
src/user/follow.js 1 82.95%
Totals Coverage Status
Change from base Build 17435863312: 0.02%
Covered Lines: 24702
Relevant Lines: 29610

💛 - Coveralls

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