Skip to content

Conversation

@eshulman2
Copy link
Contributor

@eshulman2 eshulman2 commented Dec 30, 2025

To avoid cyclomatic complexity issue I added a global dependency helper that reduces code duplication and complexity across the code (similar to the one I added to the server controller). Now it should be easier to manage dependencies and the code duplication should be (somewhat reduced).

  • create a dependency helper replacing repetitive parts of code
  • update template to use it

- create a dependency helper replacing repetative parts of code
- update template to use it
@eshulman2 eshulman2 changed the title globalize get dependency helper Cyclomatic complexity: globalize get dependency helper Dec 30, 2025
@eshulman2 eshulman2 changed the title Cyclomatic complexity: globalize get dependency helper Cyclomatic complexity: globalize fetch dependency helper Dec 31, 2025
Copy link
Collaborator

@mandre mandre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this is great! Would it also be possible to update existing controllers to use this new FetchDependency() function? This would help visualize the changes made to the template.

Description: string(ptr.Deref(filter.Description, "")),
{{- range .ImportDependencies }}
{{ . }}: ptr.Deref({{ . | camelCase }}.Status.ID, ""),
{{ . }}ID: {{ . | camelCase }}ID,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this a bug in the original template? I'm unclean why this is changed while ImportDependencies remains identical.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

semver:patch No API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants