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

pkg_metric_size_codebase() behaves inversely of what's documented #330

Open
fh-kpikhart opened this issue Feb 21, 2024 · 0 comments
Open
Assignees
Labels
Bug Something isn't working

Comments

@fh-kpikhart
Copy link
Contributor

fh-kpikhart commented Feb 21, 2024

This function documentation states that score 1 is given for large number of lines of code, however the opposite is observed.

0 lines of code gives a score of 1. 10k lines of code gives a score of 0.01:

riskmetric:::metric_score.pkg_metric_size_codebase(0)
# [1] 1
riskmetric:::metric_score.pkg_metric_size_codebase(100)
# [1] 0.6
riskmetric:::metric_score.pkg_metric_size_codebase(10000)
# [1] 0.01477833

This seems to be the graph as currently implemented:
https://www.google.com/search?q=y+%3D+1.5+%2F+(x+%2F+100+%2B+1.5)

#' Score a package for number of lines of code
#'
#' Scores packages based on its codebase size, as determined by number of lines of code.
#'
#' @eval roxygen_score_family("size_codebase")
#'
#' @return numeric value between \code{0} (low) and \code{1} (large number of lines of code) converting the number of downloads.
#' @export
metric_score.pkg_metric_size_codebase <- function(x, ...) {
1.5 / (x / 1e2 + 1.5)
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants