add nested complexity - #72
Conversation
17d0513 to
149c692
Compare
There was a problem hiding this comment.
✅ Quality Gates: OK
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Inconclusive -- Not enough commits to recommend a review strategy. The recommendation will be enabled automatically once you have more development activity.
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Deep, Nested Complexity js-example.js: mark_purchased - Low 🔥
149c692 to
3fba4c6
Compare
There was a problem hiding this comment.
✅ Quality Gates: OK
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Inconclusive -- Not enough commits to recommend a review strategy. The recommendation will be enabled automatically once you have more development activity.
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Deep, Nested Complexity js-example.js: mark_purchased - Low 🔥
3fba4c6 to
6e5c9bf
Compare
There was a problem hiding this comment.
❌ Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Inconclusive -- Not enough commits to recommend a review strategy. The recommendation will be enabled automatically once you have more development activity.
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Deep, Nested Complexity js-example.js: mark_purchased - Low 🔥
| function mark_purchased(transaction) { | ||
| transaction.state = TransactionState.PURCHASED | ||
| for (item in transaction.items) { | ||
| if (item.mtb_product_ids) { | ||
| if (item.mtb_product_ids) { | ||
| for (mp_id in item.mtb_product_ids) { | ||
| try { | ||
| mtb_prod = get_db_mtb_product(None, mp_id, all=True, refresh=False) | ||
| mtb_prod.purchased = True | ||
| mtb_prod.save() | ||
| } | ||
| catch(exc) { | ||
| logger.error("Failed to mark mtb_product {mp_id} as purchase", exc_info=exc) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
❌ New issue: Deep, Nested Complexity Impact on Code Health Score -0.5 (-0.5 in this PR)
mark_purchased has a nested complexity depth of 4, threshold = 4
Why does this problem occur?
This function contains deeply nested logic such as if statements and/or loops. The deeper the nesting, the lower the code health. Read more.
To ignore this warning click here.
|
/cs-agent skill:fix-code-health-degradations |
|
ed70613 to
6e5c9bf
Compare
|
/cs-agent skill:fix-code-health-degradations |
|
/cs-agent skill:fix-code-health-degradations |
|
1d39f58 to
6e5c9bf
Compare
|
/cs-agent skill:fix-code-health-degradations |
|
|
/cs-agent skill:fix-code-health-degradations |
|
f554d1d to
764438c
Compare
|
/cs-agent skill:fix-code-health-degradations |
|
b00ca82 to
764438c
Compare
|
/cs-agent skill:fix-code-health-degradations |
|
Change-Id: I9eda989f7f0f13210bc66932a50455345c02eb7a
48eca5a to
7d5b3bc
Compare
|
/cs-agent skill:fix-code-health-degradations |
|
4280c30 to
7d5b3bc
Compare
There was a problem hiding this comment.
Gates Failed
Enforce critical code health rules
(1 file with Deep, Nested Complexity)
Fix Code Health degradations ℹ️
Gates Passed
4 Quality Gates Passed
Reason for failure
| Enforce critical code health rules | Violations | Code Health Impact | |
|---|---|---|---|
| js-example.js | 1 critical rule | 9.69 → 9.10 | Suppress |
Quality Gate Profile: Pay Down Tech Debt
Install CodeScene MCP: safeguard and uplift AI-generated code. Catch issues early with our IDE extension and CLI tool.
| function mark_purchased(transaction) { | ||
| transaction.state = TransactionState.PURCHASED | ||
| for (item in transaction.items) { | ||
| if (item.mtb_product_ids) { | ||
| if (item.mtb_product_ids) { | ||
| for (mp_id in item.mtb_product_ids) { | ||
| try { | ||
| mtb_prod = get_db_mtb_product(None, mp_id, all=True, refresh=False) | ||
| mtb_prod.purchased = True | ||
| mtb_prod.save() | ||
| } | ||
| catch(exc) { | ||
| logger.error("Failed to mark mtb_product {mp_id} as purchase", exc_info=exc) | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
❌ New issue: Deep, Nested Complexity
mark_purchased has a nested complexity depth of 4, threshold = 4
Change-Id: I9eda989f7f0f13210bc66932a50455345c02eb7a