Skip to content
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

Refactor com.vaadin.flow.spring.VaadinServletContextInitializer #20781

Open
mshabarov opened this issue Dec 23, 2024 · 0 comments
Open

Refactor com.vaadin.flow.spring.VaadinServletContextInitializer #20781

mshabarov opened this issue Dec 23, 2024 · 0 comments

Comments

@mshabarov
Copy link
Contributor

Describe your motivation

Code Analysis highlights:

  • The module has at least 3 different responsibilities amongst its 48 functions.

  • This file has 2 bumpy roads.
    VaadinServletContextInitializer.CustomResourceLoader.collectResources(bumps = 6)
    VaadinServletContextInitializer(bumps = 2)
    A Bumpy Road is a function that contains multiple chunks of nested conditional logic inside the same function. The deeper the nesting and the more bumps, the lower the code health.

  • The file contains 1 functions with deeply nested conditional logic.
    VaadinServletContextInitializer.CustomResourceLoader.collectResources(Nesting depth = 5 conditionals)

  • 4 methods have high complexity:
    VaadinServletContextInitializer.CustomResourceLoader.collectResources(cc = 19)
    VaadinServletContextInitializer.DevModeServletContextListener.failFastContextInitialized(cc = 18)
    VaadinServletContextInitializer.RouteServletContextListener.failFastContextInitialized(cc = 14)
    VaadinServletContextInitializer(cc = 9)### Describe the solution you'd like

  • One method has complex conditionals.
    VaadinServletContextInitializer.DevModeServletContextListener.failFastContextInitialized:579(2 complex conditional expressions)

  • You have 3 functions that exceed the threshold.
    VaadinServletContextInitializer.DevModeServletContextListener.failFastContextInitialized(LoC = 77 lines)
    VaadinServletContextInitializer.RouteServletContextListener.failFastContextInitialized(LoC = 75 lines)
    VaadinServletContextInitializer.CustomResourceLoader.collectResources(LoC = 73 lines)

Additional context

See CodeScene analysis.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Internal Backlog / Technical Debt
Development

No branches or pull requests

1 participant