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

Feature request: Measure metrics on a sub-file basis. #230

Open
Chris-May opened this issue Apr 8, 2024 · 2 comments
Open

Feature request: Measure metrics on a sub-file basis. #230

Chris-May opened this issue Apr 8, 2024 · 2 comments

Comments

@Chris-May
Copy link

Thank you so much for this tool! It's a great idea! You had such a great idea accumulating stats over git commits.

I want to open a discussion to have metrics measured on a finer scale.

After working with some team members to refactor code in a file, several of our wily metrics worsened. This surprised us, so I ran the file through Radon with its function-level reporting, and we could see that while some aggregated file-level metrics were worse, the individual functions were a dramatic improvement.

I've debated requesting this, as I'm sure it adds significant complexity, but I thought the increased resolution into our code bases would help us make better decisions.

@devdanzin
Copy link
Collaborator

Thanks for the feature request!

What metrics would you be interested in having per-function reporting on? Good news is I already have code for collecting per-function metrics with wily, adding support for Halstead and Raw.

There's an example of more granular metrics and a web visualization here: https://devdanzin.github.io/black/annotated_src.black.comments.py.html (click "Toggle" to cycle between per-function Cyclomatic, Halstead and Raw metrics).

IIRC, there's no text output for these per-function metrics yet (I think I only added output to the web view), but it should be easy to implement. I haven't touched this code in a while, but I'd be glad to finish it and land the feature you need.

I can't promise this will be done quickly, as I'm swamped with work, but I should be able to give you some code for testing right before or during the weekend.

@Chris-May
Copy link
Author

Thanks for your reply!

That's a nice concept for per-function metrics. Could I use that in a user group to help explain these metrics?

Not being an expert on the material, there are four metrics I gravitate to and would like to see on a per-function basis:

  • cyclomatic complexity
  • difficulty
  • effort
  • maintainability index

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