Skip to content

Align with r-lib package conventions #5

Backlog

Description

@achubaty

These come from the same review of development at 1109f11, comparing the package with the r-lib package development practices. None of them affects results. They are cheapest to fix now, while the package is small.

  • Formatting.
    • There is no air.toml, and air format --check would change all 13 R files.
    • 148 roxygen and comment lines in R/ are longer than 80 characters.
    • Formatting once now keeps later diffs readable. In LandR the same step would bury every other change in the diff.
  • Tests.
    • Errors are tested with expect_error() (test-disturbanceYear.R:91, 209, 218; test-inputs.R:38-40; test-scanfi-access.R:67, 83). expect_snapshot(error = TRUE) records the whole message so it can be reviewed. There are no snapshot tests yet.
    • expect_true() and expect_false() are used widely: 14 times in test-scanfi-access.R and 9 in test-scanfiMirror.R. A specific expectation gives a more useful failure message.
    • Test files are named by function rather than by R file: test-prepInputsFireYear.R, test-prepInputsFireYear-grid.R and test-prepInputsStandAgeMap.R all test R/standAge.R. replaceAgeInFires(): use a startTime after 2023 #3 adds test-standAge.R.
    • test-prepInputsStandAgeMap.R:8 has skip_if_not(interactive()), so that test never runs in CI or in R CMD check.
  • Examples.
    • prepInputsStandAgeMap() and replaceAgeInFires() use \dontrun{} (standAge.R:51, 516).
    • disturbancesByYear(), lastDisturbanceYear() and scanfiUrlRemap() have no examples.
  • Documentation.
    • disturbancesByYear() and lastDisturbanceYear() have no @return.
    • There is no pkgdown site.
  • Arguments. prepInputsDisturbanceYear(), lastDisturbanceYear() and replaceAgeInFires() barely check their arguments. For example, an NA startTime stops at if () with "missing value where TRUE/FALSE needed".
  • CI runs R-CMD-check only; LandR also runs test-coverage.
  • README has installation only, with no example or badges. There is no CITATION file.
  • NEWS.
    • No item gives a (#N) reference.
    • The 0.0.1 items are not ordered by function name.
    • One version bump (0.0.1.9000) covers several merged PRs; running usethis::use_version("dev") for each change keeps them apart.
  • Minor.
    • asInteger() lacks the leading dot the other internal functions use (standAge.R:561).
    • Multi-line function(y) bodies have no braces (disturbanceYear.R:135, 364).
    • terra and data.table have no minimum versions.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions