Skip to content

Commit

Permalink
Merge pull request #90 from inbo/keyword
Browse files Browse the repository at this point in the history
add spell checking support
  • Loading branch information
ThierryO authored Sep 14, 2022
2 parents 84cd511 + 87aec0f commit 226906a
Show file tree
Hide file tree
Showing 106 changed files with 2,899 additions and 749 deletions.
14 changes: 7 additions & 7 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
^_pkgdown.yml$
^.*\.Rproj$
^.*\.zenodo.json$
^.dockerignore$
^CITATION\.cff$
^Dockerfile$
^LICENSE.md$
^README\.Rmd$
^\.Rproj\.user$
^\.github$
^\.httr-oauth$
^\.Rproj\.user$
^\.zenodo\.json$
^_pkgdown.yml$
^checklist.yml$
^CITATION\.cff$
^codecov\.yml$
^codemeta\.json$
^data-raw$
^docker-compose.test.yml$
^docker$
^Dockerfile$
^docker-compose.test.yml$
^docs$
^LICENSE.md$
^man-roxygen$
^pkgdown$
^README\.Rmd$
^test_docker.sh$
7 changes: 5 additions & 2 deletions .zenodo.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "checklist: A Thorough and Strict Set of Checks for R Packages and Source Code",
"version": "0.2.4",
"version": "0.2.5",
"description": "An opinionated set of rules for R packages and R source code projects.",
"creators": [
{
Expand Down Expand Up @@ -38,5 +38,8 @@
}
],
"language": "eng",
"keywords": "R package"
"keywords": [
"R package",
"quality control"
]
}
6 changes: 4 additions & 2 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ contact:
- email: info@inbo.be
name: Research Institute for Nature and Forest
title: 'checklist: A Thorough and Strict Set of Checks for R Packages and Source Code'
version: 0.2.4
version: 0.2.5
abstract: An opinionated set of rules for R packages and R source code projects.
license: GPL-3.0
type: software
Expand All @@ -20,4 +20,6 @@ repository-code: https://github.com/inbo/checklist
identifiers:
- type: url
value: https://inbo.github.io/checklist/
keywords: R package
keywords:
- R package
- quality control
13 changes: 8 additions & 5 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: checklist
Title: A Thorough and Strict Set of Checks for R Packages and Source Code
Version: 0.2.4
Version: 0.2.5
Authors@R: c(
person("Thierry", "Onkelinx", , "thierry.onkelinx@inbo.be", role = c("aut", "cre"),
comment = c(ORCID = "0000-0001-8804-4216")),
Expand All @@ -20,17 +20,20 @@ BugReports: https://github.com/inbo/checklist/issues
Depends:
R (>= 3.5.0)
Imports:
R6,
assertthat,
codemetar,
desc,
devtools (> 2.4.0),
fs,
gert,
httr,
hunspell,
jsonlite,
lintr (>= 2.0.1.9000),
pkgdown,
R6,
rcmdcheck,
renv,
rmarkdown,
rorcid,
sessioninfo,
Expand All @@ -39,17 +42,17 @@ Imports:
yaml
Suggests:
covr,
curl,
knitr,
mockery,
roxygen2,
rstudioapi,
showtext,
sysfonts,
testthat
VignetteBuilder:
knitr
Remotes:
r-lib/lintr
Encoding: UTF-8
Language: en-GB
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.2
RoxygenNote: 7.2.1
12 changes: 10 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN apt-get update \
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("hunspell")'

## install lintr
RUN Rscript --no-save --no-restore -e 'remotes::install_github("r-lib/lintr")'
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("lintr")'

## install microbenchmark
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("microbenchmark")'
Expand Down Expand Up @@ -90,7 +90,14 @@ RUN Rscript --no-save --no-restore -e 'remotes::install_cran("rmarkdown")'
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("rorcid")'

## install spelling
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("spelling")'
RUN apt-get update \
&& apt-get install -y --no-install-recommends \
hunspell-de-de \
hunspell-en-gb \
hunspell-fr \
hunspell-nl \
&& apt-get clean \
&& Rscript --no-save --no-restore -e 'remotes::install_cran("hunspell")'

## install spelling
RUN Rscript --no-save --no-restore -e 'remotes::install_cran("withr")'
Expand All @@ -101,4 +108,5 @@ RUN Rscript --no-save --no-restore -e 'remotes::install_local("checklist", upgra

COPY docker/entrypoint_package.sh /entrypoint_package.sh
COPY docker/entrypoint_source.sh /entrypoint_source.sh
COPY docker/entrypoint_project.sh /entrypoint_project.sh
ENTRYPOINT ["/entrypoint_package.sh"]
37 changes: 37 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Generated by roxygen2: do not edit by hand

S3method(print,checklist_language)
S3method(print,checklist_spelling)
export(c_sort)
export(check_codemeta)
export(check_cran)
export(check_description)
Expand All @@ -9,11 +12,15 @@ export(check_filename)
export(check_license)
export(check_lintr)
export(check_package)
export(check_project)
export(check_source)
export(check_spelling)
export(checklist)
export(clean_git)
export(create_hexsticker)
export(create_package)
export(create_project)
export(custom_dictionary)
export(is_repository)
export(is_workdir_clean)
export(new_branch)
Expand All @@ -22,7 +29,9 @@ export(prepare_ghpages)
export(read_checklist)
export(set_tag)
export(setup_package)
export(setup_project)
export(setup_source)
export(spelling)
export(tidy_desc)
export(update_citation)
export(validate_email)
Expand All @@ -44,6 +53,24 @@ importFrom(desc,desc)
importFrom(desc,description)
importFrom(devtools,build_readme)
importFrom(devtools,document)
importFrom(fs,dir_create)
importFrom(fs,dir_exists)
importFrom(fs,dir_ls)
importFrom(fs,file_copy)
importFrom(fs,file_exists)
importFrom(fs,file_move)
importFrom(fs,is_dir)
importFrom(fs,is_file)
importFrom(fs,path)
importFrom(fs,path_common)
importFrom(fs,path_dir)
importFrom(fs,path_ext_remove)
importFrom(fs,path_filter)
importFrom(fs,path_has_parent)
importFrom(fs,path_norm)
importFrom(fs,path_real)
importFrom(fs,path_rel)
importFrom(fs,path_split)
importFrom(gert,git_add)
importFrom(gert,git_ahead_behind)
importFrom(gert,git_branch)
Expand Down Expand Up @@ -76,15 +103,24 @@ importFrom(grDevices,svg)
importFrom(graphics,plot.new)
importFrom(graphics,text)
importFrom(httr,HEAD)
importFrom(hunspell,dictionary)
importFrom(hunspell,hunspell)
importFrom(hunspell,list_dictionaries)
importFrom(jsonlite,toJSON)
importFrom(lintr,lint_dir)
importFrom(lintr,lint_package)
importFrom(pkgdown,build_site)
importFrom(rcmdcheck,rcmdcheck)
importFrom(renv,dependencies)
importFrom(rmarkdown,pandoc_exec)
importFrom(rorcid,as.orcid)
importFrom(sessioninfo,session_info)
importFrom(stats,aggregate)
importFrom(stats,na.omit)
importFrom(stats,setNames)
importFrom(tools,RdTextFilter)
importFrom(tools,loadPkgRdMacros)
importFrom(tools,loadRdMacros)
importFrom(tools,toTitleCase)
importFrom(utils,browseURL)
importFrom(utils,file_test)
Expand All @@ -93,6 +129,7 @@ importFrom(utils,installed.packages)
importFrom(utils,menu)
importFrom(utils,person)
importFrom(utils,tail)
importFrom(utils,unzip)
importFrom(withr,with_path)
importFrom(yaml,read_yaml)
importFrom(yaml,write_yaml)
25 changes: 18 additions & 7 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# checklist 0.2.5

* Add spell checking functionality.
See `vignette("spelling", package = "checklist")` for more details.
* The `checklist` class stores the required checks.
* Add `setup_project()` to set-up `checklist` on an existing project.
This function allows the user to choose which checks to be required.
* Add `check_project()` to run the required checks of a project.
* Fix bug in `.zenodo.json` when only one keyword is present.

# checklist 0.2.4

* `check_description()` enforces a `Language` field with a valid
Expand Down Expand Up @@ -68,7 +78,7 @@
See `usethis::use_description()` on how to set the option.
* Add R universe badges to README.
* Add `write_zenodo_json()` and `write_citation_cff()`.
* Improve the checklist Github Actions.
* Improve the checklist GitHub Actions.

## Bugfix

Expand Down Expand Up @@ -100,7 +110,7 @@

* `check_filename()` handles git repositories without commits.
* `check_filename()` ignores Rd files.
They have use a different naming convention when generated by Roxygen2.
They have use a different naming convention when generated by roxygen2.
* `clean_git()` yields cleaner warnings.
* `create_hexsticker()` will create the target directory when it doesn't exist.

Expand Down Expand Up @@ -135,14 +145,15 @@
* Remove remote branches when removed from the origin.
* Remove local branches when fully merged into the main branch.
* Warn for diverging branches.
* `create_hexsticker()` yields an svg file instead of png.
The user can optionally specify an svg icon file to add to the hexsticker.
* `create_hexsticker()` yields an `svg` file instead of `png`.
The user can optionally specify an `svg` icon file to add to the hexagonal
sticker.
* Keep failed build artefacts only 14 days (https://github.com/inbo/tutorials/issues/251).

## Bugfixes

* Avoid false positive linters when `.Rproj` file is put under version control.
* `check_files()` considers files with svg extensions as graphical files.
* `check_files()` considers files with `svg` extensions as graphical files.
* Minor bugfix in `entrypoint_package.sh`.

# checklist 0.1.9
Expand Down Expand Up @@ -175,7 +186,7 @@
* Allow a `data-raw` folder
* Allow more default GitHub file names
* Ignore font files
* csl files must follow the rules for graphics files
* `csl` files must follow the rules for graphics files
* `create_package()` adds
* URL and BugReports to `DESCRIPTION`
* GitHub Actions
Expand Down Expand Up @@ -211,7 +222,7 @@
This allows lines to be longer than 80 characters due to long URLs.
* `check_filename()` is more liberal.
* Allows files ending on `-package.Rd`.
* Allows json or yml files starting with a dot and followed by letters.
* Allows `json` or `yml` files starting with a dot and followed by letters.
* Allows filename `cran-comment.md` and `WORDLIST`.
* Allows `man-roxygen` as folder name.
* Requires underscore (`_`) as separator for non-graphics files.
Expand Down
21 changes: 21 additions & 0 deletions R/c_sort.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#' Sort using the C locale
#'
#' Setting the locale before sorting ensures a stable sorting order
#' @inheritParams base::sort
#' @export
#' @family utils
c_sort <- function(x, ...) {
old_ctype <- Sys.getlocale(category = "LC_CTYPE")
old_collate <- Sys.getlocale(category = "LC_COLLATE")
old_time <- Sys.getlocale(category = "LC_TIME")
Sys.setlocale(category = "LC_CTYPE", locale = "C")
Sys.setlocale(category = "LC_COLLATE", locale = "C")
Sys.setlocale(category = "LC_TIME", locale = "C")
on.exit(Sys.setlocale(category = "LC_CTYPE", locale = old_ctype), add = TRUE)
on.exit(
Sys.setlocale(category = "LC_COLLATE", locale = old_collate),
add = TRUE
)
on.exit(Sys.setlocale(category = "LC_TIME", locale = old_time), add = TRUE)
sort(x, ...)
}
8 changes: 5 additions & 3 deletions R/check_codemeta.R
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#'
#' Use the checks from [codemetar::give_opinions()].
#' @inheritParams read_checklist
#' @return A `Checklist` object.
#' @return A `checklist` object.
#' @importFrom assertthat assert_that
#' @importFrom codemetar give_opinions
#' @importFrom gert git_status
Expand All @@ -26,9 +26,11 @@ check_codemeta <- function(x = ".") {
"Code metadata needs to be updated. Run `codemetar::write_codemeta()`."[
!unchanged_repo(repo, status_before)
],
"codemeta"
item = "codemeta", keep = FALSE
)
x$add_notes(
sprintf("in %s fix %s", opinions$where, opinions$fixme), "codemeta"
)
x$add_notes(sprintf("in %s fix %s", opinions$where, opinions$fixme))

return(x)
}
2 changes: 1 addition & 1 deletion R/check_cran.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#' Notice that `check_package()` runs several additional tests.
#' @inheritParams read_checklist
#' @inheritParams rcmdcheck::rcmdcheck
#' @return A `Checklist` object.
#' @return A `checklist` object.
#' @importFrom assertthat assert_that
#' @importFrom gert git_ahead_behind git_branch_exists git_info
#' @importFrom httr HEAD
Expand Down
Loading

0 comments on commit 226906a

Please sign in to comment.