diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b5da7f1a3..07f8f6f6d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -4,18 +4,24 @@ default_stages: [commit] repos: - repo: https://github.com/lorenzwalthert/precommit - rev: v0.1.3.9014 + rev: v0.1.3.9123 hooks: - id: style-files args: [--style_pkg=styler, --style_fun=tidyverse_style] - exclude: 'tests/testthat/.*/.*\.R' + exclude: > + (?x)^( + tests/testthat/.*/.*\.R(md)?| + vignettes/customizing_styler\.Rmd| + tests/testthat/public-api/xyzfile-rnw/random4\.Rnw| + )$ - id: roxygenize - id: use-tidy-description - id: spell-check exclude: > (?x)^( - data/.*| \.github/.*\.yaml| + data/.*| + tests/testthat/.*| touchstone/config\.json| (.*/|)\.Rprofile| (.*/|)\.Renviron| @@ -38,13 +44,31 @@ repos: )$ - id: readme-rmd-rendered - id: parsable-R + exclude: > + (?x)^( + tests/testthat/public-api/xyzaddin/addin_region-.*| + tests/testmanual/addins/r-invalid\.R| + tests/testthat/escaping/basic-escape-out\.R| + tests/testthat/indention_operators/base_pipe_and_assignment-.*| + tests/testthat/exception_handling/parser-error.R| + )$ - id: no-browser-statement + exclude: > + (?x)^( + tests/testthat/public-api/xyzaddin/addin_region-.*| + tests/testmanual/addins/r-invalid\.R| + tests/testthat/escaping/basic-escape-out\.R| + tests/testthat/indention_operators/base_pipe_and_assignment-.*| + tests/testthat/exception_handling/parser-error.R| + )$ - id: deps-in-desc exclude: > (?x)^( touchstone/.*| - tests/testthat/.*-in\.R(md)?| - tests/testthat/.*-out\.R(md)? + tests/testmanual/addins/r-invalid\.R| + tests/testthat/escaping/basic-escape-out\.R| + tests/testthat/rnw/011-conditional-eval-out\.Rnw| + tests/testthat/.*\.R(md)? )$ - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.0.1 diff --git a/NEWS.md b/NEWS.md index b62846572..c739e37ef 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# styler 1.6.1.9000 (Development version) + +* Use pre-commit.ci and improve code quality (#841). + + # styler 1.6.1 * Files with `.Rmarkdown` extension are now recognized as an R markdown files in diff --git a/R/nest.R b/R/nest.R index aa3d11c90..9fa5d96da 100644 --- a/R/nest.R +++ b/R/nest.R @@ -135,7 +135,7 @@ drop_cached_children <- function(pd) { #' @details #' Note that top-level comments **above** code have negative parents #' (the negative value of the parent of the code expression that follows after, -#' a nother comment might be in the way though), all comments that are not top +#' another comment might be in the way though), all comments that are not top #' level have positive ids. All comments for which no code follows afterwards #' have parent 0. #' @examples diff --git a/R/utils-cache.R b/R/utils-cache.R index e9e377a79..a1991d4ea 100644 --- a/R/utils-cache.R +++ b/R/utils-cache.R @@ -201,7 +201,7 @@ cache_dir_default <- function() { #' Create more specs #' -#' Syntactic suggar for creating more specs. This is useful when we want to add +#' Syntactic sugar for creating more specs. This is useful when we want to add #' more arguments (because we can search for this function in the source code). #' @keywords internal cache_more_specs <- function(include_roxygen_examples, base_indention) { diff --git a/man/cache_more_specs.Rd b/man/cache_more_specs.Rd index 3cac92a92..05f78d2de 100644 --- a/man/cache_more_specs.Rd +++ b/man/cache_more_specs.Rd @@ -7,7 +7,7 @@ cache_more_specs(include_roxygen_examples, base_indention) } \description{ -Syntactic suggar for creating more specs. This is useful when we want to add +Syntactic sugar for creating more specs. This is useful when we want to add more arguments (because we can search for this function in the source code). } \keyword{internal} diff --git a/man/find_pos_id_to_keep.Rd b/man/find_pos_id_to_keep.Rd index b683b0d32..c49b4c0aa 100644 --- a/man/find_pos_id_to_keep.Rd +++ b/man/find_pos_id_to_keep.Rd @@ -22,7 +22,7 @@ typical roxygen annotated code. \details{ Note that top-level comments \strong{above} code have negative parents (the negative value of the parent of the code expression that follows after, -a nother comment might be in the way though), all comments that are not top +another comment might be in the way though), all comments that are not top level have positive ids. All comments for which no code follows afterwards have parent 0. } diff --git a/tests/testmanual/tests b/tests/testmanual/tests index e54f0373b..118801f24 100644 --- a/tests/testmanual/tests +++ b/tests/testmanual/tests @@ -3,7 +3,7 @@ ## Addins * set style: - - test setting a valid stlye + - test setting a valid style - test setting an invalid style * style active file: - saved .R file (valid and invalid code) @@ -23,4 +23,3 @@ - unsaved .Rnw file - saved non-R file - unsaved R file -