dweb-search-frontend
dweb-search-frontend copied to clipboard
Enable "won't fix" to CodeClimate (for cognitive complexity issues in composable functions.)
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.
