-
Notifications
You must be signed in to change notification settings - Fork 845
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
Solving SonarCloud Critical / Major & Minor Errors - Improving Code Quality #572
Closed
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
filypsdias
changed the title
Solving SonarCloud Critial / Major & Minor Errors - Improving Code Quality
Solving SonarCloud Critical / Major & Minor Errors - Improving Code Quality
Aug 28, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request addresses several code quality issues identified by SonarCloud and includes various code refactoring improvements. The changes made in this pull request enhance the overall maintainability and readability of the codebase, resolve existing issues, and ensure better adherence to best practices.
Overall, the number of issues fixed was:
Changes Made
1. Code Refactoring for Readability(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13):
2. Component Definition Optimization (1, 2, 3, 4):
As part of this pull request, we've addressed an issue related to defining components within the render phase in React. The error message "Do not define components during render" highlights the concern that React may interpret new component types during every render, leading to the destruction of DOM nodes and state within the entire subtree:
3. Cognitive Complexity Reduction(1, 2, 3):
Impact
Type of change
How Has This Been Tested?
Checklist:
Additional Notes
🥳 BONUS - Unit Tests Fix
In this PR, I've tackled the issue of broken test cases that were impacting our codebase. By identifying the underlying causes of these failures, I've managed to reinstate the robustness of our test suite. This ensures that our codebase remains dependable and free of unexpected regressions.
In addition to resolving the broken test cases, I've taken the initiative to bolster (reinforce) our code coverage. By strategically introducing new test cases, I've expanded the scope of our testing efforts, encompassing a wider range of scenarios. This proactive approach not only strengthens our code's reliability but also promotes better software quality.
Cool Stuff Added (Click to Open the Toggle)
Chai.js: Chai.js is another JavaScript library commonly used in testing, specifically in the context of behavior-driven development (BDD) and assertion testing
Changes to Package.json: In the latest version of the project, a significant improvement has been made to the testing process. Previously, it was necessary to run the sequelize seed command as a part of the pretest script. However, this approach led to validation errors if the seed had already been applied. To address this, the configuration has been adjusted. The sequelize seed command has been removed from the pretest script, ensuring a smoother testing experience without encountering validation conflicts due to redundant seeding.
Enhanced Testing Parallelism: A key enhancement has been introduced to the testing workflow. The test command now includes the
--maxWorkers=1
flag. This alteration has been made to promote testing singularity and prevent conflicts between different endpoints. By limiting the number of workers to one, the testing process operates in a more isolated manner. This adjustment minimizes the potential for interference and conflicts that might arise when multiple workers are executing tests concurrently.Added tests for Contact Services: Just introducing some additional tests to the Contact Services to improve test coverage