-
-
Notifications
You must be signed in to change notification settings - Fork 730
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
feat: combine services enterprise #6307
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
1 Ignored Deployment
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 2 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 0 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
🚩 Declining Code Health (highest to lowest):
- Complex Method app.ts: getApp
- Complex Method server-impl.ts: createApp
): Promise<{ app: Application; services: unknown; stores: unknown }> { | ||
let combinedServices = services; | ||
let combinedStores = stores; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Complex Method
getApp already has high cyclomatic complexity, and now it increases in Lines of Code from 158 to 163
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.
const { | ||
app, | ||
services: combinedServices, | ||
stores: combinedStores, | ||
} = await getApp(config, stores, services, unleashSession, db); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Getting worse: Complex Method
createApp already has high cyclomatic complexity, and now it increases in Lines of Code from 86 to 90
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.
9b3d9fc
to
cc454d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❌ Code Health Quality Gates: FAILED
- Declining Code Health: 2 findings(s) 🚩
- Improving Code Health: 0 findings(s) ✅
- Affected Hotspots: 0 files(s) 🔥
Recommended Review Level: Detailed -- Inspect the code that degrades in code health.
View detailed results in CodeScene
🚩 Declining Code Health (highest to lowest):
- Complex Method app.ts: getApp
- Complex Method server-impl.ts: createApp
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense
@@ -35,7 +35,9 @@ export default async function getApp( | |||
services: IUnleashServices, | |||
unleashSession?: RequestHandler, | |||
db?: Knex, | |||
): Promise<Application> { | |||
): Promise<{ app: Application; services: unknown; stores: unknown }> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we have these as parametric types? Something like <EServices extends IUnleashServices, EStores extends IUnleashStores>
): Promise<{ app: Application; services: unknown; stores: unknown }> { | |
): Promise<{ app: Application; services: EServices; stores: EStores }> { |
const { services: enterpriseServices, stores: enterpriseStores } = | ||
config.preRouterHook(app, config, services, stores, db); | ||
|
||
combinedServices = enterpriseServices; | ||
combinedStores = enterpriseStores; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to do this? I think the "beauty" of the getApp method is that it just return an app, and the preHook just modifies it
If we have to do that, I wouldn't call them enterpriseServices, I'd do something like:
const { services: extendedServices, stores: extendedStores } =
config.preRouterHook(app, config, services, stores, db);
More detailed information can be found in the unleash-enterprise repository.