Skip to content

Commit

Permalink
Corrected errors reported by CRAN
Browse files Browse the repository at this point in the history
- Set `rf` parameter in `td_env` function call to FALSE in features.Rmd, overview.Rmd and README.Rmd files.
  It was causing problems with CRAN checks [#2](#2)
- Deleted old test-coverage.yaml file. Replaced it with R-CMD-check.yaml
- Updated lint.yaml file to latest version
- Ran lintr on the project. Implemented the recommendations of the tool
- Updated badges in README.Rmd
  • Loading branch information
pakjiddat committed Oct 7, 2024
1 parent a642b2e commit f4eaa36
Show file tree
Hide file tree
Showing 42 changed files with 965 additions and 491 deletions.
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,5 @@
^CRAN-RELEASE$
^codecov\.yml$
^CRAN-SUBMISSION$
^NEWS.html$
^revdep$
52 changes: 52 additions & 0 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]

name: R-CMD-check.yaml

permissions: read-all

jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}

name: ${{ matrix.config.os }} (${{ matrix.config.r }})

strategy:
fail-fast: false
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
- {os: ubuntu-latest, r: 'release'}
- {os: ubuntu-latest, r: 'oldrel-1'}

env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
R_KEEP_PKG_SOURCE: yes

steps:
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-pandoc@v2

- uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.config.r }}
http-user-agent: ${{ matrix.config.http-user-agent }}
use-public-rspm: true

- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::rcmdcheck
needs: check

- uses: r-lib/actions/check-r-package@v2
with:
upload-snapshots: true
build_args: 'c("--no-manual","--compact-vignettes=gs+qpdf")'
85 changes: 0 additions & 85 deletions .github/workflows/check-standard.yaml

This file was deleted.

48 changes: 16 additions & 32 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,49 +1,33 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master

name: lint
name: lint.yaml

permissions: read-all

jobs:
lint:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v2

- uses: r-lib/actions/setup-r@v1

- name: Query dependencies
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
shell: Rscript {0}
- uses: actions/checkout@v4

- name: Restore R package cache
uses: actions/cache@v2
- uses: r-lib/actions/setup-r@v2
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-
use-public-rspm: true

- name: Install dependencies
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("lintr")
shell: Rscript {0}

- name: Install package
run: R CMD INSTALL .
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::lintr, local::.
needs: lint

- name: Lint
run: lintr::lint_package()
shell: Rscript {0}
env:
LINTR_ERROR_ON_LINT: true
71 changes: 42 additions & 29 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,48 +1,61 @@
# Workflow derived from https://github.com/r-lib/actions/tree/v2/examples
# Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help
on:
push:
branches:
- main
- master
branches: [main, master]
pull_request:
branches:
- main
- master
branches: [main, master]

name: test-coverage
name: test-coverage.yaml

permissions: read-all

jobs:
test-coverage:
runs-on: macOS-latest
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- uses: r-lib/actions/setup-r@v1
- uses: r-lib/actions/setup-r@v2
with:
use-public-rspm: true

- uses: r-lib/actions/setup-pandoc@v1
- uses: r-lib/actions/setup-r-dependencies@v2
with:
extra-packages: any::covr, any::xml2
needs: coverage

- name: Query dependencies
- name: Test coverage
run: |
install.packages('remotes')
saveRDS(remotes::dev_package_deps(dependencies = TRUE), ".github/depends.Rds", version = 2)
writeLines(sprintf("R-%i.%i", getRversion()$major, getRversion()$minor), ".github/R-version")
cov <- covr::package_coverage(
quiet = FALSE,
clean = FALSE,
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
)
covr::to_cobertura(cov)
shell: Rscript {0}

- name: Restore R package cache
uses: actions/cache@v2
- uses: codecov/codecov-action@v4
with:
path: ${{ env.R_LIBS_USER }}
key: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-${{ hashFiles('.github/depends.Rds') }}
restore-keys: ${{ runner.os }}-${{ hashFiles('.github/R-version') }}-1-

- name: Install dependencies
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
file: ./cobertura.xml
plugin: noop
disable_search: true
token: ${{ secrets.CODECOV_TOKEN }}

- name: Show testthat output
if: always()
run: |
install.packages(c("remotes"))
remotes::install_deps(dependencies = TRUE)
remotes::install_cran("covr")
shell: Rscript {0}
## --------------------------------------------------------------------
find '${{ runner.temp }}/package' -name 'testthat.Rout*' -exec cat '{}' \; || true
shell: bash

- name: Test coverage
run: covr::codecov()
shell: Rscript {0}
- name: Upload test results
if: failure()
uses: actions/upload-artifact@v4
with:
name: coverage-test-failures
path: ${{ runner.temp }}/package
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
vignettes/features_cache
vignettes/overview_cache
README_cache
revdep
9 changes: 7 additions & 2 deletions .lintr
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
linters: with_defaults(
linters: linters_with_defaults(
object_name_linter(styles = c("CamelCase", "snake_case")),
cyclocomp_linter(complexity_limit = 35),
paren_brace_linter = NULL)
indentation_linter=NULL,
T_and_F_symbol_linter=NULL,
commented_code_linter=NULL,
object_usage_linter=NULL
) # see vignette("lintr")
encoding: "UTF-8"
6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: wordpredictor
Title: Develop Text Prediction Models Based on N-Grams
Version: 0.0.3
Version: 0.0.4
URL: https://github.com/pakjiddat/word-predictor, https://pakjiddat.github.io/word-predictor/
BugReports: https://github.com/pakjiddat/word-predictor/issues
Authors@R:
Expand All @@ -13,14 +13,14 @@ Description: A framework for developing n-gram models for text prediction.
It provides data cleaning, data sampling, extracting tokens from text,
model generation, model evaluation and word prediction. For information on how n-gram models
work we referred to: "Speech and Language Processing"
<https://web.stanford.edu/~jurafsky/slp3/3.pdf>. For optimizing R code and
<https://web.archive.org/web/20240919222934/https%3A%2F%2Fweb.stanford.edu%2F~jurafsky%2Fslp3%2F3.pdf>. For optimizing R code and
using R6 classes we referred to "Advanced R"
<https://adv-r.hadley.nz/r6.html>. For writing R extensions we referred to
"R Packages", <https://r-pkgs.org/index.html>.
License: MIT + file LICENSE
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.3.2
Imports: digest, ggplot2, patchwork, stringr, dplyr, SnowballC
Suggests:
testthat,
Expand Down
450 changes: 450 additions & 0 deletions NEWS.html

Large diffs are not rendered by default.

27 changes: 17 additions & 10 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
# wordpredictor 0.0.4

## Bug fixes

- Set `rf` parameter in `td_env` function call to FALSE in features.Rmd, overview.Rmd and README.Rmd files.
It was causing problems with CRAN checks [#2](https://github.com/pakjiddat/word-predictor/issues/2).

# wordpredictor 0.0.3

## Bug fixes

* Disabled caching in R Markdown files, because it was causing problems with CRAN checks.
- Disabled caching in R Markdown files, because it was causing problems with CRAN checks.

# wordpredictor 0.0.2

## Bug fixes

* Fixed small bugs that were causing problems with GitHub actions and CRAN checks.
* Removed custom `.Rprofile` file as it was causing problems with GitHub actions.
* Updated sample code in `features.Rmd` vignette so it does not cause issues with R CMD Check on MacOs.
* Removed `inst/extdata folder` from `.gitignore` since it was causing problems with check-standard workflow on GitHub.
* Removed non-standard characters from example in data-cleaner.R file as they were causing problems with CRAN check on "Debian Linux, R-devel, clang".
* Issues related to the bug fixes: [#318](https://github.com/r-lib/actions/issues/318), [#319](https://github.com/r-lib/actions/issues/319), [#320](https://github.com/r-lib/actions/issues/320)
- Fixed small bugs that were causing problems with GitHub actions and CRAN checks.
- Removed custom `.Rprofile` file as it was causing problems with GitHub actions.
- Updated sample code in `features.Rmd` vignette so it does not cause issues with R CMD Check on MacOs.
- Removed `inst/extdata folder` from `.gitignore` since it was causing problems with check-standard workflow on GitHub.
- Removed non-standard characters from example in data-cleaner.R file as they were causing problems with CRAN check on "Debian Linux, R-devel, clang".
- Issues related to the bug fixes: [#318](https://github.com/r-lib/actions/issues/318), [#319](https://github.com/r-lib/actions/issues/319), [#320](https://github.com/r-lib/actions/issues/320).

# wordpredictor 0.0.1

* Initial Release.
- Initial Release.
Loading

0 comments on commit f4eaa36

Please sign in to comment.