Open ssaigh opened 2 months ago
Changes Missing Coverage | Covered Lines | Changed/Added Lines | % | ||
---|---|---|---|---|---|
src/flags.js | 6 | 8 | 75.0% | ||
<!-- | Total: | 6 | 8 | 75.0% | --> |
Files with Coverage Reduction | New Missed Lines | % | ||
---|---|---|---|---|
src/flags.js | 2 | 78.96% | ||
<!-- | Total: | 2 | --> |
Totals | |
---|---|
Change from base Build 10550029021: | 0.01% |
Covered Lines: | 22328 |
Relevant Lines: | 25585 |
Issues
1 New issue
0 Accepted issues
Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code
This pull request resolves issue #10 Resolves https://github.com/CMU-17313Q/NodeBB/issues/10
File name: src/flags.js
Refactoring the flag.validate function to reduce complexity by removing the nest if statements. This reduces the complexity from 18 to 15. Fix Cognitive Complexity in src/flags.js.
Changes to the original code to reduce complexity:
Removed unnecessary else if statement: I removed the else if conditions because each of the conditionals contained throws, which would automatically make you return and leave the function. Through doing this, I was able to remove deep nested if statements which reduced its complexity.