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

plugin idea: cyclomatic complexity somewhere near the functionname in the symbol list. #1356

Open
BMaxV opened this issue Jun 9, 2024 · 1 comment

Comments

@BMaxV
Copy link

BMaxV commented Jun 9, 2024

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.

@elextr
Copy link
Member

elextr commented Jun 9, 2024

You can do this with a plugin that runs at save and displays the data in a separate sidebar. Such a plugin could support a number of languages.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants