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

Review PaRe reports of HADES packages, and identify points for improvement #22

Open
schuemie opened this issue Oct 21, 2023 · 1 comment

Comments

@schuemie
Copy link
Member

@mvankessel-EMC generated PaRe reports for all HADES packages and added links to the reports to the package status page. We should review these reports and identify places where refactoring is needed.

@mvankessel-EMC
Copy link
Contributor

mvankessel-EMC commented Nov 10, 2023

It's too late for the HADES Hack-a-thon, but I thought it would be useful to show how I go through the PaRe reports. So here are some things I picked up for Achilles.

Achilles

Function diagram

image
Function diagram of Achilles

There are two functions that interact with a lot of other (internal) functions: achilles() and exportToJson(). These are the functions that carry out most of the work, and should probably be prioritized for unit-testing.

Function Definitions

Function Number of arguments Lines of code Cyclomatic complexity Location
achilles 24 505 96 Achilles.R (from line: 127)

achilles() could probably do with some refactoring. It has a lot of logic behind it, which theoretically requires 96 different unit tests to test all of the 505 lines of code. It also has bunch of arguments (24), which is not ideal, but provides an all-in-one way to interact with the package.

According to Codecov 2% of the code is covered. To meaningfully refactor anything unit-tests need to be made to to safeguard the current behavior.

Lintr

There are quite some code-style messages and warnings. Most of which boil down to:

  • local variable 'x' assigned but may not be used
  • 1:nrow(...) is likely to be wrong in the empty edge case. Use seq_len(nrow(...)) instead.
  • Lines should not be more than 80 characters.
  • Commas should always have a space after.
  • Trailing whitespace is superfluous.

Dependencies

  • tseries is not whitelisted, but saw its last CRAN update on 2023-05-02. But is only used for one function: tseries::adf.test(). And is called once in isStationary()
  • data.table is used for one function: data.table::fwrite(), which is widely used in various functions in exportToAres.R.
  • readr is used for one function: readr::write_csv(). And is called once in exportResultsToCSV()
  • tidyr is used for one function: tidyr::crossing. And is called once in generateDomainOverlapSql()

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