Auth - PM-7392 & PM-7436 - Token Service - Desktop - Add disk fallback for secure storage failures #8913
CodeScene PR Check
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 4 findings(s) 🚩
- Improving Code Health: 2 findings(s) ✅
- Affected Hotspots: 2 files(s) 🔥
View detailed results in CodeScene
Absence of Expected Change Pattern
- clients/libs/common/src/services/api.service.ts is usually changed with: clients/libs/common/src/abstractions/api.service.ts
Details
🚩 Declining Code Health (highest to lowest):
- Large Method service-container.ts: ServiceContainer.constructor
- Complex Method token.service.ts: TokenService.setRefreshToken
- Complex Method token.service.ts: TokenService.getAccessToken
- Bumpy Road Ahead token.service.ts: TokenService.getAccessToken
✅ Improving Code Health:
- Overall Code Complexity app.component.ts
- Bumpy Road Ahead app.component.ts: AppComponent.logOut 🔥
Annotations
Check notice on line 1 in libs/common/src/auth/services/token.service.spec.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1426 to 1633, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
Check notice on line 1 in libs/common/src/auth/services/token.service.spec.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Number of Functions in a Single Module
The number of functions increases from 153 to 165, threshold = 75. This file contains too many functions. Beyond a certain threshold, more functions lower the code health.
Check warning on line 553 in libs/common/src/auth/services/token.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Complex Method
TokenService.setRefreshToken increases in cyclomatic complexity from 10 to 14, threshold = 9. 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.
Check warning on line 475 in libs/common/src/auth/services/token.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Complex Method
TokenService.getAccessToken has a cyclomatic complexity of 10, threshold = 9. 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.
Check warning on line 475 in libs/common/src/auth/services/token.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ New issue: Bumpy Road Ahead
TokenService.getAccessToken has 2 blocks with nested conditional logic. Any nesting of 2 or deeper is considered. Threshold is one single, nested block per function. The Bumpy Road code smell is a function that contains multiple chunks of nested conditional logic. The deeper the nesting and the more bumps, the lower the code health.
Check notice on line 1 in libs/common/src/auth/services/token.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 4.07 to 4.35, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check notice on line 1 in apps/desktop/src/app/app.component.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Overall Code Complexity
The mean cyclomatic complexity increases from 6.63 to 6.65, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check notice on line 718 in apps/desktop/src/app/app.component.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ No longer an issue: Bumpy Road Ahead
AppComponent.logOut is no longer above the threshold for logical blocks with deeply nested code
Check notice on line 1 in libs/common/src/services/api.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Lines of Code in a Single File
The lines of code increases from 1364 to 1366, improve code health by reducing it to 1000. The number of Lines of Code in a single file. More Lines of Code lowers the code health.
Check notice on line 39 in apps/cli/src/platform/services/node-api.service.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
ℹ Getting worse: Excess Number of Function Arguments
NodeApiService.constructor increases from 7 to 9 arguments, threshold = 4. This function has too many arguments, indicating a lack of encapsulation. Avoid adding more arguments.
Check notice on line 1 in apps/browser/src/popup/app.component.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
✅ Getting better: Overall Code Complexity
The mean cyclomatic complexity decreases from 5.00 to 4.78, threshold = 4. This file has many conditional statements (e.g. if, for, while) across its implementation, leading to lower code health. Avoid adding more conditionals.
Check warning on line 672 in apps/cli/src/service-container.ts
codescene-delta-analysis / CodeScene Cloud Delta Analysis (main)
❌ Getting worse: Large Method
ServiceContainer.constructor increases from 416 to 423 lines of code, threshold = 70. Large functions with many lines of code are generally harder to understand and lower the code health. Avoid adding more lines to this function.