CodelyTV / pr-size-labeler

🏷 Visualize and optionally limit the size of your Pull Requests
https://github.com/marketplace/actions/pull-request-size-labeler
MIT License
336 stars 58 forks source link

Also include amount of changed files to the calculation to show complexity of pr instead of size only #69

Open HerrDerb opened 5 months ago

HerrDerb commented 5 months ago

Currently the size of a PR is determined by the amount of changes (Deletion+ Modification)

In my perception, I take on on a PR which has 120 changes in a single file much easier, as on a PR which has 120 changes across 30 files. In other words, the complexity is more interesting as the size only.

By taking a file weight into account (1 file = x changes) the labels would effectively show the complexity of the pr.

johnlk commented 5 months ago

That's an interesting concept. It might require a new parameter like "size_by_complexity: false" which is defaulted to false.

The complexity though is a bit subjective. Would you judge based on the lines added per file relative to the original files size? Or just the total number of files touched in general?

There are code complexity algorithms that a user might assume are being used if this param is enabled such as cognitive complexity which is used by CodeClimate.

HerrDerb commented 5 months ago

Good thoughts. Well as you probably already have seen, I took a simple approach with the amounts of file being touched, as in my perception, it doesn't matter if there is 1 line change or 30 in a single file. What for me seems to increases the complexity is the context switch from file to file. Might be subjective though. I hear that you'd prefer to use the changed line/total line ratio? Also the naming should be clear that is not about "code complexity" as it is not a static code analysis.

Disclaimer: I'm surly not that common with shell scripts :)