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

Enable "won't fix" to CodeClimate (for cognitive complexity issues in composable functions.) #252

Open
femans opened this issue Sep 24, 2022 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@femans
Copy link
Contributor

femans commented Sep 24, 2022

CodeClimate signals something called "cognitive complexity" in code, which in practice means that to evaluate a single function a large number of (unit) tests would be needed. The number associated with Cognitive Complexity roughly correlates somehow with the amount of code paths through a function. (Idk if this is (partially) logarithmic or not, I guess it is.)

Unfortunately it is very vague which statements contribute to the cognitive complexity, making it hard to fix sometimes.

CodeClimate does not look at the typical Vue structure called 'composables', which are functions with the sole purpose of distributing other functions throughout different Vue components. As the amount of functions grows which contain conditional statements in them, it seems that the code complexity grows faster.

The default maximum cognitive complexity is 5, and this is fine, it very often has a good point. But it would be good to override this sometimes in specific cases, for which there should be functionality in github. https://docs.codeclimate.com/docs/issues#section-issue-statuses

But in our setup the option is not available. It would be good if we would have this setting available for issues which simply can not be solved.

Describe alternatives you've considered
An alternative is increasing the maximum allowed cognitive complexity in the CC settings, but this would cause some code smell to go unnoticed.

image

@femans femans added the enhancement New feature or request label Sep 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants