You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found and have grown fond of a particular metric. cyclomatic complexity (wikipedia link) To save you the "definition jargon", it counts your ifs, while, blocks, etc. in a function. Meaning, even a short, but a highly nested function is 'bad' and a long function can be considered 'good' if only it's not very complex and mostly linear / sequential.
Which takes a python file and returns a sorted list of the functions in that file, with color coding and the worst being at the top.
For my case I can just set it up as a custom command.
But I still need to remember to press the button. It would be a quality of life improvement if the command ran automatically, let's say every time I save a file and if the feedback I'm getting wouldn't come as text output in the built in console, but as some kind of colored hint in the symbol list. E.g. maybe a colored [CC:A] or [CC:F].
Since it's a general metric, it may be interesting to set this up for other languages as well.
The text was updated successfully, but these errors were encountered:
Hello everyone.
I found and have grown fond of a particular metric. cyclomatic complexity (wikipedia link) To save you the "definition jargon", it counts your ifs, while, blocks, etc. in a function. Meaning, even a short, but a highly nested function is 'bad' and a long function can be considered 'good' if only it's not very complex and mostly linear / sequential.
I use it in python with this module: https://radon.readthedocs.io/en/latest/intro.html#cyclomatic-complexity
Which takes a python file and returns a sorted list of the functions in that file, with color coding and the worst being at the top.
For my case I can just set it up as a custom command.
But I still need to remember to press the button. It would be a quality of life improvement if the command ran automatically, let's say every time I save a file and if the feedback I'm getting wouldn't come as text output in the built in console, but as some kind of colored hint in the symbol list. E.g. maybe a colored [CC:A] or [CC:F].
Since it's a general metric, it may be interesting to set this up for other languages as well.
The text was updated successfully, but these errors were encountered: