-
Notifications
You must be signed in to change notification settings - Fork 6
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
New check idea: RCurl or XML dependency #44
Comments
Would you like to give it a go? That's important enough to be included in |
I will do that next week! 😺 |
Dev guide ref: https://devguide.ropensci.org/building.html#recommended-scaffolding Packages to avoid are therefore RCurl, XML, rjson, RJSONIO. |
In practice, how to extract dependencies
|
They're already part of the # in `pkgcheck` directory:
s <- pkgstats::pkgstats ()
s$desc [, c ("depends", "imports", "suggests")] # it's a one-row data.frame
#> depends
#> 1 NA
#> imports
#> 1 cli, covr, curl, gert, ghql, goodpractice, httr, jsonlite, magrittr, methods, pkgstats, rappdirs, roxygen2, rvest, srr, visNetwork
#> suggests
#> 1 callr, knitr, pkgbuild, rmarkdown, testthat Created on 2021-09-14 by the reprex package (v2.0.0.9000) |
Ah good! |
Noting that this check will not check the recursive deps |
No, of course not, recursive dep checks are and should always remain beyond scope here. |
I fully agree! Although I started wondering about ways to identify weaknesses in the dependencies stack 😁 |
One start is new library (pkgstats)
packageVersion ("pkgstats")
#> [1] '0.0.1.27'
u <- "https://cran.r-project.org/src/contrib/dplyr_1.0.7.tar.gz"
path <- file.path (tempdir (), tail (strsplit (u, "\\/") [[1]], 1))
download.file (u, destfile = path)
s <- pkgstats (path)
nrow (s$external_calls)
#> [1] 2537
x <- strsplit (pkgstats_summary (s)$external_calls, ",") [[1]]
x <- do.call (rbind, strsplit (x, ":"))
x <- data.frame (pkg = x [, 1],
n_total = as.integer (x [, 2]),
n_unique = as.integer (x [, 3]))
x$n_total_rel <- round (x$n_total / sum (x$n_total), 3)
x$n_unique_rel <- round (x$n_unique / sum (x$n_unique), 3)
x <- x [order (x$n_total, decreasing = TRUE), ]
rownames (x) <- NULL
print (x)
#> pkg n_total n_unique n_total_rel n_unique_rel
#> 1 dplyr 1404 651 0.553 0.784
#> 2 base 927 139 0.365 0.167
#> 3 utils 72 3 0.028 0.004
#> 4 generics 31 2 0.012 0.002
#> 5 stats 26 6 0.010 0.007
#> 6 tidyselect 20 4 0.008 0.005
#> 7 graphics 11 5 0.004 0.006
#> 8 methods 11 3 0.004 0.004
#> 9 vctrs 6 2 0.002 0.002
#> 10 dbplyr 5 1 0.002 0.001
#> 11 ellipsis 5 1 0.002 0.001
#> 12 rlang 4 3 0.002 0.004
#> 13 DBI 3 1 0.001 0.001
#> 14 lobstr 3 2 0.001 0.002
#> 15 tibble 3 2 0.001 0.002
#> 16 R6 2 1 0.001 0.001
#> 17 `dplyr 1 1 0.000 0.001
#> 18 lifecycle 1 1 0.000 0.001
#> 19 RSQLite 1 1 0.000 0.001
#> 20 testthat 1 1 0.000 0.001 Created on 2021-09-24 by the reprex package (v2.0.1.9000) You get full info on every function called from every package. |
so cool! I remember that from https://github.com/r-lib/itdepends |
Re-opening to extended the check to include a print method reflecting ropensci/software-review-meta#47. If any of the obsolete spatial packages are included, print a message identifying which ones, and linking to the scaffolding section for potential replacements. |
The new print methods are at the very end of the checks.
library (pkgcheck)
f <- system.file ("extdata", "pkgstats_9.9.tar.gz", package = "pkgstats")
path <- pkgstats::extract_tarball (f)
checks <- pkgcheck (path, goodpractice = FALSE)
checks$checks$has_scrap <- c ("a", "b")
checks$checks$obsolete_pkg_deps <- c ("blah", "sp", "rgdal")
print (checks)
#> Loading required namespace: goodpractice
#>
#> ── pkgstats 9.9 ────────────────────────────────────────────────────────────────
#>
#> ✔ Package name is available
#> ✔ has a 'CITATION' file.
#> ✖ Package depends on the following obsolete packages: [blah]
#> ✖ does not have a 'codemeta.json' file.
#> ✖ does not have a 'contributing' file.
#> ✔ uses 'roxygen2'.
#> ✔ 'DESCRIPTION' has a URL field.
#> ✔ 'DESCRIPTION' has a BugReports field.
#> ✖ Package has no HTML vignettes
#> ✖ These functions do not have examples: [pkgstats_from_archive.Rd].
#> ✔ Package has continuous integration checks.
#> ✖ Package contains unexpected files.
#>
#> ℹ Current status:
#> ✖ This package is not ready to be submitted.
#>
#>
#> ── git ──
#>
#> • HEAD:
#> • Default branch:
#> • Number of commits:
#> • First commit:
#> • Number of authors:
#>
#>
#> ── Package Structure ──
#>
#> ℹ Package uses the following languages:
#> • C++: 9%
#> • R: 91%
#>
#> ℹ Package has
#> • 1 author.
#> • 0 vignettes.
#> • No internal data
#> • 9 imported packages.
#> • 11 exported functions (median 43 lines of code).
#> • 120 non-exported functions (median 21 lines of code).
#> • 12 C++ functions (median 16 lines of code).
#> • 1 parameters per function (median).
#>
#> ── All statistics
#> measure value percentile noteworthy
#> 1 files_R 19.0 77.9
#> 2 files_src 3.0 82.9
#> 4 files_vignettes 0.0 0.0 TRUE
#> 5 files_tests 7.0 83.7
#> 6 loc_R 2698.0 88.6
#> 7 loc_src 277.0 29.5
#> 8 loc_tests 266.0 58.4
#> 9 num_vignettes 0.0 0.0 TRUE
#> 12 n_fns_r 131.0 78.1
#> 13 n_fns_r_exported 11.0 45.5
#> 14 n_fns_r_not_exported 120.0 82.1
#> 15 n_fns_src 12.0 83.7
#> 16 n_fns_per_file_r 3.8 52.3
#> 17 n_fns_per_file_src 4.0 36.9
#> 18 num_params_per_fn 1.0 1.1 TRUE
#> 19 loc_per_fn_r 23.0 77.1
#> 20 loc_per_fn_r_exp 43.0 76.8
#> 21 loc_per_fn_r_not_exp 21.5 79.5
#> 22 loc_per_fn_src 16.0 61.3
#> 23 rel_whitespace_R 18.8 88.1
#> 24 rel_whitespace_src 24.2 85.5
#> 25 rel_whitespace_tests 27.1 85.0
#> 26 doclines_per_fn_exp 31.0 34.6
#> 27 doclines_per_fn_not_exp 0.0 0.0 TRUE
#> 28 fn_call_network_size 104.0 77.8
#>
#> ℹ Package network diagram is at [.../pkgstats_pkgstats.html].
#>
#>
#> ── goodpractice ──
#>
#> ℹ 'goodpractice' not included with these checks
#>
#> ── Other checks ──
#>
#> ✖ Package contains the following unexpected files:
#> • a
#> • b
#> ✖ Package contains the following (potentially) obsolete packages:
#> • sp
#> • rgdal
#>
#> See our [Recommended
#> Scaffolding](https://devguide.ropensci.org/building.html?q=scaffol#recommended-scaffolding)
#> for alternatives.
#>
#> ── Package Versions ──
#>
#> pkgstats: 0.0.3.51
#> pkgcheck: 0.0.2.135 Created on 2021-11-19 by the reprex package (v2.0.1.9000) Re-opening now to also update the markdown output to reflect this console output. |
Checks for pkgstats (v0.0.3.051)git hash: 8d4e7e70
Important: All failing checks above must be addressed prior to proceeding Package License: GPL-3 1. Statistical PropertiesThis package features some noteworthy statistical properties which may need to be clarified by a handling editor prior to progressing. Details of statistical properties (click to open)
The package has:
Statistical properties of package structure as distributional percentiles in relation to all current CRAN packages
The final measure (
1a. Network visualisationClick to see the interactive network visualisation of calls between objects in package 2.
|
name | conclusion | sha | date |
---|---|---|---|
pkgdown | success | 8d4e7e | 2021-11-17 |
R-CMD-check | failure | 8d4e7e | 2021-11-17 |
test-coverage | success | 8d4e7e | 2021-11-17 |
3b. goodpractice
results
R CMD check
with rcmdcheck
rcmdcheck found no errors, warnings, or notes
Test coverage with covr
Package coverage: 86.7
Cyclocomplexity with cyclocomp
No functions have cyclocomplexity >= 15
Static code analyses with lintr
lintr found the following 496 potential issues:
message | number of times |
---|---|
Avoid changing the working directory, or restore it in on.exit | 2 |
Lines should not be more than 80 characters. | 494 |
3. Other Checks
✖️ Package contains the following unexpected files:
- a
- b
✖️ Package contains the following (potentially) obsolete packages:
- sp
- rgdal
See our Recommended Scaffolding for alternatives.
Package Versions
package | version |
---|---|
pkgstats | 0.0.3.51 |
pkgcheck | 0.0.2.139 |
No description provided.
The text was updated successfully, but these errors were encountered: