Skip to content

Refactor duplicate code in src/messaging/data.js#92

Open
jdufitum wants to merge 11 commits into
CMU-17313Q:f24from
jdufitum:refactor-duplicate-code-in-data-file
Open

Refactor duplicate code in src/messaging/data.js#92
jdufitum wants to merge 11 commits into
CMU-17313Q:f24from
jdufitum:refactor-duplicate-code-in-data-file

Conversation

@jdufitum
Copy link
Copy Markdown

@jdufitum jdufitum commented Sep 5, 2024

This pull request resolves issue CMU-17313Q/NodeBB#8
Resolves CMU-17313Q/NodeBB#8

This pull request refactors the code in src/messaging/data.js by removing duplicate code blocks between lines 83 and 89. The code has been optimized to improve maintainability and prevent redundancy. Additionally, adjustments were made to ensure functionality remains consistent after the refactor.

  • Removed redundant code between lines 83 and 89.
  • Optimized logic for handling messaging data.
  • Ensured all tests pass with the updated code structure.

This pull request resolves issue #8 .

Consolidated identical code blocks in the conditional structure of src/messaging/data.js to improve maintainability. The repeated assignment of message.newSet = true was refactored into a single condition to reduce redundancy and enhance code clarity.
…e. I also added the original contents of the file widgets.js
…84 to line 91 of the file data.js in the src/messaging
…duplicate code block from line 84 to line 91 of the file data.js in the src/messaging
…added comments and tested the new code chunck
- Adjusted indentation levels to match the expected number of tabs.
- Ensured consistent formatting for better readability and maintainability.

Affected lines:
- Line 84: Increased indentation from 3 tabs to 4 tabs.
- Line 89: Increased indentation from 4 tabs to 5 tabs.
- Line 92: Increased indentation from 5 tabs to 6 tabs.
- Line 93: Increased indentation from 4 tabs to 5 tabs.
- Line 94: Increased indentation from 3 tabs to 4 tabs.
- Line 95: Increased indentation from 3 tabs to 4 tabs.
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Sep 5, 2024

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.

Refactor code in src/messaging/data.js to remove duplicated code blocks.

1 participant