Skip to content

Conversation

jjmerchante
Copy link
Contributor

This PR allows defining custom thresholds for metrics like Pony factor, Elephant factor, and Developer onion analysis.

Wait for #15 to be merged to update the tests

Copy link
Member

@sduenas sduenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR looks ok but I suggest to add some checks to validate the input before doing anything else.

Comment on lines 83 to 93
@click.option("--pony-threshold", type=float, show_default=True, help="Pony factor threshold, between 0 and 1", default=0.5)
@click.option(
"--elephant-threshold", type=float, show_default=True, help="Elephant factor threshold, between 0 and 1", default=0.5
)
@click.option(
"--dev-categories-thresholds",
type=str,
show_default=True,
help="Developer categories thresholds, between 0 and 1",
default="0.8,0.95",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Click has options to check that the values are between 0 and 1. I think it's something the script has to check before doing anything else.

Comment on lines 87 to 93
@click.option(
"--dev-categories-thresholds",
type=str,
show_default=True,
help="Developer categories thresholds, between 0 and 1",
default="0.8,0.95",
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's better to pass to numbers instead of a string that we have to parse later. If it's not possible to do it, click should parse it and convert it to numbers.

binary_file_pattern: str | None = None,
pony_threshold: float = 0.5,
elephant_threshold: float = 0.5,
dev_categories_thresholds: str = "0.8,0.95",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a tuple of numbers (maybe a named tuple) and not a string.

@jjmerchante jjmerchante force-pushed the metrics-thresholds branch 2 times, most recently from b93827a to 5a6f92e Compare March 18, 2025 10:27
This commit allows to define custom thresholds for metrics like
Pony factor, Elephant factor and Developer onion analysis.

Signed-off-by: Jose Javier Merchante <[email protected]>
Copy link
Member

@sduenas sduenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@sduenas sduenas merged commit 64dce60 into Bitergia:main Mar 18, 2025
5 checks passed
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

Successfully merging this pull request may close these issues.

2 participants