<commit_before>#!/usr/bin/env bash
set -Eeuxo pipefail

# Package checks
#
# See also:
# - R CMD build --help
# - R CMD check --help
# - Travis CI recipe
#   https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/r.rb

# Bug fix for `Sys.timezone()` when `timedatectl` is installed.
# https://github.com/rocker-org/rocker-versioned/issues/89
export TZ="America/New_York"

# Get the package version and define the `R CMD build` tarball output.
PKG_NAME="$(basename "$PWD")"
PKG_VERSION="$(grep -E "^Version:\s[.0-9a-z]+$" DESCRIPTION | sed "s/^Version:\s//")"
PKG_TARBALL="${PKG_NAME}_${PKG_VERSION}.tar.gz"

echo "Session information"
Rscript -e "utils::sessionInfo()"
Rscript -e "sessioninfo::session_info()"

echo "Installed packages"
Rscript -e "installed.packages()[, \"Version\", drop = TRUE]"

echo "R CMD check"
# Set `--as-cran` flag for extra verbose incoming package checks.
R CMD build . --no-build-vignettes --no-manual
R CMD check "$PKG_TARBALL" --ignore-vignettes --no-manual --timings

echo "BiocCheck"
# Note that running `R CMD BiocCheck` directly requires `script/BiocCheck` to
# be installed at `/usr/lib64/R/bin`. Otherwise, can run directly using Rscript.
# Set `--new-package` flag for extra verbose incoming package checks.
Rscript -e "BiocCheck::BiocCheck( \
    package = \"${PKG_TARBALL}\", \
    \`no-check-R-ver\` = TRUE, \
    \`no-check-bioc-help\` = TRUE, \
    \`no-check-remotes\` = TRUE, \
    \`no-check-version-num\` = TRUE, \
    \`no-check-vignettes\` = TRUE, \
    \`quit-with-status\` = TRUE)"

rm "$PKG_TARBALL"

echo "Coverage"
Rscript -e "covr::package_coverage()"

echo "lintr"
Rscript -e "if (packageVersion(\"base\") >= \"3.6\") \
    lintr::lint_package(path = \".\")"<commit_msg>Update rcmdcheck<commit_after>#!/usr/bin/env bash
set -Eeuxo pipefail

# Package checks
#
# See also:
# - R CMD build --help
# - R CMD check --help
# - Travis CI recipe
#   https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/script/r.rb

# Bug fix for `Sys.timezone()` when `timedatectl` is installed.
# https://github.com/rocker-org/rocker-versioned/issues/89
export TZ="America/New_York"

# Get the package version and define the `R CMD build` tarball output.
PKG_NAME="$(basename "$PWD")"
PKG_VERSION="$(grep -E "^Version:\s[.0-9a-z]+$" DESCRIPTION | sed "s/^Version:[[:space:]]//")"
PKG_TARBALL="${PKG_NAME}_${PKG_VERSION}.tar.gz"

echo "Session information"
Rscript -e "utils::sessionInfo()"
Rscript -e "sessioninfo::session_info()"

echo "R CMD check"
# Set `--as-cran` flag for extra verbose incoming package checks.
R CMD build . --no-build-vignettes --no-manual
R CMD check "$PKG_TARBALL" --ignore-vignettes --no-manual --timings

echo "BiocCheck"
# Note that running `R CMD BiocCheck` directly requires `script/BiocCheck` to
# be installed at `/usr/lib64/R/bin`. Otherwise, can run directly using Rscript.
# Set `--new-package` flag for extra verbose incoming package checks.
Rscript -e "BiocCheck::BiocCheck( \
    package = \"${PKG_TARBALL}\", \
    \`no-check-R-ver\` = TRUE, \
    \`no-check-bioc-help\` = TRUE, \
    \`no-check-remotes\` = TRUE, \
    \`no-check-version-num\` = TRUE, \
    \`no-check-vignettes\` = TRUE, \
    \`quit-with-status\` = TRUE)"

rm "$PKG_TARBALL"

echo "Coverage"
Rscript -e "covr::package_coverage()"

echo "lintr"
Rscript -e "if (packageVersion(\"base\") >= \"3.6\") \
    lintr::lint_package(path = \".\")"
{'fraction_non_alphanumeric': 0.18229623137598597, 'fraction_numerical': 0.004674262342973999, 'mean_word_length': 3.652173913043478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4644651', 'n_tokens_mistral': 1336, 'n_tokens_neox': 1289, 'n_words': 310}