Conversation
There was a problem hiding this comment.
❌ Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 1 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Lightweight sanity check
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method BadService.cs: Calculate 🔥
✅ Positive Code Health Impact (highest to lowest):
- String Heavy Function Arguments BadService.cs 🔥
There was a problem hiding this comment.
❌ Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 1 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Lightweight sanity check
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method BadService.cs: Calculate 🔥
✅ Positive Code Health Impact (highest to lowest):
- String Heavy Function Arguments BadService.cs 🔥
There was a problem hiding this comment.
❌ Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 1 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Lightweight sanity check
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method BadService.cs: Calculate 🔥
✅ Positive Code Health Impact (highest to lowest):
- String Heavy Function Arguments BadService.cs 🔥
There was a problem hiding this comment.
❌ Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 1 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Lightweight sanity check
View detailed results in CodeScene
🚩 Negative Code Health Impact (highest to lowest):
- Complex Method BadService.cs: Calculate 🔥
✅ Positive Code Health Impact (highest to lowest):
- String Heavy Function Arguments BadService.cs 🔥
There was a problem hiding this comment.
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 1 findings(s) 🚩
- Improving Code Health: 1 findings(s) ✅
- Affected Hotspots: 1 files(s) 🔥
Recommended Review Level: Lightweight sanity check
View detailed results in CodeScene
🚩 Declining Code Health (highest to lowest):
- Complex Method BadService.cs: Calculate 🔥
✅ Improving Code Health:
- String Heavy Function Arguments BadService.cs 🔥
| } | ||
| } | ||
|
|
||
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) |
There was a problem hiding this comment.
ℹ Getting worse: Code Duplication
introduced similar code in: Calculate
Why does this problem occur?
Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health. Read more.
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) | ||
| { | ||
| decimal result = 0; | ||
| decimal disc = (years > 5) ? (decimal)5 / 100 : (decimal)years / 100; | ||
| if (type == 1) | ||
| { | ||
| result = amount; | ||
| if (type == 1) | ||
| { | ||
| result = amount; | ||
| } | ||
| else if (type == 2) | ||
| { | ||
| result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount)); | ||
| } | ||
| else if (type == 3) | ||
| { | ||
| result = (0.7m * amount) - disc * (0.7m * amount); | ||
| } | ||
| else if (type == 4) | ||
| { | ||
| result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount)); | ||
| } | ||
| return result; | ||
| } | ||
| else if (type == 2) | ||
| { | ||
| result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount)); | ||
| } | ||
| else if (type == 3) | ||
| { | ||
| result = (0.7m * amount) - disc * (0.7m * amount); | ||
| } | ||
| else if (type == 4) | ||
| { | ||
| result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount)); | ||
| } | ||
| return result; | ||
| } |
There was a problem hiding this comment.
❌ New issue: Complex Method
Calculate has a cyclomatic complexity of 10, threshold = 9
Why does this problem occur?
This function has many conditional statements (e.g. if, for, while), leading to lower code health. Avoid adding more conditionals and code to it without refactoring. Read more.
To ignore this warning click here.
| } | ||
| } | ||
|
|
||
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) |
There was a problem hiding this comment.
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 9.25 to 9.29, threshold = 4
Why does this problem occur?
This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals. Read more.
| } | ||
| } | ||
|
|
||
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) |
There was a problem hiding this comment.
ℹ Getting worse: Primitive Obsession
The ratio of primitive types in function arguments increases from 96.55% to 97.14%, threshold = 30.0%
Why does this problem occur?
The functions in this file have too many primitive types (e.g. int, double, float) in their function argument lists. Using many primitive types lead to the code smell Primitive Obsession. Avoid adding more primitive arguments. Read more.
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) | ||
| { | ||
| decimal result = 0; | ||
| decimal disc = (years > 5) ? (decimal)5 / 100 : (decimal)years / 100; | ||
| if (type == 1) | ||
| { | ||
| result = amount; | ||
| if (type == 1) | ||
| { | ||
| result = amount; | ||
| } | ||
| else if (type == 2) | ||
| { | ||
| result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount)); | ||
| } | ||
| else if (type == 3) | ||
| { | ||
| result = (0.7m * amount) - disc * (0.7m * amount); | ||
| } | ||
| else if (type == 4) | ||
| { | ||
| result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount)); | ||
| } | ||
| return result; | ||
| } | ||
| else if (type == 2) | ||
| { | ||
| result = (amount - (0.1m * amount)) - disc * (amount - (0.1m * amount)); | ||
| } | ||
| else if (type == 3) | ||
| { | ||
| result = (0.7m * amount) - disc * (0.7m * amount); | ||
| } | ||
| else if (type == 4) | ||
| { | ||
| result = (amount - (0.5m * amount)) - disc * (amount - (0.5m * amount)); | ||
| } | ||
| return result; | ||
| } |
There was a problem hiding this comment.
ℹ Getting worse: Excess Number of Function Arguments
Calculate increases from 5 to 6 arguments, threshold = 4
Why does this problem occur?
This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments. Read more.
| } | ||
| } | ||
|
|
||
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) |
There was a problem hiding this comment.
ℹ New issue: Excess Number of Function Arguments
Calculate has 5 arguments, threshold = 4
Why does this problem occur?
This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments. Read more.
| } | ||
| } | ||
|
|
||
| public decimal Calculate(decimal amount, int type, int years, bool foo1, bool foo2, bool foo3) |
There was a problem hiding this comment.
✅ No longer an issue: String Heavy Function Arguments
The ratio of strings in function arguments is no longer above the threshold
No description provided.