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

[STYLE] Reduce Cyclomatic Complexity in gatherTemplates Function #15

Open
2 tasks done
YidiDev opened this issue Oct 10, 2024 · 0 comments
Open
2 tasks done

[STYLE] Reduce Cyclomatic Complexity in gatherTemplates Function #15

YidiDev opened this issue Oct 10, 2024 · 0 comments
Labels
style Applies to issues or pull requests focusing on code style

Comments

@YidiDev
Copy link
Member

YidiDev commented Oct 10, 2024

Description

The cyclomatic complexity of the gatherTemplates function in internal/adminpanel/templates.go is currently 19, which exceeds the recommended threshold of 15. This high complexity can make the code difficult to maintain and test.

Location

  • File: internal/adminpanel/templates.go
  • Line number(s): 79

Expected Style

According to the project's guidelines, functions should aim for a cyclomatic complexity of 15 or lower to ensure maintainability and readability.

Current Style

The gatherTemplates function has a cyclomatic complexity of 19, indicating a high number of decision points which need simplification.

Additional Context

Reducing cyclomatic complexity can enhance readability and maintainability. Code snippets are needed to identify specific points for refactoring.

Suggestions for Improvement

Consider refactoring the function by breaking it down into smaller, more manageable helper functions, or using design patterns that simplify decision structures.

Environment

All development environments

Checklist

  • I have checked if this style is mentioned in the project's style guide.
  • I have checked previous issues for similar stylistic concerns.

@YidiDev YidiDev added the style Applies to issues or pull requests focusing on code style label Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
style Applies to issues or pull requests focusing on code style
Projects
None yet
Development

No branches or pull requests

1 participant