From a230432cc6b0ad9db31eb5c6488a197d60bcceda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Dec 2017 17:36:41 +0100 Subject: [PATCH 01/22] bump version to 0.1.0 --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index f072cd42b..a6b3ee642 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: styler Title: Non-invasive Pretty Printing of R code -Version: 0.0-11 +Version: 0.1.0 Authors@R: c(person("Kirill", "Müller", role = c("aut"), email = "krlmlr+r@mailbox.org"), person("Lorenz", "Walthert", role = c("cre", "aut"), email = "lorenz.walthert@icloud.com")) Description: From adb5e6a81d4b613e29c5988892d95346aa084fdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Dec 2017 17:41:18 +0100 Subject: [PATCH 02/22] prepare release --- .Rbuildignore | 1 + NEWS.md | 199 +++-------------------------------------------- cran-comments.md | 10 +++ 3 files changed, 23 insertions(+), 187 deletions(-) create mode 100644 cran-comments.md diff --git a/.Rbuildignore b/.Rbuildignore index f959ddca0..19624de80 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -13,3 +13,4 @@ CONTRIBUTING.md ^\.gitsum$ ^gitsum$ +^cran-comments\.md$ diff --git a/NEWS.md b/NEWS.md index bdc1f338d..75c2d0f4c 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,187 +1,12 @@ -## styler 0.0-11 (2017-12-05) - -- Remove `regex_none()`, document `NULL` default. -- `style_dir()` and `style_pkg()` now also handle `.Rmd` files (#292, @jonmcalder). -- Add test for styling `.Rmd` files. -- Better error message for styling new files via the RStudio addin (#295). -- Spelling via devtools::spell_check() (#294). -- Roundtrip and CLI (#289). - - -## styler 0.0-10 (2017-11-27) - -- Adapt documentation (#290). -- Add roundtrip (#287). -- Fix AppVeyor builds. -- Fix token insertion / comment interaction (#279). -- Clarify labelling strategy (#285). -- Fixing and extending Rstudioaddins (#283). -- Fix eq assign parsing (#276). -- style_files -> vectorized style_file (#273). -- Refactoring (#270). -- Fix CI (#275). -- Fix covr (#274). -- Renaming files (#271). -- Handle styling of an unsaved active file (#243). -- Test R 3.1 and R 3.2 (#249). -- Allow empty {} without line break (#261). -- Wrap expr in expr before enclosing with curly braces (#263). -- Avoid checking for hard-coded dot (#262). -- Account for dependency renaming (utf8 changed to enc) (#264). -- Indention of function declaration and closing braces (#260). -- Only remove line break before closing with strict option (#252). - - -## styler 0.0-9 (2017-10-23) - -- Hotfix: utf8 should not be verbose (#245). -- Allow styling of Rmd files(#233). -- Remove duplicate @family (#244). -- Fixing token insertion (#242). -- Capitalize Addin titles (#241). -- Explicit `NULL` creation to make styler compatible with R3.2.0 (#237). -- Improve vignettes (#232). -- Allow exclusion of files with `style_pkg()` and `style_dir()`. -- Correct styling with long strings (#230). -- Add tools for re-indenting tokens (#217). -- Math token spacing (#221). -- Remove outdated line and col information (#218). -- Empty input for styling does not cause an error (#227, #228). -- Tools to insert tokens + application on `if`-`else` clauses (#212). -- Improve example in documentation (#222). -- Fix spacing around in (#214). -- Maintenance: renaming functions / files, extend helper, documentation, if_else etc. (#204). -- Disallow line break after ( for function calls (#210). -- Preserve space between `!` and bang (#209). -- Simplify RStudio Addin (#208, #211). -- Indention based on square brackets (#207). -- Add vignette on introducing styler (#203). -- Indent function declaration without curly braces correctly (#202). -- Fix indention in if-else statement (#200). -- Sorting key (#196). -- Use safe sequences (#197). -- Fix space between two commas (#195). -- Keep single-line pipes on one line (#74). -- Remove tidyr and dplyr dependency (#182, #183, @jimhester). -- Fix parsing inconsistency (#188). -- Substitute create filler (#190). -- Introducing class vertical (#189). -- Adapt line break rules (#172). -- Fix `R CMD check` (#185). -- Force argument evaluation for proper error handling (#179). -- Add nonstrict version of set_space_before_comment (#174). -- Add installation instructions to README (#175). -- Addin to style highlighted region (#143). -- Improve spelling (#168). -- Add coverage badge -- Change badge from WIP to active -- Add the number of files to message (#166). -- Improve documentation (#164). -- Add informative messages while styling files (#165). -- More examples in help file (#161). -- No line breaks after pipe if comment is next token (#160). -- Fixing spacing around `!` (non-bang-bang) (#157). -- Finalize function documentation (#154). -- Review vignette (#158). -- Update bang-bang rule (#156). - - -## styler 0.0-8 (2017-08-24) - -- Vignette on customizing styler (#145). -- No line break after `switch()` and friends (#152). -- Remove flat relicts completely (#151). -- Don't reindent function calls and break line correctly for multi-line calls (#149). -- Set space between "=" and "," (#150). -- Make R CMD Check perfect (#148). -- Adding tests for exception handling with invalid parse data (#139). -- Fix indention by checking for all potential triggers (#142). -- Fix un-indention (#135). -- Support wide characters (#130). -- No spaces around :, :: and :::. -- Redesigning the API (#123). -- Solve eq_sub indention in general (#125). -- Minor refactorings. -- Re-indent token-dependent (#119). -- Supporting more indention patterns. -- Allow raw indention. -- Definitively fixing eol issue with comments. -- Infrastructure. -- Flattening out the parse table. -- New rule: no space after ! -> !!! for tidyeval. -- Fix spacing around '{'. -- Don't drop tokens! Fixes #101. -- EOL spaces in empty comments (and in general) (#98). -- mal-indention in conditional statement due to wrong specification of indent_without_paren) (#95). -- Complicated indentions based on arithmetic and special operators (#96). -- indention interaction on with assignment operator and other operators (#97). - - -## styler 0.0-7 (2017-07-27) - -- curly braces don't move a line up if previous token is comment. -- wrap parse + transform + serialize in new function. -- Speedup of nested styler functions by ~ 4x. -- Use multi line instead of line1 / line2 for indention and unindention. -- Indent multiple. -- add tidyverse rules (indention not yet working properly). -- Refactoring and add token before and afterwards to parse table. -- Implement post visitor instead of complicated move_up child. - - -## styler 0.0-6 (2017-07-10) - -* Tidy up README (#43). -* Fix indention of long operator chains (#69). -* Properly format unary operators (#38). -* Fixing indent multiple - one more time (#68). -* Remove spaces before comma (#62). -* Fixing indention with multiple parentheses (#57). -* data.tree gains unique node IDs for proper printing. -* Add `style_file()` function to style a single .R file. -* Add RStudio add-in to style active .R file. -* hotfix: make `style_pkg()` and `style_src()` work by passing flat argument. - - -## styler 0.0-5 (2017-06-30) - -* Correctly deal with comments (spacing before comments, start comment with space) -* T more flexibly (`test_collection()` and friends now support `...`) -* Indention based on curly brackets -* Spacing across different levels of nesting (e.g. a space after `)` in `function(x) {...}`) -* Write tree structure to file via test_collection()` for easy understanding of the nested structure -* Outsource tokenise -* Account for situations where code does not start on line1 -* Correctly style comments -* Add style_empty for tailored testing -* Initialize indent in create filler -* Adapt vignette and documentation to visitor concept -* Refine testing to use visiting approach -* Parse multiple expressions: Make nested approach wok on multiple expressions too. -* Internal: introducing the visitor concept instead of "looping" many times through whole nested structure. -* Integrate nested approach in top-level APIs `style_text` and friends via an additional argument. `flat`. -* Add tools for scalable testing. Transform *-in.R with a transformer function and check whether result corresponds to *-out.R - - -## styler 0.0-4 (2017-06-15) - -- Fix `README.Rmd` for compatibility with pkgdown. - - -## styler 0.0-3 (2017-06-15) - -- Technical release for creation of pkgdown documentation. - - -## styler 0.0-2 (2017-06-15) - -- Technical release for creation of pkgdown documentation. - - -## styler 0.0-1 (2017-06-15) - -Initial release, work in progress. - -- Create and serialize nested parse data. -- Internal support for indention of expressions with parentheses. -- Adding and removing spaces around operators on flat parse data. +## styler 0.1.0 (2017-12-05) + +create_style_guide(initialize = initialize_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) +specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'")) +specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE) +style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL) +style_file(path, ..., style = tidyverse_style, transformers = style(...)) +style_pkg(pkg = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", exclude_files = "R/RcppExports.R") +style_text(text, ..., style = tidyverse_style, transformers = style(...)) +tidyverse_math_token_spacing() +tidyverse_reindention() +tidyverse_style(scope = "tokens", strict = TRUE, indent_by = 2, start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing()) diff --git a/cran-comments.md b/cran-comments.md new file mode 100644 index 000000000..2b78e9ec3 --- /dev/null +++ b/cran-comments.md @@ -0,0 +1,10 @@ +## Test environments +* local OS X install, R 3.4.2 +* ubuntu 12.04 (on travis-ci), R 3.4.2 +* win-builder (devel and release) + +## R CMD check results + +0 errors | 0 warnings | 1 note + +* This is a new release. From 5315d020bbc6104ef3f91f96a93df94b712b3c02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Dec 2017 17:43:22 +0100 Subject: [PATCH 03/22] bump --- DESCRIPTION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index a6b3ee642..8f06d1c6e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: styler Title: Non-invasive Pretty Printing of R code -Version: 0.1.0 +Version: 1.0.0 Authors@R: c(person("Kirill", "Müller", role = c("aut"), email = "krlmlr+r@mailbox.org"), person("Lorenz", "Walthert", role = c("cre", "aut"), email = "lorenz.walthert@icloud.com")) Description: From 79f3f219b359331766a9917c5761a3c635fc302b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Dec 2017 17:53:20 +0100 Subject: [PATCH 04/22] R CMD check --- DESCRIPTION | 2 +- README.Rmd | 2 +- README.md | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 8f06d1c6e..f2e9a24a5 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: styler -Title: Non-invasive Pretty Printing of R code +Title: Non-Invasive Pretty Printing of R code Version: 1.0.0 Authors@R: c(person("Kirill", "Müller", role = c("aut"), email = "krlmlr+r@mailbox.org"), person("Lorenz", "Walthert", role = c("cre", "aut"), email = "lorenz.walthert@icloud.com")) diff --git a/README.Rmd b/README.Rmd index af421ccd4..5b975d7f0 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,7 +21,7 @@ knitr::opts_chunk$set( [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/r-lib/styler?branch=master&svg=true)](https://ci.appveyor.com/project/r-lib/styler) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/r-lib/styler/branch/master/graph/badge.svg)](https://codecov.io/gh/r-lib/styler) -[![cran version](http://www.r-pkg.org/badges/version/styler)](http://cran.rstudio.com/web/packages/styler) +[![cran version](http://www.r-pkg.org/badges/version/styler)](https://cran.r-project.org/package=styler) The goal of styler is to provide non-invasive pretty-printing of R source code diff --git a/README.md b/README.md index 245adbf5f..da0ad192d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ styler ====== -[![Build Status](https://travis-ci.org/r-lib/styler.svg?branch=master)](https://travis-ci.org/r-lib/styler) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/r-lib/styler?branch=master&svg=true)](https://ci.appveyor.com/project/r-lib/styler) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/r-lib/styler/branch/master/graph/badge.svg)](https://codecov.io/gh/r-lib/styler) [![cran version](http://www.r-pkg.org/badges/version/styler)](http://cran.rstudio.com/web/packages/styler) +[![Build Status](https://travis-ci.org/r-lib/styler.svg?branch=master)](https://travis-ci.org/r-lib/styler) [![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/github/r-lib/styler?branch=master&svg=true)](https://ci.appveyor.com/project/r-lib/styler) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](http://www.repostatus.org/badges/latest/active.svg)](http://www.repostatus.org/#active) [![codecov](https://codecov.io/gh/r-lib/styler/branch/master/graph/badge.svg)](https://codecov.io/gh/r-lib/styler) [![cran version](http://www.r-pkg.org/badges/version/styler)](https://cran.r-project.org/package=styler) The goal of styler is to provide non-invasive pretty-printing of R source code while adhering to the [tidyverse](https://github.com/tidyverse/style) formatting rules. Support for custom style guides is planned. From bd2756831461445f791c54d8a3459710657ddf47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kirill=20M=C3=BCller?= Date: Tue, 5 Dec 2017 17:53:26 +0100 Subject: [PATCH 05/22] use && instead of & --- R/set-assert-args.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/set-assert-args.R b/R/set-assert-args.R index 99960d162..e2338120f 100644 --- a/R/set-assert-args.R +++ b/R/set-assert-args.R @@ -8,7 +8,7 @@ set_arg_write_tree <- function(write_tree) { sufficient_version <- getRversion() >= 3.2 if (is.na(write_tree)) { write_tree <- ifelse(sufficient_version, TRUE, FALSE) - } else if (!sufficient_version & write_tree) { + } else if (!sufficient_version && write_tree) { stop_insufficient_r_version() } write_tree From 9e1ded361a93653f9a6c3ade659cf30936ee63f3 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Tue, 5 Dec 2017 18:23:25 +0100 Subject: [PATCH 06/22] skip on windows, not just on appveyor. --- tests/testthat/test-public_api.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-public_api.R b/tests/testthat/test-public_api.R index fe513add4..9c6c80805 100644 --- a/tests/testthat/test-public_api.R +++ b/tests/testthat/test-public_api.R @@ -67,7 +67,7 @@ test_that("styler handles malformed Rmd file and invalid R code in chunk", { context("messages are correct") test_that("messages (via cat()) of style_file are correct", { - skip_on_appveyor() + skip_on_os("windows") # Message if scope > line_breaks and code changes temp_path <- copy_to_tempdir(testthat_file( "public-api", "xyzdir-dirty", "dirty-sample-with-scope-tokens.R" From 2df0f285b85a547865de484ef4e81af0d7c263bc Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Tue, 5 Dec 2017 18:35:41 +0100 Subject: [PATCH 07/22] more documentation in NEWS.md --- NEWS.md | 78 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 70 insertions(+), 8 deletions(-) diff --git a/NEWS.md b/NEWS.md index 75c2d0f4c..14937ea87 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,12 +1,74 @@ ## styler 0.1.0 (2017-12-05) -create_style_guide(initialize = initialize_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) -specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'")) -specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE) -style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL) -style_file(path, ..., style = tidyverse_style, transformers = style(...)) -style_pkg(pkg = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", exclude_files = "R/RcppExports.R") +Initial release. + +### stylers +These are functions used to style code. They style a directory, a whole package, +a file or a string. +``` +style_dir(path = ".", + ..., style = tidyverse_style, transformers = style(...), + filetype = "R", recursive = TRUE, exclude_files = NULL +) + +style_pkg(pkg = ".", + ..., style = tidyverse_style, transformers = style(...), filetype = "R", + exclude_files = "R/RcppExports.R" +) + + +style_file(path, + ..., style = tidyverse_style, transformers = style(...) +) + style_text(text, ..., style = tidyverse_style, transformers = style(...)) -tidyverse_math_token_spacing() +``` + +### style guide creators +This function is used to create a style guide. +``` +create_style_guide( + initialize = initialize_attributes, + line_break = NULL, + space = NULL, + token = NULL, + indention = NULL, + use_raw_indention = FALSE, + reindention = tidyverse_reindention() +) +``` + +### style guides +These functions are the style guides implemented. +``` +tidyverse_style( + scope = "tokens", + strict = TRUE, + indent_by = 2, + start_comments_with_one_space = FALSE, + reindention = tidyverse_reindention(), + math_token_spacing = tidyverse_math_token_spacing() +) +``` + +### Helpers +These are helper functions used to specify the style guides in use. + +``` +specify_math_token_spacing( + zero = NULL, + one = c("'+'", "'-'", "'*'", "'/'", "'^'") +) + +specify_reindention( + regex_pattern = NULL, + indention = 0, + comments_only = TRUE +) +``` + +These are helper functions that simply forward to the helper functions above. +``` tidyverse_reindention() -tidyverse_style(scope = "tokens", strict = TRUE, indent_by = 2, start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing()) +tidyverse_math_token_spacing()) +``` From 88c1ca4dcaa93bbea98677cf8640992a91d15a5a Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Tue, 5 Dec 2017 18:42:44 +0100 Subject: [PATCH 08/22] remove documentation for unexported functions --- R/style_guides.R | 2 +- man/add_id_and_short.Rd | 14 ----- man/add_line_col_to_wrapped_expr.Rd | 14 ----- man/add_spaces_or_newlines.Rd | 21 ------- man/add_token_terminal.Rd | 28 ---------- man/apply_ref_indention.Rd | 17 ------ man/apply_ref_indention_one.Rd | 20 ------- man/apply_transformers.Rd | 32 ----------- man/assert_filetype.Rd | 14 ----- man/assert_text.Rd | 16 ------ man/assert_tokens.Rd | 14 ----- man/bind_with_child.Rd | 17 ------ man/calls_sys.Rd | 17 ------ man/can_verify_roundtrip.Rd | 17 ------ man/character_to_ordered.Rd | 20 ------- man/choose_indention.Rd | 31 ----------- man/combine_children.Rd | 22 -------- man/communicate_summary.Rd | 17 ------ man/communicate_warning.Rd | 19 ------- man/compute_indent_indices.Rd | 36 ------------ man/compute_parse_data_nested.Rd | 20 ------- man/construct_out.Rd | 19 ------- man/construct_tree.Rd | 16 ------ man/contains_else_expr_that_needs_braces.Rd | 17 ------ man/context_to_terminals.Rd | 33 ----------- man/context_towards_terminals.Rd | 34 ----------- man/copy_to_tempdir.Rd | 15 ----- man/create_node_from_nested.Rd | 20 ------- man/create_node_from_nested_root.Rd | 30 ---------- man/create_pos_ids.Rd | 32 ----------- man/create_tokens.Rd | 46 --------------- man/create_tree.Rd | 21 ------- man/enhance_mapping_special.Rd | 15 ----- man/enrich_terminals.Rd | 32 ----------- man/expressions_are_identical.Rd | 16 ------ man/extend_if_comment.Rd | 18 ------ man/extract_terminals.Rd | 15 ----- man/find_block_id.Rd | 17 ------ man/find_start_line.Rd | 17 ------ man/find_start_pos_id.Rd | 29 ---------- man/flatten_operators.Rd | 19 ------- man/flatten_operators_one.Rd | 16 ------ man/flatten_pd.Rd | 27 --------- man/generate_test_samples.Rd | 23 -------- man/get_knitr_pattern.Rd | 14 ----- man/get_parse_data.Rd | 19 ------- man/identify_chunks.Rd | 15 ----- man/initialize_attributes.Rd | 48 ---------------- man/lookup_new_special.Rd | 14 ----- man/lookup_tokens.Rd | 11 ---- man/make_transformer.Rd | 17 ------ man/map_filetype_to_pattern.Rd | 17 ------ man/needs_indention.Rd | 18 ------ man/needs_indention_one.Rd | 23 -------- man/nest_parse_data.Rd | 25 --------- man/next_non_comment.Rd | 16 ------ man/parse_transform_serialize.Rd | 16 ------ man/pd_is.Rd | 31 ----------- man/pd_is_multi_line.Rd | 20 ------- man/prettify_any.Rd | 26 --------- man/relocate_eq_assign.Rd | 43 -------------- man/relocate_eq_assign_nest.Rd | 32 ----------- man/relocate_eq_assign_one.Rd | 16 ------ man/rep_char.Rd | 19 ------- man/serialize_parse_data_flattened.Rd | 16 ------ man/set_and_assert_arg_filetype.Rd | 22 -------- man/set_arg_write_tree.Rd | 16 ------ man/set_line_break_if_call_is_multi_line.Rd | 40 ------------- man/set_multi_line.Rd | 15 ----- man/set_regex_indention.Rd | 30 ---------- man/set_space_between_eq_sub_and_comma.Rd | 14 ----- man/set_space_between_levels.Rd | 18 ------ man/set_spaces.Rd | 23 -------- man/set_unindention_child.Rd | 19 ------- man/start_comments_with_space.Rd | 20 ------- man/style_space_around_math_token.Rd | 23 -------- man/style_space_around_math_token_one.Rd | 22 -------- man/test_collection.Rd | 46 --------------- man/test_transformer.Rd | 32 ----------- man/testthat_file.Rd | 15 ----- man/tidyverse_style.Rd | 2 +- man/tokenize.Rd | 30 ---------- man/transform_and_check.Rd | 36 ------------ man/transform_code.Rd | 23 -------- man/transform_file.Rd | 33 ----------- man/transform_files.Rd | 25 --------- man/transform_rmd.Rd | 18 ------ man/try_transform_as_r_file.Rd | 20 ------- man/unindent_child.Rd | 18 ------ man/update_indention.Rd | 62 --------------------- man/update_indention_ref.Rd | 52 ----------------- man/update_newlines.Rd | 26 --------- man/validate_new_pos_ids.Rd | 24 -------- man/verify_roundtrip.Rd | 26 --------- man/verify_str_txt.Rd | 20 ------- man/visit.Rd | 28 ---------- man/visit_one.Rd | 20 ------- man/wrap_expr_in_curly.Rd | 18 ------ man/wrap_expr_in_expr.Rd | 15 ----- man/wrap_if_else_multi_line_in_curly.Rd | 18 ------ man/wrap_subexpr_in_curly.Rd | 20 ------- 101 files changed, 2 insertions(+), 2278 deletions(-) delete mode 100644 man/add_id_and_short.Rd delete mode 100644 man/add_line_col_to_wrapped_expr.Rd delete mode 100644 man/add_spaces_or_newlines.Rd delete mode 100644 man/add_token_terminal.Rd delete mode 100644 man/apply_ref_indention.Rd delete mode 100644 man/apply_ref_indention_one.Rd delete mode 100644 man/apply_transformers.Rd delete mode 100644 man/assert_filetype.Rd delete mode 100644 man/assert_text.Rd delete mode 100644 man/assert_tokens.Rd delete mode 100644 man/bind_with_child.Rd delete mode 100644 man/calls_sys.Rd delete mode 100644 man/can_verify_roundtrip.Rd delete mode 100644 man/character_to_ordered.Rd delete mode 100644 man/choose_indention.Rd delete mode 100644 man/combine_children.Rd delete mode 100644 man/communicate_summary.Rd delete mode 100644 man/communicate_warning.Rd delete mode 100644 man/compute_indent_indices.Rd delete mode 100644 man/compute_parse_data_nested.Rd delete mode 100644 man/construct_out.Rd delete mode 100644 man/construct_tree.Rd delete mode 100644 man/contains_else_expr_that_needs_braces.Rd delete mode 100644 man/context_to_terminals.Rd delete mode 100644 man/context_towards_terminals.Rd delete mode 100644 man/copy_to_tempdir.Rd delete mode 100644 man/create_node_from_nested.Rd delete mode 100644 man/create_node_from_nested_root.Rd delete mode 100644 man/create_pos_ids.Rd delete mode 100644 man/create_tokens.Rd delete mode 100644 man/create_tree.Rd delete mode 100644 man/enhance_mapping_special.Rd delete mode 100644 man/enrich_terminals.Rd delete mode 100644 man/expressions_are_identical.Rd delete mode 100644 man/extend_if_comment.Rd delete mode 100644 man/extract_terminals.Rd delete mode 100644 man/find_block_id.Rd delete mode 100644 man/find_start_line.Rd delete mode 100644 man/find_start_pos_id.Rd delete mode 100644 man/flatten_operators.Rd delete mode 100644 man/flatten_operators_one.Rd delete mode 100644 man/flatten_pd.Rd delete mode 100644 man/generate_test_samples.Rd delete mode 100644 man/get_knitr_pattern.Rd delete mode 100644 man/get_parse_data.Rd delete mode 100644 man/identify_chunks.Rd delete mode 100644 man/initialize_attributes.Rd delete mode 100644 man/lookup_new_special.Rd delete mode 100644 man/lookup_tokens.Rd delete mode 100644 man/make_transformer.Rd delete mode 100644 man/map_filetype_to_pattern.Rd delete mode 100644 man/needs_indention.Rd delete mode 100644 man/needs_indention_one.Rd delete mode 100644 man/nest_parse_data.Rd delete mode 100644 man/next_non_comment.Rd delete mode 100644 man/parse_transform_serialize.Rd delete mode 100644 man/pd_is.Rd delete mode 100644 man/pd_is_multi_line.Rd delete mode 100644 man/prettify_any.Rd delete mode 100644 man/relocate_eq_assign.Rd delete mode 100644 man/relocate_eq_assign_nest.Rd delete mode 100644 man/relocate_eq_assign_one.Rd delete mode 100644 man/rep_char.Rd delete mode 100644 man/serialize_parse_data_flattened.Rd delete mode 100644 man/set_and_assert_arg_filetype.Rd delete mode 100644 man/set_arg_write_tree.Rd delete mode 100644 man/set_line_break_if_call_is_multi_line.Rd delete mode 100644 man/set_multi_line.Rd delete mode 100644 man/set_regex_indention.Rd delete mode 100644 man/set_space_between_eq_sub_and_comma.Rd delete mode 100644 man/set_space_between_levels.Rd delete mode 100644 man/set_spaces.Rd delete mode 100644 man/set_unindention_child.Rd delete mode 100644 man/start_comments_with_space.Rd delete mode 100644 man/style_space_around_math_token.Rd delete mode 100644 man/style_space_around_math_token_one.Rd delete mode 100644 man/test_collection.Rd delete mode 100644 man/test_transformer.Rd delete mode 100644 man/testthat_file.Rd delete mode 100644 man/tokenize.Rd delete mode 100644 man/transform_and_check.Rd delete mode 100644 man/transform_code.Rd delete mode 100644 man/transform_file.Rd delete mode 100644 man/transform_files.Rd delete mode 100644 man/transform_rmd.Rd delete mode 100644 man/try_transform_as_r_file.Rd delete mode 100644 man/unindent_child.Rd delete mode 100644 man/update_indention.Rd delete mode 100644 man/update_indention_ref.Rd delete mode 100644 man/update_newlines.Rd delete mode 100644 man/validate_new_pos_ids.Rd delete mode 100644 man/verify_roundtrip.Rd delete mode 100644 man/verify_str_txt.Rd delete mode 100644 man/visit.Rd delete mode 100644 man/visit_one.Rd delete mode 100644 man/wrap_expr_in_curly.Rd delete mode 100644 man/wrap_expr_in_expr.Rd delete mode 100644 man/wrap_if_else_multi_line_in_curly.Rd delete mode 100644 man/wrap_subexpr_in_curly.Rd diff --git a/R/style_guides.R b/R/style_guides.R index 186a8ad35..4d4ad3458 100644 --- a/R/style_guides.R +++ b/R/style_guides.R @@ -24,7 +24,7 @@ NULL #' line breaks to one if there is none and leave the code untouched otherwise. #' See 'Examples'. #' @param start_comments_with_one_space Whether or not comments should start -#' with only one space (see [start_comments_with_space()]). +#' with only one space (see `start_comments_with_space()`). #' @inheritParams create_style_guide #' @param math_token_spacing A list of parameters that define spacing around #' math token, conveniently constructed using [specify_math_token_spacing()]. diff --git a/man/add_id_and_short.Rd b/man/add_id_and_short.Rd deleted file mode 100644 index 2d016fa71..000000000 --- a/man/add_id_and_short.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse.R -\name{add_id_and_short} -\alias{add_id_and_short} -\title{Add column \code{pos_id} and \code{short}} -\usage{ -add_id_and_short(pd) -} -\arguments{ -\item{pd}{A flat parse table} -} -\description{ -Adds column \code{pos_id} and \code{short} to a flat parse table. -} diff --git a/man/add_line_col_to_wrapped_expr.Rd b/man/add_line_col_to_wrapped_expr.Rd deleted file mode 100644 index 6a7c22303..000000000 --- a/man/add_line_col_to_wrapped_expr.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{add_line_col_to_wrapped_expr} -\alias{add_line_col_to_wrapped_expr} -\title{Adds line and col information to an expression from its child} -\usage{ -add_line_col_to_wrapped_expr(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Adds line and col information to an expression from its child -} diff --git a/man/add_spaces_or_newlines.Rd b/man/add_spaces_or_newlines.Rd deleted file mode 100644 index ed0dd6580..000000000 --- a/man/add_spaces_or_newlines.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{add_spaces_or_newlines} -\alias{add_spaces_or_newlines} -\alias{add_newlines} -\alias{add_spaces} -\title{Concentrate newlines or spaces in a string} -\usage{ -add_newlines(n) - -add_spaces(n) -} -\arguments{ -\item{n}{Scalar indicating how many characters should be concentrated} -} -\value{ -A string. -} -\description{ -Concentrate newlines or spaces in a string -} diff --git a/man/add_token_terminal.Rd b/man/add_token_terminal.Rd deleted file mode 100644 index f1c7cb940..000000000 --- a/man/add_token_terminal.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{add_token_terminal} -\alias{add_token_terminal} -\alias{add_terminal_token_after} -\alias{add_terminal_token_before} -\alias{remove_terminal_token_before_and_after} -\title{Add information about previous / next token to each terminal} -\usage{ -add_terminal_token_after(pd_flat) - -add_terminal_token_before(pd_flat) - -remove_terminal_token_before_and_after(pd_flat) -} -\arguments{ -\item{pd_flat}{A flat parse table.} -} -\description{ -Add information about previous / next token to each terminal -} -\section{Functions}{ -\itemize{ -\item \code{remove_terminal_token_before_and_after}: Removes column \code{terimnal_token_before}. Might -be used to prevent the use of invalidated information, e.g. if tokens were -added to the nested parse table. -}} - diff --git a/man/apply_ref_indention.Rd b/man/apply_ref_indention.Rd deleted file mode 100644 index 92f01c61c..000000000 --- a/man/apply_ref_indention.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reindent.R -\name{apply_ref_indention} -\alias{apply_ref_indention} -\title{Apply reference indention to tokens} -\usage{ -apply_ref_indention(flattened_pd) -} -\arguments{ -\item{flattened_pd}{A flattened parse table} -} -\description{ -Applies the reference indention created with functions -\code{\link[=update_indention_ref]{update_indention_ref()}} to the flattened parse table. The indention -is applied to all token that inherit from a reference token sequentially, -i.e. by looping over the target tokens. -} diff --git a/man/apply_ref_indention_one.Rd b/man/apply_ref_indention_one.Rd deleted file mode 100644 index a3d5d44e2..000000000 --- a/man/apply_ref_indention_one.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reindent.R -\name{apply_ref_indention_one} -\alias{apply_ref_indention_one} -\title{Applying reference indention of a target token} -\usage{ -apply_ref_indention_one(flattened_pd, target_token) -} -\arguments{ -\item{flattened_pd}{A flattened parse table} - -\item{target_token}{The index of the token from which the indention level -should be applied to other tokens.} -} -\description{ -Applies the indention level of \code{target_token} to all tokens that have -\code{target_token} as a reference. This includes adding spaces to the first -tokens on a line and updating the column \code{col1} and \code{col2} for all tokens -on that line so they are kept updated. -} diff --git a/man/apply_transformers.Rd b/man/apply_transformers.Rd deleted file mode 100644 index ac28e6d03..000000000 --- a/man/apply_transformers.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{apply_transformers} -\alias{apply_transformers} -\title{Apply transformers to a parse table} -\usage{ -apply_transformers(pd_nested, transformers) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{transformers}{A list of \emph{named} transformer functions} -} -\description{ -The column \code{multi_line} is updated (after the line break information is -modified) and the rest of the transformers are applied afterwards, -The former requires two pre visits and one post visit. -} -\details{ -The order of the transformations is: -\itemize{ -\item Initialization (must be first). -\item Line breaks (must be before spacing due to indention). -\item Update of newline and multi-line attributes (must not change afterwards, -hence line breaks must be modified first). -\item spacing rules (must be after line-breaks and updating newlines and -multi-line). -\item token manipulation / replacement (is last since adding and removing tokens -will invalidate columns token_after and token_before). -\item Update indention reference (must be after line breaks). -} -} diff --git a/man/assert_filetype.Rd b/man/assert_filetype.Rd deleted file mode 100644 index cd268843c..000000000 --- a/man/assert_filetype.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set-assert-args.R -\name{assert_filetype} -\alias{assert_filetype} -\title{Make sure all supplied file types are allowed} -\usage{ -assert_filetype(lowercase_filetype) -} -\arguments{ -\item{lowercase_filetype}{A vector with file types to check, all lower case.} -} -\description{ -Make sure all supplied file types are allowed -} diff --git a/man/assert_text.Rd b/man/assert_text.Rd deleted file mode 100644 index b88418adb..000000000 --- a/man/assert_text.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set-assert-args.R -\name{assert_text} -\alias{assert_text} -\title{Assert text to be of positive length and replace it with the empty -string otherwise.} -\usage{ -assert_text(text) -} -\arguments{ -\item{text}{The input to style.} -} -\description{ -Assert text to be of positive length and replace it with the empty -string otherwise. -} diff --git a/man/assert_tokens.Rd b/man/assert_tokens.Rd deleted file mode 100644 index 8fd83045a..000000000 --- a/man/assert_tokens.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set-assert-args.R -\name{assert_tokens} -\alias{assert_tokens} -\title{Check token validity} -\usage{ -assert_tokens(tokens) -} -\arguments{ -\item{tokens}{Tokens to check.} -} -\description{ -Check whether one or more tokens exist and have a unique token-text mapping -} diff --git a/man/bind_with_child.Rd b/man/bind_with_child.Rd deleted file mode 100644 index 517fcac32..000000000 --- a/man/bind_with_child.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{bind_with_child} -\alias{bind_with_child} -\title{Bind a parse table with one of its children} -\usage{ -bind_with_child(pd_nested, pos) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{pos}{The position of the child to bind.} -} -\description{ -Bind a parse table with one of its children and return parse table, ordered -according to the appearance of the tokens. -} diff --git a/man/calls_sys.Rd b/man/calls_sys.Rd deleted file mode 100644 index 1388398e8..000000000 --- a/man/calls_sys.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{calls_sys} -\alias{calls_sys} -\title{Invoke a system command} -\usage{ -calls_sys(sys_call, ...) -} -\arguments{ -\item{sys_call}{The call to be executed.} - -\item{...}{Arguments passed to \code{\link[=shell]{shell()}} or \code{\link[=system]{system()}}.} -} -\description{ -Wraps a system command into \code{\link[=shell]{shell()}} or \code{\link[=system]{system()}}, depending on the -operating system. -} diff --git a/man/can_verify_roundtrip.Rd b/man/can_verify_roundtrip.Rd deleted file mode 100644 index 8a7bcfab6..000000000 --- a/man/can_verify_roundtrip.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{can_verify_roundtrip} -\alias{can_verify_roundtrip} -\title{Check whether a roundtrip verification can be carried out} -\usage{ -can_verify_roundtrip(transformers) -} -\arguments{ -\item{transformers}{The list of transformer functions used for styling. -Needed for reverse engineering the scope.} -} -\description{ -If scope was set to "line_breaks" or lower (compare \code{\link[=tidyverse_style]{tidyverse_style()}}), -we can compare the expression before and after styling and return an error if -it is not the same. -} diff --git a/man/character_to_ordered.Rd b/man/character_to_ordered.Rd deleted file mode 100644 index 64f954911..000000000 --- a/man/character_to_ordered.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/style_guides.R -\name{character_to_ordered} -\alias{character_to_ordered} -\title{Convert a character vector to an ordered factor} -\usage{ -character_to_ordered(x, levels, name = substitute(x)) -} -\arguments{ -\item{x}{A character vector.} - -\item{levels}{A vector with levels.} - -\item{name}{The name of the character vector to be displayed if the -construction of the factor fails.} -} -\description{ -Convert a vector to an ordered factor but stop if any of the values in -\code{x} does not match the predefined levels in \code{levels.} -} diff --git a/man/choose_indention.Rd b/man/choose_indention.Rd deleted file mode 100644 index 8d909c69d..000000000 --- a/man/choose_indention.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{choose_indention} -\alias{choose_indention} -\title{Choose the indention method for the tokens} -\usage{ -choose_indention(flattened_pd, use_raw_indention) -} -\arguments{ -\item{flattened_pd}{A nested parse table that was turned into a flat parse -table using \code{\link[=extract_terminals]{extract_terminals()}}.} - -\item{use_raw_indention}{Boolean indicating whether or not the raw indention -should be used.} -} -\description{ -Either use the raw indention, which is just the spaces computed between -the first token on a new line and the token before it, or use the indention -computed according to the transformer used, which is stored in the column -\code{indention}. -} -\details{ -All indention information will be combined with the space information for -the first token on a new line. -If \code{use_raw_indention} is set, information in the column \code{indention} will -be discarded anyways. If it is not set, the first token on a new line will -"inherit" the indention of the whole line. -The column \code{indention} will be removed since all information necessary is -contained in the spacing information of the first token on a new line and -the position of the tokens will not be changed anymore at this stage. -} diff --git a/man/combine_children.Rd b/man/combine_children.Rd deleted file mode 100644 index 89b961610..000000000 --- a/man/combine_children.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{combine_children} -\alias{combine_children} -\title{Combine child and internal child} -\usage{ -combine_children(child, internal_child) -} -\arguments{ -\item{child}{A parse table or \code{NULL}.} - -\item{internal_child}{A parse table or \code{NULL}.} -} -\description{ -Binds two parse tables together and arranges them so that the tokens are in -the correct order. -} -\details{ -Essentially, this is a wrapper around \code{\link[dplyr:bind_rows]{dplyr::bind_rows()}}, but -returns \code{NULL} if the result of \code{\link[dplyr:bind_rows]{dplyr::bind_rows()}} is a data frame with -zero rows. -} diff --git a/man/communicate_summary.Rd b/man/communicate_summary.Rd deleted file mode 100644 index 5df9d9c27..000000000 --- a/man/communicate_summary.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/communicate.R -\name{communicate_summary} -\alias{communicate_summary} -\title{Communicate the summary of styling} -\usage{ -communicate_summary(changed, ruler_width) -} -\arguments{ -\item{changed}{Boolean with indicating for each file whether or not it has -been changed.} - -\item{ruler_width}{Integer used to determine the width of the ruler.} -} -\description{ -Communicate the summary of styling -} diff --git a/man/communicate_warning.Rd b/man/communicate_warning.Rd deleted file mode 100644 index 2047db0d6..000000000 --- a/man/communicate_warning.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/communicate.R -\name{communicate_warning} -\alias{communicate_warning} -\title{Communicate a warning if necessary} -\usage{ -communicate_warning(changed, transformers) -} -\arguments{ -\item{changed}{Boolean with indicating for each file whether or not it has -been changed.} - -\item{transformers}{The list of transformer functions used for styling. -Needed for reverse engineering the scope.} -} -\description{ -If roundtrip verification was not possible, issue a warning to review the -changes carefully. -} diff --git a/man/compute_indent_indices.Rd b/man/compute_indent_indices.Rd deleted file mode 100644 index 566b5c769..000000000 --- a/man/compute_indent_indices.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{compute_indent_indices} -\alias{compute_indent_indices} -\title{Compute the indices that need indention} -\usage{ -compute_indent_indices(pd, token_opening, token_closing = NULL) -} -\arguments{ -\item{pd}{A parse table.} - -\item{token_opening}{A character vector with tokens that could induce -indention for subsequent tokens.} - -\item{token_closing}{A character vector with tokens that could terminate -indention for previous tokens. If \code{NULL} (the default), indention should -end with the last token in the parse table.} -} -\description{ -Based on \code{token}, find the rows in \code{pd} that need to be indented. -} -\details{ -Two cases are fundamentally different: -\itemize{ -\item Indention based on operators (e.g '+'), where all subsequent tokens should -be indented. -\item Indention based on braces (e.g. '('), where just the tokens between the -opening and the closing brace have to be indented. -} - -To cover the second case, we need \code{token_closing} because it cannot be taken -for granted that \code{token_closing} is always the last token in \code{pd}. For -example in if-else expressions, this is not the case and indenting -everything between '(' and the penultimate token would result in the wrong -formatting. -} diff --git a/man/compute_parse_data_nested.Rd b/man/compute_parse_data_nested.Rd deleted file mode 100644 index 2dbd9d328..000000000 --- a/man/compute_parse_data_nested.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{compute_parse_data_nested} -\alias{compute_parse_data_nested} -\title{Obtain a nested parse table from a character vector} -\usage{ -compute_parse_data_nested(text) -} -\arguments{ -\item{text}{A character vector to parse.} -} -\value{ -A nested parse table. See \code{\link[=tokenize]{tokenize()}} for details on the columns -of the parse table. -} -\description{ -Parses \code{text} to a flat parse table and subsequently changes its -representation into a nested parse table with -\code{\link[=nest_parse_data]{nest_parse_data()}}. -} diff --git a/man/construct_out.Rd b/man/construct_out.Rd deleted file mode 100644 index 569b88827..000000000 --- a/man/construct_out.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{construct_out} -\alias{construct_out} -\title{Construct *-out.R from a *-in.R} -\usage{ -construct_out(in_paths) -} -\arguments{ -\item{in_paths}{A character vector that denotes paths to *-in.R files.} -} -\description{ -Multiple *-in.R files can have the same *-out.R file since to create the -*-out.R file, everything after the first dash is replaced by *-out.R. -} -\examples{ -styler:::construct_out(c("path/to/file/first-in.R", - "path/to/file/first-extended-in.R")) -} diff --git a/man/construct_tree.Rd b/man/construct_tree.Rd deleted file mode 100644 index d700c4608..000000000 --- a/man/construct_tree.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{construct_tree} -\alias{construct_tree} -\title{Construct paths of a tree object given the paths of *-in.R files} -\usage{ -construct_tree(in_paths, suffix = "_tree") -} -\arguments{ -\item{in_paths}{Character vector of *-in.R files.} - -\item{suffix}{Suffix for the tree object.} -} -\description{ -Construct paths of a tree object given the paths of *-in.R files -} diff --git a/man/contains_else_expr_that_needs_braces.Rd b/man/contains_else_expr_that_needs_braces.Rd deleted file mode 100644 index ffa63a87b..000000000 --- a/man/contains_else_expr_that_needs_braces.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expr-is.R -\name{contains_else_expr_that_needs_braces} -\alias{contains_else_expr_that_needs_braces} -\title{Check whether an else expression needs braces} -\usage{ -contains_else_expr_that_needs_braces(pd) -} -\arguments{ -\item{pd}{A parse table} -} -\description{ -Checks whether an else expression in a nest needs braces. Note that for -if-else-if expressions, there is no need to add braces since the if in -else-if will be visited separately with the visitor. This applies to all -conditional statements with more than one alternative. -} diff --git a/man/context_to_terminals.Rd b/man/context_to_terminals.Rd deleted file mode 100644 index f13dea159..000000000 --- a/man/context_to_terminals.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{context_to_terminals} -\alias{context_to_terminals} -\title{Propagate context to terminals} -\usage{ -context_to_terminals(pd_nested, outer_lag_newlines, outer_indent, outer_spaces, - outer_indention_refs) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{outer_lag_newlines}{The lag_newlines to be propagated inwards.} - -\item{outer_indent}{The indention depth to be propagated inwards.} - -\item{outer_spaces}{The number of spaces to be propagated inwards.} - -\item{outer_indention_refs}{The reference pos id that should be propagated -inwards.} -} -\value{ -An updated parse table. -} -\description{ -Implements a very specific pre-visiting scheme, namely to propagate -indention, spaces and lag_newlines to inner token to terminals. This means -that information regarding indention, line breaks and spaces (which is -relative in \code{pd_nested}) will be converted into absolute. -} -\seealso{ -context_towards_terminals visitors -} diff --git a/man/context_towards_terminals.Rd b/man/context_towards_terminals.Rd deleted file mode 100644 index 97ea99760..000000000 --- a/man/context_towards_terminals.Rd +++ /dev/null @@ -1,34 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{context_towards_terminals} -\alias{context_towards_terminals} -\title{Update the a parse table given outer context} -\usage{ -context_towards_terminals(pd_nested, outer_lag_newlines, outer_indent, - outer_spaces, outer_indention_refs) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{outer_lag_newlines}{The lag_newlines to be propagated inwards.} - -\item{outer_indent}{The indention depth to be propagated inwards.} - -\item{outer_spaces}{The number of spaces to be propagated inwards.} - -\item{outer_indention_refs}{The reference pos id that should be propagated -inwards.} -} -\value{ -An updated parse table. -} -\description{ -\code{outer_lag_newlines} are added to the first token in \code{pd}, -\code{outer_indent} is added to all tokens in \code{pd}, \code{outer_spaces} is added to -the last token in \code{pd}. \code{\link[=context_to_terminals]{context_to_terminals()}} calls this function -repeatedly, which means the propagation of the parse information to the -terminal tokens. -} -\seealso{ -context_to_terminals -} diff --git a/man/copy_to_tempdir.Rd b/man/copy_to_tempdir.Rd deleted file mode 100644 index 8c16a724b..000000000 --- a/man/copy_to_tempdir.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{copy_to_tempdir} -\alias{copy_to_tempdir} -\title{Copy a file to a temporary directory} -\usage{ -copy_to_tempdir(path_perm = testthat_file()) -} -\arguments{ -\item{path_perm}{The path of the file to copy.} -} -\description{ -Takes the path to a file as input and returns the path where the temporary -file is stored. Don't forget to unlink once you are done. -} diff --git a/man/create_node_from_nested.Rd b/man/create_node_from_nested.Rd deleted file mode 100644 index e8dd47602..000000000 --- a/man/create_node_from_nested.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nested_to_tree.R -\name{create_node_from_nested} -\alias{create_node_from_nested} -\title{Create node from nested parse data} -\usage{ -create_node_from_nested(pd_nested, parent, structure_only) -} -\arguments{ -\item{pd_nested}{A nested tibble.} - -\item{parent}{The parent of the node to be created.} - -\item{structure_only}{Whether or not create a tree that represents the -structure of the expression without any information on the tokens. Useful -to check whether two structures are identical.} -} -\description{ -Create node from nested parse data -} diff --git a/man/create_node_from_nested_root.Rd b/man/create_node_from_nested_root.Rd deleted file mode 100644 index f33e21d95..000000000 --- a/man/create_node_from_nested_root.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nested_to_tree.R -\name{create_node_from_nested_root} -\alias{create_node_from_nested_root} -\title{Convert a nested tibble into a node tree} -\usage{ -create_node_from_nested_root(pd_nested, structure_only) -} -\arguments{ -\item{pd_nested}{A nested tibble.} - -\item{structure_only}{Whether or not create a tree that represents the -structure of the expression without any information on the tokens. Useful -to check whether two structures are identical.} -} -\value{ -An object of class "Node" and "R6". -} -\description{ -This function is convenient to display all nesting levels of a nested tibble -at once. -} -\examples{ -if (getRversion() >= 3.2) { -code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" -nested_pd <- styler:::compute_parse_data_nested(code) -initialized <- styler:::pre_visit(nested_pd, c(styler:::initialize_attributes)) -styler:::create_node_from_nested_root(initialized, structure_only = FALSE) -} -} diff --git a/man/create_pos_ids.Rd b/man/create_pos_ids.Rd deleted file mode 100644 index e3fb66ed7..000000000 --- a/man/create_pos_ids.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-create.R -\name{create_pos_ids} -\alias{create_pos_ids} -\title{Create valid pos_ids if possible} -\usage{ -create_pos_ids(pd, pos, by = 0.1, after = FALSE, n = 1) -} -\arguments{ -\item{pd}{A parse table.} - -\item{pos}{The position where the new id should be inserted.} - -\item{by}{By how much the reference \code{pos_id} should be increased / decreased -to create a new id.} - -\item{after}{Boolean indicating whether it should be inserted after or before -\code{pos}.} - -\item{n}{Number of ids to generate.} -} -\value{ -Returns a valid sequences of pos_ids or an error if it was not possible to -create one. The validation is done with \code{\link[=validate_new_pos_ids]{validate_new_pos_ids()}} -} -\description{ -Create valid pos_ids if possible -} -\seealso{ -Other token creators: \code{\link{create_tokens}}, - \code{\link{validate_new_pos_ids}} -} diff --git a/man/create_tokens.Rd b/man/create_tokens.Rd deleted file mode 100644 index f48b941e7..000000000 --- a/man/create_tokens.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-create.R -\name{create_tokens} -\alias{create_tokens} -\title{Create a terminal token} -\usage{ -create_tokens(tokens, texts, lag_newlines = 0, spaces = 0, pos_ids, - token_before = NA, token_after = NA, indention_ref_pos_ids = NA, - indents = 0, terminal = TRUE, child = NULL) -} -\arguments{ -\item{tokens}{Character vector with tokens to create.} - -\item{texts}{Character vector with texts of the token to create.} - -\item{lag_newlines}{Character vector with lag_newlines corresponding to the -tokens.} - -\item{spaces}{Character vector with spaces corresponding to the tokens.} - -\item{pos_ids}{Character vector with positional id corresponding to the -tokens.} - -\item{token_before}{Character vector corresponding to the columns -\code{token_before}.} - -\item{token_after}{Character vector corresponding to the columns -\code{token_after}.} - -\item{indention_ref_pos_ids}{Character vector with indention ref ids -corresponding to the tokens.} - -\item{indents}{Vector with indents corresponding to the tokens.} - -\item{terminal}{Boolean vector indicating whether a token is a terminal or -not.} - -\item{child}{The children of the tokens.} -} -\description{ -Creates a terminal token represented as (a row of) a parse table. -} -\seealso{ -Other token creators: \code{\link{create_pos_ids}}, - \code{\link{validate_new_pos_ids}} -} diff --git a/man/create_tree.Rd b/man/create_tree.Rd deleted file mode 100644 index 3f6b202fe..000000000 --- a/man/create_tree.Rd +++ /dev/null @@ -1,21 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nested_to_tree.R -\name{create_tree} -\alias{create_tree} -\title{Create a tree from text} -\usage{ -create_tree(text, structure_only = FALSE) -} -\arguments{ -\item{text}{A character vector.} - -\item{structure_only}{Whether or not create a tree that represents the -structure of the expression without any information on the tokens. Useful -to check whether two structures are identical.} -} -\value{ -A data frame. -} -\description{ -Create a tree representation from a text. -} diff --git a/man/enhance_mapping_special.Rd b/man/enhance_mapping_special.Rd deleted file mode 100644 index 0145ad08c..000000000 --- a/man/enhance_mapping_special.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{enhance_mapping_special} -\alias{enhance_mapping_special} -\title{Enhance the mapping of text to the token "SPECIAL"} -\usage{ -enhance_mapping_special(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Map text corresponding to the token "SPECIAL" to a (more) unique token -description. -} diff --git a/man/enrich_terminals.Rd b/man/enrich_terminals.Rd deleted file mode 100644 index a07519b3d..000000000 --- a/man/enrich_terminals.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{enrich_terminals} -\alias{enrich_terminals} -\title{Enrich flattened parse table} -\usage{ -enrich_terminals(flattened_pd, use_raw_indention = FALSE) -} -\arguments{ -\item{flattened_pd}{A nested parse table that was turned into a flat parse -table using \code{\link[=extract_terminals]{extract_terminals()}}.} - -\item{use_raw_indention}{Boolean indicating whether or not the raw indention -should be used.} -} -\description{ -Enriches a flattened parse table with terminals only. In particular, it is -possible to compute the exact position a token will have (line and column) -when it will be serialized. -} -\details{ -Since we have only terminal tokens now, the line on which a token -starts we also be the line on which it ends. We call \code{line1} the line on -which the token starts. \code{line1} has the same meaning as \code{line1} that can be -found in a flat parse table (see \code{\link[=tokenize]{tokenize()}}), just that the \code{line1} -created by \code{enrich_terminals()} is the updated version of the former -\code{line1}. The same applies for \code{col1} and \code{col2}. Note that this function -does remove the columns \code{indent} and \code{spaces.} All information of the former -is stored in \code{lag_spaces} now. The later was removed because it is redundant -after adding the column \code{lag_spaces}, which is more convenient to work with, -in particular when serializing the parse table. -} diff --git a/man/expressions_are_identical.Rd b/man/expressions_are_identical.Rd deleted file mode 100644 index 47137da7e..000000000 --- a/man/expressions_are_identical.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{expressions_are_identical} -\alias{expressions_are_identical} -\title{Check whether two expressions are identical} -\usage{ -expressions_are_identical(old_text, new_text) -} -\arguments{ -\item{old_text}{The initial expression in its character representation.} - -\item{new_text}{The styled expression in its character representation.} -} -\description{ -Check whether two expressions are identical -} diff --git a/man/extend_if_comment.Rd b/man/extend_if_comment.Rd deleted file mode 100644 index a022d453f..000000000 --- a/man/extend_if_comment.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{extend_if_comment} -\alias{extend_if_comment} -\title{Find the index of the last comment in the sequence of comments-only tokens -after the token that has position \code{pos} in \code{pd}.} -\usage{ -extend_if_comment(pd, pos) -} -\arguments{ -\item{pd}{A parse table.} - -\item{pos}{The position of the token to start the search from.} -} -\description{ -Find the index of the last comment in the sequence of comments-only tokens -after the token that has position \code{pos} in \code{pd}. -} diff --git a/man/extract_terminals.Rd b/man/extract_terminals.Rd deleted file mode 100644 index 2fc5d7e67..000000000 --- a/man/extract_terminals.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{extract_terminals} -\alias{extract_terminals} -\title{Extract terminal tokens} -\usage{ -extract_terminals(pd_nested) -} -\arguments{ -\item{pd_nested}{A nested parse table.} -} -\description{ -Turns a nested parse table into a flat parse table and extracts \emph{all} -attributes -} diff --git a/man/find_block_id.Rd b/man/find_block_id.Rd deleted file mode 100644 index 5f9ed141d..000000000 --- a/man/find_block_id.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{find_block_id} -\alias{find_block_id} -\title{Find the block to which a token belongs} -\usage{ -find_block_id(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Two assignment tokens \code{EQ_ASSIGN} belong to the same block if they are not -separated by more than one token. Token between \code{EQ_ASSIGN} tokens belong -to the \code{EQ_ASSIGN} token occurring before them, except the token right before -\code{EQ_ASSING} already belongs to the \code{EQ_ASSING} after it. -} diff --git a/man/find_start_line.Rd b/man/find_start_line.Rd deleted file mode 100644 index 4e4c9e36d..000000000 --- a/man/find_start_line.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{find_start_line} -\alias{find_start_line} -\title{Get the start right} -\usage{ -find_start_line(pd_nested) -} -\arguments{ -\item{pd_nested}{A nested parse table.} -} -\value{ -The line number on which the first token occurs. -} -\description{ -On what line does the first token occur? -} diff --git a/man/find_start_pos_id.Rd b/man/find_start_pos_id.Rd deleted file mode 100644 index 60fecb185..000000000 --- a/man/find_start_pos_id.Rd +++ /dev/null @@ -1,29 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-create.R -\name{find_start_pos_id} -\alias{find_start_pos_id} -\title{Find legit starting value for a new positional id} -\usage{ -find_start_pos_id(pd, pos, by, direction, after, candidates = NULL) -} -\arguments{ -\item{pd}{A parse table.} - -\item{pos}{The position where the new id should be inserted.} - -\item{by}{By how much the reference \code{pos_id} should be increased / decreased -to create a new id.} - -\item{direction}{Derived from \code{after}. \code{1} if \code{after = TRUE}, \code{-1} otherwise.} - -\item{after}{Boolean indicating whether it should be inserted after or before -\code{pos}.} - -\item{candidates}{The \code{pos_ids} of the candidates that origin from other -nests.} -} -\description{ -Looks at the current nest as well as into its children (if necessary) to make -sure the right id is returned. Otherwise, ordering of tokens might not be -preserved. -} diff --git a/man/flatten_operators.Rd b/man/flatten_operators.Rd deleted file mode 100644 index 3cec7a340..000000000 --- a/man/flatten_operators.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{flatten_operators} -\alias{flatten_operators} -\title{Flatten some token in the nested parse table based on operators} -\usage{ -flatten_operators(pd_nested) -} -\arguments{ -\item{pd_nested}{A nested parse table to partially flatten.} -} -\description{ -Certain tokens are not placed optimally in the nested parse data with -\code{\link[=compute_parse_data_nested]{compute_parse_data_nested()}}. For example, the token of arithmetic -operations 1 + 1 + 1 should all be on the same level of nesting since -the indention is the same for all but the first two terminals. Setting the -indention correctly is easier to achieve if they are put on the same level -of nesting. -} diff --git a/man/flatten_operators_one.Rd b/man/flatten_operators_one.Rd deleted file mode 100644 index 619f17372..000000000 --- a/man/flatten_operators_one.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{flatten_operators_one} -\alias{flatten_operators_one} -\title{Flatten one level of nesting with its child} -\usage{ -flatten_operators_one(pd_nested) -} -\arguments{ -\item{pd_nested}{A nested parse table.} -} -\description{ -Flattening is done in two ways. We can flatten a parse table by moving -the left hand token of an operator one level up. Or doing that with the -right hand token. -} diff --git a/man/flatten_pd.Rd b/man/flatten_pd.Rd deleted file mode 100644 index d045c26ca..000000000 --- a/man/flatten_pd.Rd +++ /dev/null @@ -1,27 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{flatten_pd} -\alias{flatten_pd} -\title{Flatten a parse table} -\usage{ -flatten_pd(pd_nested, token, child_token = token, left = TRUE) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{token}{A character vector with tokens of which at least one has to -occur in \code{pd_nested} in order to flatten it.} - -\item{child_token}{A character vector of tokens of which at least one has to -occur in the child in order to flatten the parse table.} - -\item{left}{Flag that indicates whether the parse table should be flattened -from left or from right.} -} -\description{ -Flattens a parse table if certain tokens occur in this table or its child, -either flattening from left or from right. If one of \code{token} is present in -\code{pd_nested} and one of \code{child_token} is present in one of the children next -to \code{token} in \code{pd_nested}, the nested parse table is flattened. Otherwise, it -is returned unmodified. -} diff --git a/man/generate_test_samples.Rd b/man/generate_test_samples.Rd deleted file mode 100644 index 049643e2d..000000000 --- a/man/generate_test_samples.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{generate_test_samples} -\alias{generate_test_samples} -\title{Generate a comprehensive collection test cases for comment / insertion -interaction -Test consist of if / if-else / if-else-if-else cases, paired with various -line-break and comment configurations. Used for internal testing.} -\usage{ -generate_test_samples() -} -\value{ -The function is called for its side effects, i.e. to write the -test cases to *-in.R files that can be tested with \code{\link[=test_collection]{test_collection()}}. Note -that a few of the test cases are invalid and need to be removed / commented -out manually. -} -\description{ -Generate a comprehensive collection test cases for comment / insertion -interaction -Test consist of if / if-else / if-else-if-else cases, paired with various -line-break and comment configurations. Used for internal testing. -} diff --git a/man/get_knitr_pattern.Rd b/man/get_knitr_pattern.Rd deleted file mode 100644 index 4f295bc02..000000000 --- a/man/get_knitr_pattern.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-code.R -\name{get_knitr_pattern} -\alias{get_knitr_pattern} -\title{Get chunk pattern} -\usage{ -get_knitr_pattern(lines) -} -\arguments{ -\item{lines}{a character vector of lines from an Rmd file} -} -\description{ -Determine a regex pattern for identifying R code chunks. -} diff --git a/man/get_parse_data.Rd b/man/get_parse_data.Rd deleted file mode 100644 index e6c4c567e..000000000 --- a/man/get_parse_data.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse.R -\name{get_parse_data} -\alias{get_parse_data} -\title{Obtain robust parse data} -\usage{ -get_parse_data(text, include_text = TRUE, ...) -} -\arguments{ -\item{text}{The text to parse.} - -\item{include_text}{Passed to \code{\link[utils:getParseData]{utils::getParseData()}} as \code{includeText}.} - -\item{...}{Other arguments passed to \code{\link[utils:getParseData]{utils::getParseData()}}.} -} -\description{ -Wrapper around \code{utils::getParseData(parse(text = text))} that returns a flat -parse table. -} diff --git a/man/identify_chunks.Rd b/man/identify_chunks.Rd deleted file mode 100644 index bfc5c9415..000000000 --- a/man/identify_chunks.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-code.R -\name{identify_chunks} -\alias{identify_chunks} -\title{Identify chunks within Rmd contents} -\usage{ -identify_chunks(lines) -} -\arguments{ -\item{lines}{a character vector of lines from an Rmd file} -} -\description{ -Identifies the code and text chunks within an Rmd file, and returns these -as a nested list. -} diff --git a/man/initialize_attributes.Rd b/man/initialize_attributes.Rd deleted file mode 100644 index 8f7201e10..000000000 --- a/man/initialize_attributes.Rd +++ /dev/null @@ -1,48 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/initialize.R -\name{initialize_attributes} -\alias{initialize_attributes} -\alias{initialize_newlines} -\alias{initialize_spaces} -\alias{initialize_multi_line} -\alias{initialize_indention_ref_pos_id} -\alias{initialize_indent} -\alias{validate_parse_data} -\title{Enrich parse table with space and line break information} -\usage{ -initialize_attributes(pd_flat) - -initialize_newlines(pd_flat) - -initialize_spaces(pd_flat) - -initialize_multi_line(pd_flat) - -initialize_indention_ref_pos_id(pd_flat) - -initialize_indent(pd_flat) - -validate_parse_data(pd_flat) -} -\arguments{ -\item{pd_flat}{A parse table.} -} -\description{ -This function computes difference (as column and line difference) between two -entries in the parse table and adds this information to the table. -} -\section{Functions}{ -\itemize{ -\item \code{initialize_newlines}: Initializes \code{newlines} and \code{lag_newlines}. - -\item \code{initialize_spaces}: Initializes \code{spaces}. - -\item \code{initialize_multi_line}: Initializes \code{multi_line}. - -\item \code{initialize_indention_ref_pos_id}: Initializes \code{indention_ref_ind}. - -\item \code{initialize_indent}: Initializes \code{indent}. - -\item \code{validate_parse_data}: validates the parse data. -}} - diff --git a/man/lookup_new_special.Rd b/man/lookup_new_special.Rd deleted file mode 100644 index 8af1dc2c2..000000000 --- a/man/lookup_new_special.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-define.R -\name{lookup_new_special} -\alias{lookup_new_special} -\title{lookup which new tokens were created from "SPECIAL"} -\usage{ -lookup_new_special(regex = NA) -} -\arguments{ -\item{regex}{A regular expression pattern to search for.} -} -\description{ -lookup which new tokens were created from "SPECIAL" -} diff --git a/man/lookup_tokens.Rd b/man/lookup_tokens.Rd deleted file mode 100644 index 44d1a98a3..000000000 --- a/man/lookup_tokens.Rd +++ /dev/null @@ -1,11 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-define.R -\name{lookup_tokens} -\alias{lookup_tokens} -\title{Lookup all tokens that have a unique token-text mapping} -\usage{ -lookup_tokens() -} -\description{ -Lookup all tokens that have a unique token-text mapping -} diff --git a/man/make_transformer.Rd b/man/make_transformer.Rd deleted file mode 100644 index d2ad466d3..000000000 --- a/man/make_transformer.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{make_transformer} -\alias{make_transformer} -\title{Closure to return a transformer function} -\usage{ -make_transformer(transformers) -} -\arguments{ -\item{transformers}{A list of transformer functions that operate on flat -parse tables.} -} -\description{ -This function takes a list of transformer functions as input and -returns a function that can be applied to character strings -that should be transformed. -} diff --git a/man/map_filetype_to_pattern.Rd b/man/map_filetype_to_pattern.Rd deleted file mode 100644 index c873e6db2..000000000 --- a/man/map_filetype_to_pattern.Rd +++ /dev/null @@ -1,17 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{map_filetype_to_pattern} -\alias{map_filetype_to_pattern} -\title{Map the file type to a corresponding regular expression} -\usage{ -map_filetype_to_pattern(filetype) -} -\arguments{ -\item{filetype}{The file type to map to a regex.} -} -\description{ -Map the file type to a corresponding regular expression -} -\examples{ -styler:::map_filetype_to_pattern(c(".rMd", "R")) -} diff --git a/man/needs_indention.Rd b/man/needs_indention.Rd deleted file mode 100644 index 2fe9afda7..000000000 --- a/man/needs_indention.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{needs_indention} -\alias{needs_indention} -\title{Check whether indention is needed} -\usage{ -needs_indention(pd, potential_triggers) -} -\arguments{ -\item{pd}{A parse table.} - -\item{potential_triggers}{A vector with indices of the potential trigger -tokens in \code{pd}.} -} -\description{ -Checks for each potential trigger token in \code{pd} whether it actually should -cause indention. -} diff --git a/man/needs_indention_one.Rd b/man/needs_indention_one.Rd deleted file mode 100644 index fe8d16c9a..000000000 --- a/man/needs_indention_one.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{needs_indention_one} -\alias{needs_indention_one} -\title{Check whether indention is needed} -\usage{ -needs_indention_one(pd, potential_trigger) -} -\arguments{ -\item{pd}{A parse table.} - -\item{potential_trigger}{the index of the token in the parse table -for which it should be checked whether it should trigger indention.} -} -\value{ -Returns \code{TRUE} if indention is needed, \code{FALSE} otherwise. - -\code{TRUE} if indention is needed, \code{FALSE} otherwise. -} -\description{ -Indention is needed if and only if there is no multi-line token between the -trigger and the first line break. -} diff --git a/man/nest_parse_data.Rd b/man/nest_parse_data.Rd deleted file mode 100644 index 9b72925df..000000000 --- a/man/nest_parse_data.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{nest_parse_data} -\alias{nest_parse_data} -\title{Nest a flat parse table} -\usage{ -nest_parse_data(pd_flat) -} -\arguments{ -\item{pd_flat}{A flat parse table including both terminals and non-terminals.} -} -\value{ -A nested parse table. -} -\description{ -\code{nest_parse_data} groups \code{pd_flat} into a parse table with tokens that are -a parent to other tokens (called internal) and such that are not (called -child). Then, the token in child are joined to their parents in internal -and all token information of the children is nested into a column "child". -This is done recursively until we are only left with a nested tibble that -contains one row: The nested parse table. -} -\seealso{ -\code{\link[=compute_parse_data_nested]{compute_parse_data_nested()}} -} diff --git a/man/next_non_comment.Rd b/man/next_non_comment.Rd deleted file mode 100644 index bfe7cea47..000000000 --- a/man/next_non_comment.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{next_non_comment} -\alias{next_non_comment} -\title{Find the index of the next non-comment in a parse table} -\usage{ -next_non_comment(pd, pos) -} -\arguments{ -\item{pd}{A parse table.} - -\item{pos}{The position of the token to start the search from.} -} -\description{ -Find the index of the next non-comment in a parse table -} diff --git a/man/parse_transform_serialize.Rd b/man/parse_transform_serialize.Rd deleted file mode 100644 index 0c5443e33..000000000 --- a/man/parse_transform_serialize.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{parse_transform_serialize} -\alias{parse_transform_serialize} -\title{Parse, transform and serialize text} -\usage{ -parse_transform_serialize(text, transformers) -} -\arguments{ -\item{text}{A character vector to parse.} - -\item{transformers}{A list of \emph{named} transformer functions} -} -\description{ -Wrapper function for the common three operations. -} diff --git a/man/pd_is.Rd b/man/pd_is.Rd deleted file mode 100644 index 195c1e799..000000000 --- a/man/pd_is.Rd +++ /dev/null @@ -1,31 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/expr-is.R -\name{pd_is} -\alias{pd_is} -\alias{is_curly_expr} -\alias{is_function_call} -\alias{is_function_dec} -\title{Check whether a parse table corresponds to a certain expression} -\usage{ -is_curly_expr(pd) - -is_function_call(pd) - -is_function_dec(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Check whether a parse table corresponds to a certain expression -} -\section{Functions}{ -\itemize{ -\item \code{is_curly_expr}: Checks whether \code{pd} contains an expression wrapped in -curly brackets. - -\item \code{is_function_call}: Checks whether \code{pd} is a function call. - -\item \code{is_function_dec}: Checks whether \code{pd} is a function declaration. -}} - diff --git a/man/pd_is_multi_line.Rd b/man/pd_is_multi_line.Rd deleted file mode 100644 index d220d4dc3..000000000 --- a/man/pd_is_multi_line.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{pd_is_multi_line} -\alias{pd_is_multi_line} -\title{Check whether a parse table is a multi-line token} -\usage{ -pd_is_multi_line(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -A token is a multi-line expression if and only if: -} -\details{ -\itemize{ -\item it contains a line break. -\item it has at least one child that is a multi-line expression itself. -} -} diff --git a/man/prettify_any.Rd b/man/prettify_any.Rd deleted file mode 100644 index 6eb96449b..000000000 --- a/man/prettify_any.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ui.R -\name{prettify_any} -\alias{prettify_any} -\title{Prettify R code in current working directory} -\usage{ -prettify_any(transformers, filetype, recursive, exclude_files) -} -\arguments{ -\item{transformers}{A set of transformer functions. This argument is most -conveniently constructed via the \code{style} argument and \code{...}. See -'Examples'.} - -\item{filetype}{Vector of file extensions indicating which filetypes should -be styled. Case is ignored, and the \code{.} is optional, e.g. \code{c(".R", ".Rmd")} -or \code{c("r", "rmd")}.} - -\item{recursive}{A logical value indicating whether or not files in subdirectories -should be styled as well.} - -\item{exclude_files}{Character vector with paths to files that should be -excluded from styling.} -} -\description{ -This is a helper function for style_dir. -} diff --git a/man/relocate_eq_assign.Rd b/man/relocate_eq_assign.Rd deleted file mode 100644 index ebc889f60..000000000 --- a/man/relocate_eq_assign.Rd +++ /dev/null @@ -1,43 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign} -\alias{relocate_eq_assign} -\title{Relocate the expressions containing the token \code{EQ_ASSIGN} within the nested -parse table} -\usage{ -relocate_eq_assign(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Although syntactically identical, \code{\link[utils:getParseData]{utils::getParseData()}} does not produce -the same hierarchy of the parse table (parent and id relationship) for \code{<-} -and \code{=} (See 'Examples'). -This is considered to be a bug and causes problems because the -nested parse table constructed with \code{\link[=compute_parse_data_nested]{compute_parse_data_nested()}} is not -consistent if \code{EQ_ASSIGN} occurs in the expression to style. In particular, -\code{EQ_ASSIGN} and the tokens to its left and right are located too high up in -the hierarchy of the nested parse data. Hence, this function wraps the -sub-expression into an expression, similar to \code{\link[=wrap_expr_in_curly]{wrap_expr_in_curly()}}. -Since \code{wrap_expr_in_curly()} is called from within a visitor -(and \code{relocate_eq_assign()} not), we need to -wrap the the implementation \code{\link[=relocate_eq_assign_nest]{relocate_eq_assign_nest()}} that operates on -\emph{nests} into a visitor call. -} -\examples{ -styler:::get_parse_data("a <- b <- 3") -styler:::get_parse_data("a = b = 3") -styler:::get_parse_data( - "x = 5 - if(x >= 5) - y = TRUE else - y = FALSE", -) -styler:::get_parse_data( - "x <- 5 - if(x >= 5) - y <- TRUE else - y <- FALSE", -) -} diff --git a/man/relocate_eq_assign_nest.Rd b/man/relocate_eq_assign_nest.Rd deleted file mode 100644 index 880c25490..000000000 --- a/man/relocate_eq_assign_nest.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign_nest} -\alias{relocate_eq_assign_nest} -\title{Relocate all assignment expressions that contain \code{EQ_ASSIGN} within a \emph{nest}} -\usage{ -relocate_eq_assign_nest(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Implements the relocation of an \code{EQ_ASSIGN} and associated tokens -within a \emph{nest} (nested parse table at one level of nesting). -Note that one assignment expression (such as "a = b = c") can include -multiple assignment operators, an assignment involves just one assignment -operator. -For the relocation of assignment expressions that contain \code{EQ_ASSIGN} within -a \emph{nest}, we need to first find the expressions that contain \code{=} and then -split the \emph{nest} into parse tables each containing one such assignment -expression and then relocate each of them separately. -We can't do all of them together because: -} -\details{ -\itemize{ -\item An assignment can contain more than just three tokens, e.g. (a <- b <- c). -\item Two assignments can be in the same nest although they don't belong to the -same assignment (if-else statement). -} - -Please refer to the section 'Examples' in \code{\link[=relocate_eq_assign]{relocate_eq_assign()}} for details. -} diff --git a/man/relocate_eq_assign_one.Rd b/man/relocate_eq_assign_one.Rd deleted file mode 100644 index 368ea07a5..000000000 --- a/man/relocate_eq_assign_one.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{relocate_eq_assign_one} -\alias{relocate_eq_assign_one} -\title{Relocate an assignment expression} -\usage{ -relocate_eq_assign_one(pd) -} -\arguments{ -\item{pd}{A parse table with one assignment expression to relocate.} -} -\description{ -Relocates an assignment expression within a parse table containing one -assignment expression. Note that one assignment can include multiple -assignment operators such as "a = b = c". -} diff --git a/man/rep_char.Rd b/man/rep_char.Rd deleted file mode 100644 index 211e24418..000000000 --- a/man/rep_char.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/utils.R -\name{rep_char} -\alias{rep_char} -\title{Repeat elements of a character vector \code{times} times and collapse it} -\usage{ -rep_char(char, times) -} -\arguments{ -\item{char}{A character vector.} - -\item{times}{an integer giving the number of repetitions.} -} -\value{ -A character vector. -} -\description{ -Repeat elements of a character vector \code{times} times and collapse it -} diff --git a/man/serialize_parse_data_flattened.Rd b/man/serialize_parse_data_flattened.Rd deleted file mode 100644 index 76be7f22a..000000000 --- a/man/serialize_parse_data_flattened.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialize.R -\name{serialize_parse_data_flattened} -\alias{serialize_parse_data_flattened} -\title{Serialize flattened parse data} -\usage{ -serialize_parse_data_flattened(flattened_pd, start_line = 1) -} -\arguments{ -\item{flattened_pd}{A flattened parse table.} - -\item{start_line}{The line number on which the code starts.} -} -\description{ -Collapses a flattened parse table into character vector representation. -} diff --git a/man/set_and_assert_arg_filetype.Rd b/man/set_and_assert_arg_filetype.Rd deleted file mode 100644 index 87a50c365..000000000 --- a/man/set_and_assert_arg_filetype.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set-assert-args.R -\name{set_and_assert_arg_filetype} -\alias{set_and_assert_arg_filetype} -\title{Set the file type argument} -\usage{ -set_and_assert_arg_filetype(filetype) -} -\arguments{ -\item{filetype}{A character vector with file types to convert to the internal -standard format.} -} -\description{ -Sets and asserts the file type argument to a standard format for further internal -processing. -} -\examples{ -styler:::set_and_assert_arg_filetype("rMd") -\dontrun{ -styler:::set_and_assert_arg_filetype("xyz") -} -} diff --git a/man/set_arg_write_tree.Rd b/man/set_arg_write_tree.Rd deleted file mode 100644 index 2a1f20947..000000000 --- a/man/set_arg_write_tree.Rd +++ /dev/null @@ -1,16 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/set-assert-args.R -\name{set_arg_write_tree} -\alias{set_arg_write_tree} -\title{Set the write_tree argument} -\usage{ -set_arg_write_tree(write_tree) -} -\arguments{ -\item{write_tree}{Whether or not to write tree.} -} -\description{ -Sets the argument \code{write_tree} in \code{\link[=test_collection]{test_collection()}} to be \code{TRUE} for R -versions higher or equal to 3.2, and \code{FALSE} otherwise since the second-level -dependency \code{DiagrammeR} from \code{data.table} is not available for R < 3.2. -} diff --git a/man/set_line_break_if_call_is_multi_line.Rd b/man/set_line_break_if_call_is_multi_line.Rd deleted file mode 100644 index 27d045dba..000000000 --- a/man/set_line_break_if_call_is_multi_line.Rd +++ /dev/null @@ -1,40 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-line_break.R -\name{set_line_break_if_call_is_multi_line} -\alias{set_line_break_if_call_is_multi_line} -\alias{set_line_break_after_opening_if_call_is_multi_line} -\alias{set_line_break_before_closing_call} -\alias{remove_line_break_in_empty_fun_call} -\title{Set line break for multi-line function calls} -\usage{ -set_line_break_after_opening_if_call_is_multi_line(pd, - except_token_after = NULL, except_text_before = NULL) - -set_line_break_before_closing_call(pd, except_token_before) - -remove_line_break_in_empty_fun_call(pd) -} -\arguments{ -\item{pd}{A parse table.} - -\item{except_token_after}{A character vector with tokens after "'('" that do -not cause a line break after "'('".} - -\item{except_text_before}{A character vector with text before "'('" that do -not cause a line break after "'('".} - -\item{except_token_before}{A character vector with text before "')'" that do -not cause a line break before "')'".} -} -\description{ -Set line break for multi-line function calls -} -\section{Functions}{ -\itemize{ -\item \code{set_line_break_after_opening_if_call_is_multi_line}: Sets line break after -opening parenthesis. - -\item \code{set_line_break_before_closing_call}: Sets line break before -closing parenthesis. -}} - diff --git a/man/set_multi_line.Rd b/man/set_multi_line.Rd deleted file mode 100644 index efe3546da..000000000 --- a/man/set_multi_line.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{set_multi_line} -\alias{set_multi_line} -\title{Set the multi-line column} -\usage{ -set_multi_line(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Sets the column \code{multi_line} in \code{pd} by checking row-wise whether any child -of a token is a multi-line token. -} diff --git a/man/set_regex_indention.Rd b/man/set_regex_indention.Rd deleted file mode 100644 index 0087a4339..000000000 --- a/man/set_regex_indention.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reindent.R -\name{set_regex_indention} -\alias{set_regex_indention} -\title{Set indention of tokens that match regex} -\usage{ -set_regex_indention(flattened_pd, pattern, target_indention = 0, - comments_only = TRUE) -} -\arguments{ -\item{flattened_pd}{A flattened parse table.} - -\item{pattern}{A character with regular expressions to match against the token -in \code{flattened_pd}.} - -\item{target_indention}{The desired level of indention of the tokens that -match \code{pattern}.} - -\item{comments_only}{Boolean indicating whether only comments should be -checked or all tokens.} -} -\value{ -A flattened parse table with indention set to \code{target_indention} for -the tokens that match \code{regex.} -} -\description{ -Force the level of indention of tokens whose text matches a regular -expression pattern to be a certain amount of spaces. The rule -is only active for the first tokens on a line. -} diff --git a/man/set_space_between_eq_sub_and_comma.Rd b/man/set_space_between_eq_sub_and_comma.Rd deleted file mode 100644 index 2d50f5178..000000000 --- a/man/set_space_between_eq_sub_and_comma.Rd +++ /dev/null @@ -1,14 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-spacing.R -\name{set_space_between_eq_sub_and_comma} -\alias{set_space_between_eq_sub_and_comma} -\title{Set space between EQ_SUB and "','"} -\usage{ -set_space_between_eq_sub_and_comma(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Set space between EQ_SUB and "','" -} diff --git a/man/set_space_between_levels.Rd b/man/set_space_between_levels.Rd deleted file mode 100644 index 2e018e234..000000000 --- a/man/set_space_between_levels.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-spacing.R -\name{set_space_between_levels} -\alias{set_space_between_levels} -\title{Set space between levels of nesting} -\usage{ -set_space_between_levels(pd_flat) -} -\arguments{ -\item{pd_flat}{A flat parse table.} -} -\description{ -With the nested approach, certain rules do not have an effect anymore because -of the nature of the nested structure. Setting spacing before curly -brackets in for / if / while statements and function declarations will be -such a case since a curly bracket is always at the first position in a -parse table, so spacing cannot be set after the previous token. -} diff --git a/man/set_spaces.Rd b/man/set_spaces.Rd deleted file mode 100644 index a3f0d744e..000000000 --- a/man/set_spaces.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/nest.R -\name{set_spaces} -\alias{set_spaces} -\title{Helper for setting spaces} -\usage{ -set_spaces(spaces_after_prefix, force_one) -} -\arguments{ -\item{spaces_after_prefix}{An integer vector with the number of spaces -after the prefix.} - -\item{force_one}{Whether spaces_after_prefix should be set to one in all -cases.} -} -\value{ -An integer vector of length spaces_after_prefix, which is either -one (if \code{force_one = TRUE}) or \code{space_after_prefix} with all values -below one set to one. -} -\description{ -Helper for setting spaces -} diff --git a/man/set_unindention_child.Rd b/man/set_unindention_child.Rd deleted file mode 100644 index 3a2587cc6..000000000 --- a/man/set_unindention_child.Rd +++ /dev/null @@ -1,19 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/unindent.R -\name{set_unindention_child} -\alias{set_unindention_child} -\title{Unindent a child if necessary} -\usage{ -set_unindention_child(pd, token = "')'", unindent_by) -} -\arguments{ -\item{pd}{A parse table.} - -\item{token}{The token the unindention should be based on.} - -\item{unindent_by}{By how many spaces one level of indention is reversed.} -} -\description{ -check whether any of the children of \code{pd} has \code{token} on the same line as -the closing \code{token} of pd. If so, unindent that token. -} diff --git a/man/start_comments_with_space.Rd b/man/start_comments_with_space.Rd deleted file mode 100644 index 7117d6ae4..000000000 --- a/man/start_comments_with_space.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-spacing.R -\name{start_comments_with_space} -\alias{start_comments_with_space} -\title{Start comments with a space} -\usage{ -start_comments_with_space(pd, force_one = FALSE) -} -\arguments{ -\item{pd}{A parse table.} - -\item{force_one}{Whether or not to force one space or allow multiple spaces -after the regex "^#+'*".} -} -\description{ -Forces comments to start with a space, that is, after the regular expression -"^#+'*", at least one space must follow if the comment is \emph{non-empty}, i.e -there is not just spaces within the comment. Multiple spaces may be legit -for indention in some situations. -} diff --git a/man/style_space_around_math_token.Rd b/man/style_space_around_math_token.Rd deleted file mode 100644 index 099872546..000000000 --- a/man/style_space_around_math_token.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-spacing.R -\name{style_space_around_math_token} -\alias{style_space_around_math_token} -\title{Style spacing around math tokens} -\usage{ -style_space_around_math_token(strict, zero, one, pd_flat) -} -\arguments{ -\item{strict}{Whether the rules should be applied strictly or not.} - -\item{zero}{Character vector of tokens that should be surrounded with zero -spaces.} - -\item{one}{Character vector with tokens that should be surrounded by at -least one space (depending on \code{strict = TRUE} in the styling functions -\code{\link[=style_text]{style_text()}} and friends). See 'Examples'.} - -\item{pd_flat}{A nest or a flat parse table.} -} -\description{ -Style spacing around math tokens -} diff --git a/man/style_space_around_math_token_one.Rd b/man/style_space_around_math_token_one.Rd deleted file mode 100644 index 3afb3dd57..000000000 --- a/man/style_space_around_math_token_one.Rd +++ /dev/null @@ -1,22 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-spacing.R -\name{style_space_around_math_token_one} -\alias{style_space_around_math_token_one} -\title{Set spacing of token to a certain level} -\usage{ -style_space_around_math_token_one(pd_flat, strict, tokens, level) -} -\arguments{ -\item{pd_flat}{A nest or a flat parse table.} - -\item{strict}{Whether the rules should be applied strictly or not.} - -\item{tokens}{Character vector with tokens that should be styled.} - -\item{level}{Scalar indicating the amount of spaces that should be inserted -around the \code{tokens}.} -} -\description{ -Set the spacing of all \code{tokens} in \code{pd_flat} to \code{level} if \code{strict = TRUE} or -to at least to \code{level} if \code{strict = FALSE}. -} diff --git a/man/test_collection.Rd b/man/test_collection.Rd deleted file mode 100644 index e0d597a55..000000000 --- a/man/test_collection.Rd +++ /dev/null @@ -1,46 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{test_collection} -\alias{test_collection} -\title{Run a collection of tests} -\usage{ -test_collection(test, sub_test = NULL, write_back = TRUE, write_tree = NA, - transformer, ...) -} -\arguments{ -\item{test}{The test to run. It corresponds to a folder name in -tests/testthat.} - -\item{sub_test}{A regex pattern to further reduce the amount of test files -to be tested in the test. \code{sub_test} must match the beginning of file -names in tests/testthat. \code{NULL} matches all files.} - -\item{write_back}{Whether the results of the transformation should be written -to the output file.} - -\item{write_tree}{Whether or not the tree structure of the test should be -computed and written to a file. Note that this needs R >= 3.2 -(see \code{\link[=set_arg_write_tree]{set_arg_write_tree()}}). If the argument is set to \code{NA}, the function -determines whether R >= 3.2 is in use and if so, trees will be written.} - -\item{transformer}{A function to apply to the content of \code{in_item}.} - -\item{...}{Parameters passed to transformer function.} -} -\description{ -Run transformations on all *-in.R files in a test directory and compare them -with their *-out.R counterpart. -} -\details{ -Each file name that matches \code{test} and \code{sub_test} and ends with -"-in.R" is considered as an input to test. Its counterpart, -the reference to compare it against is the *-out.R file. It is constructed -by taking the substring of the *-in.R file before the -first dash and adding -out.R. This allows for multiple in.R files to -share one out.R file. You could have one_line-out.R as the reference to -compare one_line-random-something-stuff-in.R and -one_line-random-but-not-so-much-in.R. - -This also implies that -out.R files cannot have more than one dash in -their name, i.e. just the one before out.R. -} diff --git a/man/test_transformer.Rd b/man/test_transformer.Rd deleted file mode 100644 index c80a7b0c7..000000000 --- a/man/test_transformer.Rd +++ /dev/null @@ -1,32 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{test_transformer} -\alias{test_transformer} -\alias{style_empty} -\alias{style_op} -\title{Transforming test input with a transformer function} -\usage{ -style_empty(text) - -style_op(text) -} -\arguments{ -\item{text}{A character vector to transform.} -} -\description{ -These functions can be used as inputs for \code{\link[=test_collection]{test_collection()}} and -\code{\link[=transform_and_check]{transform_and_check()}}. -} -\details{ -As inputs for \code{\link[=test_collection]{test_collection()}}, we can also use top-level functions such -as \code{\link[=style_text]{style_text()}}. -} -\section{Functions}{ -\itemize{ -\item \code{style_empty}: Nest and unnest \code{text} without applying any -transformations but remove EOL spaces and indention due to the way the -serialization is set up. - -\item \code{style_op}: Transformations for indention based on operators -}} - diff --git a/man/testthat_file.Rd b/man/testthat_file.Rd deleted file mode 100644 index 269aba8b7..000000000 --- a/man/testthat_file.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{testthat_file} -\alias{testthat_file} -\title{Create the path to a test that file} -\usage{ -testthat_file(...) -} -\arguments{ -\item{...}{Arguments passed to \code{\link[=file.path]{file.path()}} to construct the path after -".../tests/testthat/"} -} -\description{ -Create the path to a test that file -} diff --git a/man/tidyverse_style.Rd b/man/tidyverse_style.Rd index ba3a81667..d9812383f 100644 --- a/man/tidyverse_style.Rd +++ b/man/tidyverse_style.Rd @@ -26,7 +26,7 @@ See 'Examples'.} operators such as '('.} \item{start_comments_with_one_space}{Whether or not comments should start -with only one space (see \code{\link[=start_comments_with_space]{start_comments_with_space()}}).} +with only one space (see \code{start_comments_with_space()}).} \item{reindention}{A list of parameters for regex re-indention, most conveniently constructed using \code{\link[=specify_reindention]{specify_reindention()}}.} diff --git a/man/tokenize.Rd b/man/tokenize.Rd deleted file mode 100644 index 3b652fc42..000000000 --- a/man/tokenize.Rd +++ /dev/null @@ -1,30 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse.R -\name{tokenize} -\alias{tokenize} -\title{Obtain token table from text} -\usage{ -tokenize(text) -} -\arguments{ -\item{text}{A character vector.} -} -\value{ -A flat parse table -} -\description{ -\code{\link[utils:getParseData]{utils::getParseData()}} is used to obtain a flat parse table from \code{text}. -} -\details{ -Apart from the columns provided by \code{utils::getParseData()}, the following -columns are added: -\itemize{ -\item A column "short" with the first five characters of "text". -\itemize{ -\item A column "pos_id" for (positional id) which can be used for sorting -(because "id" cannot be used in general). Note that the nth value of this -column corresponds to n as long as no tokens are inserted. -\item A column "child" that contains the nested subtibbles. -} -} -} diff --git a/man/transform_and_check.Rd b/man/transform_and_check.Rd deleted file mode 100644 index c8cec599b..000000000 --- a/man/transform_and_check.Rd +++ /dev/null @@ -1,36 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/serialized_tests.R -\name{transform_and_check} -\alias{transform_and_check} -\title{Transform a file an check the result} -\usage{ -transform_and_check(in_item, out_item, in_name = in_item, - out_name = out_item, transformer, write_back, write_tree = NA, - out_tree = "_tree", ...) -} -\arguments{ -\item{in_item}{An path to an file to transform.} - -\item{out_item}{The path to a file that contains the expected result.} - -\item{in_name}{The label of the in_item, defaults to \code{in_item}.} - -\item{out_name}{The label of the out_item, defaults to \code{out_item}.} - -\item{transformer}{A function to apply to the content of \code{in_item}.} - -\item{write_back}{Whether the results of the transformation should be written -to the output file.} - -\item{write_tree}{Whether or not the tree structure of the test should be -computed and written to a file. Note that this needs R >= 3.2 -(see \code{\link[=set_arg_write_tree]{set_arg_write_tree()}}). If the argument is set to \code{NA}, the function -determines whether R >= 3.2 is in use and if so, trees will be written.} - -\item{out_tree}{Name of tree file if written out.} - -\item{...}{Parameters passed to transformer function.} -} -\description{ -Transform an file and check whether it is identical to a reference. -} diff --git a/man/transform_code.Rd b/man/transform_code.Rd deleted file mode 100644 index 7c922bfdf..000000000 --- a/man/transform_code.Rd +++ /dev/null @@ -1,23 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-code.R -\name{transform_code} -\alias{transform_code} -\title{Transform code from R or Rmd files} -\usage{ -transform_code(path, fun, verbose = FALSE, ...) -} -\arguments{ -\item{path}{A vector of file paths.} - -\item{fun}{A function that returns a character vector.} - -\item{verbose}{Should the function show a message with a list of changed -files?} - -\item{...}{Further arguments passed to \code{enc::transform_lines_enc()}.} -} -\description{ -A wrapper for \code{\link[enc:transform_lines_enc]{enc::transform_lines_enc()}} which initiates the styling of -either R or Rmd files by passing the relevant transformer function for each -case. -} diff --git a/man/transform_file.Rd b/man/transform_file.Rd deleted file mode 100644 index 973264c7d..000000000 --- a/man/transform_file.Rd +++ /dev/null @@ -1,33 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{transform_file} -\alias{transform_file} -\title{Transform a file and output a customized message} -\usage{ -transform_file(path, fun, verbose = FALSE, max_char_path, - message_before = "", message_after = " [DONE]", - message_after_if_changed = " *", ...) -} -\arguments{ -\item{path}{A vector of file paths.} - -\item{fun}{A function that returns a character vector.} - -\item{verbose}{Should the function show a message with a list of changed -files?} - -\item{max_char_path}{The number of characters of the longest path. Determines -the indention level of \code{message_after}.} - -\item{message_before}{The message to print before the path.} - -\item{message_after}{The message to print after the path.} - -\item{message_after_if_changed}{The message to print after \code{message_after} if -any file was transformed.} - -\item{...}{Further arguments passed to \code{enc::transform_lines_enc()}.} -} -\description{ -Wraps \code{enc::transform_lines_enc()} and outputs customized messages. -} diff --git a/man/transform_files.Rd b/man/transform_files.Rd deleted file mode 100644 index e77db72e9..000000000 --- a/man/transform_files.Rd +++ /dev/null @@ -1,25 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{transform_files} -\alias{transform_files} -\title{Transform files with transformer functions} -\usage{ -transform_files(files, transformers) -} -\arguments{ -\item{files}{A character vector with paths to the file that should be -transformed.} - -\item{transformers}{A list of transformer functions that operate on flat -parse tables.} -} -\description{ -\code{transform_files} applies transformations to file contents and writes back -the result. -} -\section{Value}{ - -Invisibly returns a data frame that indicates for each file considered for -styling whether or not it was actually changed. -} - diff --git a/man/transform_rmd.Rd b/man/transform_rmd.Rd deleted file mode 100644 index e931b01d3..000000000 --- a/man/transform_rmd.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-code.R -\name{transform_rmd} -\alias{transform_rmd} -\title{Transform Rmd contents} -\usage{ -transform_rmd(lines, transformer_fun) -} -\arguments{ -\item{lines}{A character vector of lines from an Rmd file} - -\item{transformer_fun}{A styler transformer function} -} -\description{ -Applies the supplied transformer function to code chunks identified within -an Rmd file and recombines the resulting (styled) code chunks with the text -chunks. -} diff --git a/man/try_transform_as_r_file.Rd b/man/try_transform_as_r_file.Rd deleted file mode 100644 index c04b2498b..000000000 --- a/man/try_transform_as_r_file.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/addins.R -\name{try_transform_as_r_file} -\alias{try_transform_as_r_file} -\title{Style a file as if it was an .R file} -\usage{ -try_transform_as_r_file(context, transformer) -} -\arguments{ -\item{context}{The context from \code{styler:::get_rstudio_context()}.} - -\item{transformer}{A transformer function most conveniently constructed with -\code{\link[=make_transformer]{make_transformer()}}.} -} -\description{ -If not successful, the file is most -likely not a .R file, so saving the file and try styling again will work if -the file is an .Rmd file. Otherwise, we can throw an error that the file must -be a .R or .Rmd file. -} diff --git a/man/unindent_child.Rd b/man/unindent_child.Rd deleted file mode 100644 index e1c53a041..000000000 --- a/man/unindent_child.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/unindent.R -\name{unindent_child} -\alias{unindent_child} -\title{Unindent a child} -\usage{ -unindent_child(pd, token = c("')'", "'}'"), unindent_by = 2) -} -\arguments{ -\item{pd}{A parse table.} - -\item{token}{The token the unindention should be based on.} - -\item{unindent_by}{By how many spaces one level of indention is reversed.} -} -\description{ -Unindent a child -} diff --git a/man/update_indention.Rd b/man/update_indention.Rd deleted file mode 100644 index da8ad2e91..000000000 --- a/man/update_indention.Rd +++ /dev/null @@ -1,62 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{update_indention} -\alias{update_indention} -\alias{indent_braces} -\alias{indent_op} -\alias{indent_eq_sub} -\alias{indent_assign} -\alias{indent_without_paren} -\alias{indent_without_paren_for_while_fun} -\alias{indent_without_paren_if_else} -\title{Update indention information of parse data} -\usage{ -indent_braces(pd, indent_by) - -indent_op(pd, indent_by, token = c(math_token, logical_token, special_token, - "LEFT_ASSIGN", "EQ_ASSIGN", "'$'")) - -indent_eq_sub(pd, indent_by, token = "EQ_SUB") - -indent_assign(pd, indent_by, token = NULL) - -indent_without_paren(pd, indent_by = 2) - -indent_without_paren_for_while_fun(pd, indent_by) - -indent_without_paren_if_else(pd, indent_by) -} -\arguments{ -\item{pd}{A nested or flat parse table that is already enhanced with -line break and space information via \code{\link[=initialize_attributes]{initialize_attributes()}}.} - -\item{indent_by}{How many spaces should be added after the token of interest.} - -\item{token}{The token the indention should be based on.} -} -\description{ -Update indention information of parse data -} -\section{Functions}{ -\itemize{ -\item \code{indent_braces}: Inserts indention based on round, square and -curly brackets. - -\item \code{indent_op}: Indents operators - -\item \code{indent_eq_sub}: Updates indention for token EQ_SUB. Only differs -from indent_op in the sense that the last token on the table where EQ_SUB -occurs is not indented (see\code{\link[=compute_indent_indices]{compute_indent_indices()}}) - -\item \code{indent_assign}: Same as indent_op, but only indents one token -after \code{token}, not all remaining. - -\item \code{indent_without_paren}: Is used to indent for / while / if / if-else -statements that do not have curly parenthesis. - -\item \code{indent_without_paren_for_while_fun}: Is used to indent for and statements and function -definitions without parenthesis. - -\item \code{indent_without_paren_if_else}: Is used to indent if and if-else statements. -}} - diff --git a/man/update_indention_ref.Rd b/man/update_indention_ref.Rd deleted file mode 100644 index 4878ccf40..000000000 --- a/man/update_indention_ref.Rd +++ /dev/null @@ -1,52 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/reindent.R -\name{update_indention_ref} -\alias{update_indention_ref} -\alias{update_indention_ref_fun_call} -\alias{update_indention_ref_fun_dec} -\title{Update the indention reference} -\usage{ -update_indention_ref_fun_call(pd_nested) - -update_indention_ref_fun_dec(pd_nested) -} -\arguments{ -\item{pd_nested}{A nested parse table.} -} -\description{ -Update the indention reference -} -\section{Functions}{ -\itemize{ -\item \code{update_indention_ref_fun_call}: Updates the reference pos_id for all -tokens in \code{pd_nested} if \code{pd_nested} contains a function call. Tokens that -start on the same line as the opening parenthesis, are not themselves -function calls or expressions wrapped in curly brackets are re-indented, -that is, they are indented up to the level at which the call ends in -terms of col2. We need to take the last from the first child because calls -like package::function() can have three elements. - -\item \code{update_indention_ref_fun_dec}: Updates the reference pos_id for all -tokens in \code{pd_nested} if \code{pd_nested} contains a function declaration. -Tokens inside a function declaration are are re-indented, -that is, they are indented up to the level at which the token FUNCTION -ends in terms of col2. -}} - -\examples{ -\dontrun{ -# not re-indented -call(call( - xyz -)) -# re-indented -call(call(1, - 2)) -} -\dontrun{ -a <- function(x, - y) { -x + y -} -} -} diff --git a/man/update_newlines.Rd b/man/update_newlines.Rd deleted file mode 100644 index c4c44e323..000000000 --- a/man/update_newlines.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/indent.R -\name{update_newlines} -\alias{update_newlines} -\title{Update the newlines attribute} -\usage{ -update_newlines(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\value{ -A parse table with synchronized \code{lag_newlines} and \code{newlines} columns. -} -\description{ -As we work only with the \code{lag_newlines} attribute for setting the line -breaks, (R/rules-line_break.R) but we need \code{newlines} to determine -whether or not to set \code{spaces} (R/rules-spacing.R), we have to update the -attribute. We cannot simply use \code{dplyr::lead(pd$lag_newlines)} since we would -lose information for the last token. \code{spaces} is left as is in -R/rules-spacing.R for tokens at the end of a line since this allows styling -without touching indention. -} -\seealso{ -choose_indention -} diff --git a/man/validate_new_pos_ids.Rd b/man/validate_new_pos_ids.Rd deleted file mode 100644 index e3c1e0f25..000000000 --- a/man/validate_new_pos_ids.Rd +++ /dev/null @@ -1,24 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-create.R -\name{validate_new_pos_ids} -\alias{validate_new_pos_ids} -\title{Validate sequence of new position ids} -\usage{ -validate_new_pos_ids(new_ids, after) -} -\arguments{ -\item{new_ids}{A vector with new ids} - -\item{after}{Whether the ids are created with \code{after = TRUE} (and hence -should be in the range x.0-x.45) or not.} -} -\description{ -Ids created with \code{after = TRUE} can have \code{pos_id} values between x.0 and -x.5 and ids created with \code{after = FALSE} can have \code{pos_id} values between -1+ x.0 and 1 + x.5 where x is the \code{pos_id} integer which was used as a -reference to create the new \code{pos_ids}. -} -\seealso{ -Other token creators: \code{\link{create_pos_ids}}, - \code{\link{create_tokens}} -} diff --git a/man/verify_roundtrip.Rd b/man/verify_roundtrip.Rd deleted file mode 100644 index d5f22647a..000000000 --- a/man/verify_roundtrip.Rd +++ /dev/null @@ -1,26 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/transform-files.R -\name{verify_roundtrip} -\alias{verify_roundtrip} -\title{Verify the styling} -\usage{ -verify_roundtrip(old_text, new_text) -} -\arguments{ -\item{old_text}{The initial expression in its character representation.} - -\item{new_text}{The styled expression in its character representation.} -} -\description{ -If scope was set to "line_breaks" or lower (compare \code{\link[=tidyverse_style]{tidyverse_style()}}), -we can compare the expression before and after styling and return an error if -it is not the same. Note that this method ignores comments and no -verification can be conducted if scope > "line_breaks". -} -\examples{ -styler:::verify_roundtrip("a+1", "a + 1") -styler:::verify_roundtrip("a+1", "a + 1 # comments are dropped") -\dontrun{ -styler:::verify_roundtrip("a+1", "b - 3") -} -} diff --git a/man/verify_str_txt.Rd b/man/verify_str_txt.Rd deleted file mode 100644 index cc30511fe..000000000 --- a/man/verify_str_txt.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/parse.R -\name{verify_str_txt} -\alias{verify_str_txt} -\title{Verify the text of strings} -\usage{ -verify_str_txt(pd_with_terminal_text, text) -} -\arguments{ -\item{pd_with_terminal_text}{A parse table.} - -\item{text}{The text from which \code{pd_with_terminal_text} was created. Needed -for potential reparsing.} -} -\description{ -Make sure \code{text} of the tokens \code{STR_CONST} is correct and adapt if necessary. -We first parse \code{text} again and include also non-terminal text. Then, we -replace offending \code{text} in the terminal expressions with the text of their -parents. -} diff --git a/man/visit.Rd b/man/visit.Rd deleted file mode 100644 index 2e2df1107..000000000 --- a/man/visit.Rd +++ /dev/null @@ -1,28 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{visit} -\alias{visit} -\alias{pre_visit} -\alias{post_visit} -\title{Visit'em all} -\usage{ -pre_visit(pd_nested, funs) - -post_visit(pd_nested, funs) -} -\arguments{ -\item{pd_nested}{A nested parse table.} - -\item{funs}{A list of transformer functions.} -} -\description{ -Apply a list of functions to each level in a nested parse table. -\code{pre_visit()} applies \code{funs} before it proceeds to the children, -(that is, starts from the outermost level of nesting progressing -to the innermost level), \code{post_visit()} proceeds to its children -before applying the functions (meaning it first applies the functions -to the innermost level of nesting first and then going outwards). -} -\seealso{ -Other visitors: \code{\link{visit_one}} -} diff --git a/man/visit_one.Rd b/man/visit_one.Rd deleted file mode 100644 index 138ac9da8..000000000 --- a/man/visit_one.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/visit.R -\name{visit_one} -\alias{visit_one} -\title{Transform a flat parse table with a list of transformers} -\usage{ -visit_one(pd_flat, funs) -} -\arguments{ -\item{pd_flat}{A flat parse table.} - -\item{funs}{A list of transformer functions.} -} -\description{ -Uses \code{\link[purrr:reduce]{purrr::reduce()}} to apply each function of \code{funs} sequentially to -\code{pd_flat}. -} -\seealso{ -Other visitors: \code{\link{visit}} -} diff --git a/man/wrap_expr_in_curly.Rd b/man/wrap_expr_in_curly.Rd deleted file mode 100644 index f572bdf48..000000000 --- a/man/wrap_expr_in_curly.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/token-create.R -\name{wrap_expr_in_curly} -\alias{wrap_expr_in_curly} -\title{Wrap an expression in curly braces} -\usage{ -wrap_expr_in_curly(pd, stretch_out = c(FALSE, FALSE)) -} -\arguments{ -\item{pd}{A parse table.} - -\item{stretch_out}{Whether or not to create a line break after the opening -curly brace and before the closing curly brace.} -} -\description{ -Adds curly braces to an expression (represented as a parse table) if there -are none. -} diff --git a/man/wrap_expr_in_expr.Rd b/man/wrap_expr_in_expr.Rd deleted file mode 100644 index 011aee57b..000000000 --- a/man/wrap_expr_in_expr.Rd +++ /dev/null @@ -1,15 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/relevel.R -\name{wrap_expr_in_expr} -\alias{wrap_expr_in_expr} -\title{Wrap an expression into an expression} -\usage{ -wrap_expr_in_expr(pd) -} -\arguments{ -\item{pd}{A parse table.} -} -\description{ -Takes a parse table and wraps it in a new parse table that contains the -expression as a child. -} diff --git a/man/wrap_if_else_multi_line_in_curly.Rd b/man/wrap_if_else_multi_line_in_curly.Rd deleted file mode 100644 index 61382196b..000000000 --- a/man/wrap_if_else_multi_line_in_curly.Rd +++ /dev/null @@ -1,18 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-other.R -\name{wrap_if_else_multi_line_in_curly} -\alias{wrap_if_else_multi_line_in_curly} -\title{Wrap if-else statement in curly braces} -\usage{ -wrap_if_else_multi_line_in_curly(pd, indent_by = 2) -} -\arguments{ -\item{pd}{A parse table.} - -\item{indent_by}{The amount of spaces used to indent an expression in curly -braces. Used for unindention.} -} -\description{ -Wrap an if-else statement in curly braces if it is not already wrapped in -a such. -} diff --git a/man/wrap_subexpr_in_curly.Rd b/man/wrap_subexpr_in_curly.Rd deleted file mode 100644 index aa575963b..000000000 --- a/man/wrap_subexpr_in_curly.Rd +++ /dev/null @@ -1,20 +0,0 @@ -% Generated by roxygen2: do not edit by hand -% Please edit documentation in R/rules-other.R -\name{wrap_subexpr_in_curly} -\alias{wrap_subexpr_in_curly} -\title{Wrap a sub-expression in curly braces} -\usage{ -wrap_subexpr_in_curly(pd, ind_to_be_wrapped, indent_by) -} -\arguments{ -\item{pd}{A parse table.} - -\item{ind_to_be_wrapped}{The indices of the rows that should be wrapped -into a new expression.} - -\item{indent_by}{The amount of spaces used to indent an expression in curly -braces. Used for unindention.} -} -\description{ -Wraps some rows of a parse table into a sub-expression. -} From 7c1a50dcb594cd835f7708f84402422bca31b799 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Tue, 5 Dec 2017 18:57:40 +0100 Subject: [PATCH 09/22] adding examples to all exported functions --- API | 4 ---- R/style_guides.R | 27 +++++++++++++++++++++++++-- R/ui.R | 11 +++++++++-- man/create_style_guide.Rd | 15 +++++++++++++-- man/math_token_spacing.Rd | 5 +++++ man/reindention.Rd | 6 ++++++ man/style_dir.Rd | 5 +++++ man/style_pkg.Rd | 7 +++++-- man/tidyverse_style.Rd | 1 + 9 files changed, 69 insertions(+), 12 deletions(-) diff --git a/API b/API index a510c1ba0..4a366875a 100644 --- a/API +++ b/API @@ -12,7 +12,3 @@ style_text(text, ..., style = tidyverse_style, transformers = style(...)) tidyverse_math_token_spacing() tidyverse_reindention() tidyverse_style(scope = "tokens", strict = TRUE, indent_by = 2, start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing()) - -## Foreign S3 methods - -print.vertical(x, ...) diff --git a/R/style_guides.R b/R/style_guides.R index 4d4ad3458..44f5a235e 100644 --- a/R/style_guides.R +++ b/R/style_guides.R @@ -46,6 +46,7 @@ NULL #' @family style_guides #' @examples #' style_text("call( 1)", style = tidyverse_style, scope = "spaces") +#' style_text("call( 1)", transformers = tidyverse_style(strict = TRUE)) #' style_text(c("ab <- 3", "a <-3"), strict = FALSE) # keeps alignment of "<-" #' style_text(c("ab <- 3", "a <-3"), strict = TRUE) # drops alignment of "<-" #' @importFrom purrr partial @@ -153,8 +154,8 @@ tidyverse_style <- function(scope = "tokens", #' transformer function corresponds to one styling rule. The output of this #' function can be used as an argument for \code{style} in top level functions #' like [style_text()] and friends. -#' @param initialize A function that initializes various variables on each -#' level of nesting. +#' @param initialize The bare name of a function that initializes various +#' variables on each level of nesting. #' @param line_break A list of transformer functions that manipulate line_break #' information. #' @param space A list of transformer functions that manipulate spacing @@ -165,6 +166,16 @@ tidyverse_style <- function(scope = "tokens", #' should be used. #' @param reindention A list of parameters for regex re-indention, most #' conveniently constructed using [specify_reindention()]. +#' @examples +#' set_line_break_before_curly_opening <- function(pd_flat) { +#' op <- pd_flat$token %in% "'{'" +#' pd_flat$lag_newlines[op] <- 1L +#' pd_flat +#' } +#' set_line_break_before_curly_opening_style <- function() { +#' create_style_guide(line_break = set_line_break_before_curly_opening) +#' } +#' style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style) #' @export create_style_guide <- function(initialize = initialize_attributes, line_break = NULL, @@ -205,6 +216,10 @@ NULL #' @describeIn reindention Allows to specify which tokens are reindented and #' how. +#' @examples +#' style_text("a <- xyz", reindention = specify_reindention( +#' regex_pattern = "xyz", indention = 4, comments_only = FALSE) +#' ) #' @export specify_reindention <- function(regex_pattern = NULL, indention = 0, @@ -218,6 +233,8 @@ specify_reindention <- function(regex_pattern = NULL, #' @describeIn reindention Simple forwarder to #' `specify_reindention` with reindention according to the tidyverse style #' guide. +#' @examples +#' style_text("a <- xyz", reindention = tidyverse_reindention()) #' @export tidyverse_reindention <- function() { specify_reindention( @@ -281,6 +298,12 @@ specify_math_token_spacing <- #' @describeIn math_token_spacing Simple forwarder to #' `specify_math_token_spacing` with spacing around math tokens according to the #' tidyverse style guide. +#' @examples +#' style_text( +#' "1+1 -3", +#' math_token_spacing = tidyverse_math_token_spacing(), +#' strict = TRUE +#' ) #' @export tidyverse_math_token_spacing <- function() { specify_math_token_spacing(one = c("'+'", "'-'", "'*'", "'/'", "'^'")) diff --git a/R/ui.R b/R/ui.R index 9a2cf2bb7..564c0e89e 100644 --- a/R/ui.R +++ b/R/ui.R @@ -31,9 +31,12 @@ NULL #' @family stylers #' @examples #' \dontrun{ -#' # the following is identical but the former is more convenient: +#' #' style_pkg(style = tidyverse_style, strict = TRUE) -#' style_pkg(transformers = tidyverse_style(strict = TRUE)) +#' style_pkg( +#' scope = "line_breaks", +#' math_token_spacing = specify_math_token_spacing(zero = "'+'") +#' ) #' } #' @export style_pkg <- function(pkg = ".", @@ -112,6 +115,10 @@ style_text <- function(text, #' @inheritSection transform_files Value #' @inheritSection style_pkg Warning #' @family stylers +#' @examples +#' \dontrun{ +#' style_dir(file_type = "r") +#' } #' @export style_dir <- function(path = ".", ..., diff --git a/man/create_style_guide.Rd b/man/create_style_guide.Rd index 4a71936ef..137fb2718 100644 --- a/man/create_style_guide.Rd +++ b/man/create_style_guide.Rd @@ -9,8 +9,8 @@ create_style_guide(initialize = initialize_attributes, line_break = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) } \arguments{ -\item{initialize}{A function that initializes various variables on each -level of nesting.} +\item{initialize}{The bare name of a function that initializes various +variables on each level of nesting.} \item{line_break}{A list of transformer functions that manipulate line_break information.} @@ -35,3 +35,14 @@ transformer function corresponds to one styling rule. The output of this function can be used as an argument for \code{style} in top level functions like \code{\link[=style_text]{style_text()}} and friends. } +\examples{ +set_line_break_before_curly_opening <- function(pd_flat) { + op <- pd_flat$token \%in\% "'{'" + pd_flat$lag_newlines[op] <- 1L + pd_flat +} +set_line_break_before_curly_opening_style <- function() { + create_style_guide(line_break = set_line_break_before_curly_opening) +} +style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style) +} diff --git a/man/math_token_spacing.Rd b/man/math_token_spacing.Rd index 9cbc257b6..c6417ac68 100644 --- a/man/math_token_spacing.Rd +++ b/man/math_token_spacing.Rd @@ -49,4 +49,9 @@ style_text( math_token_spacing = tidyverse_math_token_spacing(), strict = TRUE ) +style_text( + "1+1 -3", + math_token_spacing = tidyverse_math_token_spacing(), + strict = TRUE +) } diff --git a/man/reindention.Rd b/man/reindention.Rd index 8e51542f6..7a6cdb0ed 100644 --- a/man/reindention.Rd +++ b/man/reindention.Rd @@ -38,3 +38,9 @@ how. guide. }} +\examples{ +style_text("a <- xyz", reindention = specify_reindention( + regex_pattern = "xyz", indention = 4, comments_only = FALSE) +) +style_text("a <- xyz", reindention = tidyverse_reindention()) +} diff --git a/man/style_dir.Rd b/man/style_dir.Rd index 2263dfa45..8e9312c25 100644 --- a/man/style_dir.Rd +++ b/man/style_dir.Rd @@ -49,6 +49,11 @@ code to be formatted). It is strongly suggested to only style files that are under version control or to create a backup copy. } +\examples{ +\dontrun{ +style_dir(file_type = "r") +} +} \seealso{ Other stylers: \code{\link{style_file}}, \code{\link{style_pkg}}, \code{\link{style_text}}, diff --git a/man/style_pkg.Rd b/man/style_pkg.Rd index 54026a5d1..1e39e94d7 100644 --- a/man/style_pkg.Rd +++ b/man/style_pkg.Rd @@ -49,9 +49,12 @@ styling whether or not it was actually changed. \examples{ \dontrun{ -# the following is identical but the former is more convenient: + style_pkg(style = tidyverse_style, strict = TRUE) -style_pkg(transformers = tidyverse_style(strict = TRUE)) +style_pkg( + scope = "line_breaks", + math_token_spacing = specify_math_token_spacing(zero = "'+'") +) } } \seealso{ diff --git a/man/tidyverse_style.Rd b/man/tidyverse_style.Rd index d9812383f..0cd3a6a3c 100644 --- a/man/tidyverse_style.Rd +++ b/man/tidyverse_style.Rd @@ -55,6 +55,7 @@ be performed if all less invasive operations are performed too. } \examples{ style_text("call( 1)", style = tidyverse_style, scope = "spaces") +style_text("call( 1)", transformers = tidyverse_style(strict = TRUE)) style_text(c("ab <- 3", "a <-3"), strict = FALSE) # keeps alignment of "<-" style_text(c("ab <- 3", "a <-3"), strict = TRUE) # drops alignment of "<-" } From 3dc7ea9885a298460a14281fc833bc1d749fe83c Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 17:24:21 +0100 Subject: [PATCH 10/22] rename and export initialize_attributes --- API | 3 ++- NAMESPACE | 1 + R/indent.R | 2 +- R/initialize.R | 15 ++++++++------- R/nested_to_tree.R | 4 ++-- R/serialized_tests.R | 4 ++-- R/style_guides.R | 4 ++-- man/create_style_guide.Rd | 4 ++-- vignettes/customizing_styler.Rmd | 6 +++--- .../manipulating_nested_parse_data.Rmd | 2 +- 10 files changed, 24 insertions(+), 21 deletions(-) diff --git a/API b/API index 4a366875a..9b63e8294 100644 --- a/API +++ b/API @@ -2,7 +2,8 @@ ## Exported functions -create_style_guide(initialize = initialize_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) +create_style_guide(initialize = initialize_default_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) +initialize_default_attributes(pd_flat) specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'")) specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE) style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL) diff --git a/NAMESPACE b/NAMESPACE index 23470a70a..0b94a2612 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,6 +2,7 @@ S3method(print,vertical) export(create_style_guide) +export(initialize_default_attributes) export(specify_math_token_spacing) export(specify_reindention) export(style_dir) diff --git a/R/indent.R b/R/indent.R index 01cc4e699..cf9212cb9 100644 --- a/R/indent.R +++ b/R/indent.R @@ -1,7 +1,7 @@ #' Update indention information of parse data #' #' @param pd A nested or flat parse table that is already enhanced with -#' line break and space information via [initialize_attributes()]. +#' line break and space information via [initialize_default_attributes()]. #' @param indent_by How many spaces should be added after the token of interest. #' @param token The token the indention should be based on. #' @name update_indention diff --git a/R/initialize.R b/R/initialize.R index c97f5a400..3c3fe2eaa 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -4,7 +4,8 @@ #' entries in the parse table and adds this information to the table. #' @param pd_flat A parse table. #' @importFrom utils tail -initialize_attributes <- function(pd_flat) { +#' @export +initialize_default_attributes <- function(pd_flat) { init_pd <- initialize_newlines(pd_flat) %>% @@ -17,7 +18,7 @@ initialize_attributes <- function(pd_flat) { init_pd } -#' @describeIn initialize_attributes Initializes `newlines` and `lag_newlines`. +#' @describeIn initialize_default_attributes Initializes `newlines` and `lag_newlines`. initialize_newlines <- function(pd_flat) { pd_flat$line3 <- lead(pd_flat$line1, default = tail(pd_flat$line2, 1)) pd_flat$newlines <- pd_flat$line3 - pd_flat$line2 @@ -26,7 +27,7 @@ initialize_newlines <- function(pd_flat) { pd_flat } -#' @describeIn initialize_attributes Initializes `spaces`. +#' @describeIn initialize_default_attributes Initializes `spaces`. initialize_spaces <- function(pd_flat) { pd_flat$col3 <- lead(pd_flat$col1, default = tail(pd_flat$col2, 1) + 1L) pd_flat$col2_nl <- if_else(pd_flat$newlines > 0L, @@ -43,7 +44,7 @@ remove_attributes <- function(pd_flat, attributes) { pd_flat } -#' @describeIn initialize_attributes Initializes `multi_line`. +#' @describeIn initialize_default_attributes Initializes `multi_line`. initialize_multi_line <- function(pd_flat) { nrow <- nrow(pd_flat) pd_flat$multi_line <- if_else(pd_flat$terminal, @@ -53,13 +54,13 @@ initialize_multi_line <- function(pd_flat) { pd_flat } -#' @describeIn initialize_attributes Initializes `indention_ref_ind`. +#' @describeIn initialize_default_attributes Initializes `indention_ref_ind`. initialize_indention_ref_pos_id <- function(pd_flat) { pd_flat$indention_ref_pos_id <- NA pd_flat } -#' @describeIn initialize_attributes Initializes `indent`. +#' @describeIn initialize_default_attributes Initializes `indent`. initialize_indent <- function(pd_flat) { if (!("indent" %in% names(pd_flat))) { pd_flat$indent <- 0 @@ -67,7 +68,7 @@ initialize_indent <- function(pd_flat) { pd_flat } -#' @describeIn initialize_attributes validates the parse data. +#' @describeIn initialize_default_attributes validates the parse data. validate_parse_data <- function(pd_flat) { if (any(pd_flat$spaces < 0L)) { stop("Invalid parse data") diff --git a/R/nested_to_tree.R b/R/nested_to_tree.R index 21ab8df5a..fd01836d4 100644 --- a/R/nested_to_tree.R +++ b/R/nested_to_tree.R @@ -7,7 +7,7 @@ #' @importFrom purrr when create_tree <- function(text, structure_only = FALSE) { compute_parse_data_nested(text) %>% - pre_visit(c(initialize_attributes)) %>% + pre_visit(c(initialize_default_attributes)) %>% create_node_from_nested_root(structure_only) %>% as.data.frame() } @@ -25,7 +25,7 @@ create_tree <- function(text, structure_only = FALSE) { #' if (getRversion() >= 3.2) { #' code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" #' nested_pd <- styler:::compute_parse_data_nested(code) -#' initialized <- styler:::pre_visit(nested_pd, c(styler:::initialize_attributes)) +#' initialized <- styler:::pre_visit(nested_pd, c(initialize_default_attributes)) #' styler:::create_node_from_nested_root(initialized, structure_only = FALSE) #' } create_node_from_nested_root <- function(pd_nested, structure_only) { diff --git a/R/serialized_tests.R b/R/serialized_tests.R index 4880e2052..3a6501724 100644 --- a/R/serialized_tests.R +++ b/R/serialized_tests.R @@ -144,7 +144,7 @@ NULL style_empty <- function(text) { transformers <- list( # transformer functions - initialize = initialize_attributes, + initialize = initialize_default_attributes, line_break = NULL, space = NULL, token = NULL, @@ -163,7 +163,7 @@ style_op <- function(text) { transformers <- list( # transformer functions - initialize = initialize_attributes, + initialize = initialize_default_attributes, line_break = NULL, space = partial(indent_op, indent_by = 2), token = NULL, diff --git a/R/style_guides.R b/R/style_guides.R index 44f5a235e..ce39f7f0b 100644 --- a/R/style_guides.R +++ b/R/style_guides.R @@ -136,7 +136,7 @@ tidyverse_style <- function(scope = "tokens", create_style_guide( # transformer functions - initialize = initialize_attributes, + initialize = initialize_default_attributes, line_break = line_break_manipulators, space = space_manipulators, token = token_manipulators, @@ -177,7 +177,7 @@ tidyverse_style <- function(scope = "tokens", #' } #' style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style) #' @export -create_style_guide <- function(initialize = initialize_attributes, +create_style_guide <- function(initialize = initialize_default_attributes, line_break = NULL, space = NULL, token = NULL, diff --git a/man/create_style_guide.Rd b/man/create_style_guide.Rd index 137fb2718..a242edf2c 100644 --- a/man/create_style_guide.Rd +++ b/man/create_style_guide.Rd @@ -4,8 +4,8 @@ \alias{create_style_guide} \title{Create a style guide} \usage{ -create_style_guide(initialize = initialize_attributes, line_break = NULL, - space = NULL, token = NULL, indention = NULL, +create_style_guide(initialize = initialize_default_attributes, + line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) } \arguments{ diff --git a/vignettes/customizing_styler.Rmd b/vignettes/customizing_styler.Rmd index 0af943159..ade903d37 100644 --- a/vignettes/customizing_styler.Rmd +++ b/vignettes/customizing_styler.Rmd @@ -73,12 +73,12 @@ table"): ```{r} string_to_format <- "call( 3)" pd <- styler:::compute_parse_data_nested(string_to_format) %>% - styler:::pre_visit(c(styler:::initialize_attributes)) + styler:::pre_visit(c(initialize_default_attributes)) pd$child[[1]] %>% select(token, terminal, text, newlines, spaces) ``` -`initialize_attributes()` is called to initialize some variables, it does not actually +`initialize_default_attributes()` is called to initialize some variables, it does not actually transform the parse table. All the function `remove_space_after_opening_paren()` now does is to look for @@ -155,7 +155,7 @@ respectively, so we need both. The sequence in which styler applies rules on each level of nesting is given in the list below: -* call `initialize_attributes()` to initialize some variables. +* call `initialize_default_attributes()` to initialize some variables. * modify the line breaks (modifying `lag_newlines` only based on `token`, `token_before`, `token_after` and `text`). * modify the spaces (modifying `spaces` only based on `lag_newlines`, diff --git a/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd b/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd index 414f34dbe..4e2126d2c 100644 --- a/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd +++ b/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd @@ -23,7 +23,7 @@ use a [visitor approach](https://en.wikipedia.org/wiki/Visitor_pattern) to separate the algorithm (computing white space information and later apply transformations) from the object (nested data structure). The function `create_filler()` (name depreciated, now called -`initialize_attributes()`) can then be used to compute current +`initialize_default_attributes()`) can then be used to compute current white space information on every level of nesting within the nested parse data if applied in combination with the visitor. In the sequel, a parse table at one level of nesting will be denoted with the term *nest*, which always From c6658942540d6963ffff5a407330947442a2823e Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 17:24:36 +0100 Subject: [PATCH 11/22] Rearranging news --- NEWS.md | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/NEWS.md b/NEWS.md index 14937ea87..3bc53d00a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -## styler 0.1.0 (2017-12-05) +## styler 1.0.0 (2017-12-05) Initial release. @@ -24,6 +24,21 @@ style_file(path, style_text(text, ..., style = tidyverse_style, transformers = style(...)) ``` +### style guides +These functions are the style guides implemented. +``` +tidyverse_style( + scope = "tokens", + strict = TRUE, + indent_by = 2, + start_comments_with_one_space = FALSE, + reindention = tidyverse_reindention(), + math_token_spacing = tidyverse_math_token_spacing() +) +tidyverse_reindention() +tidyverse_math_token_spacing()) +``` + ### style guide creators This function is used to create a style guide. ``` @@ -38,19 +53,6 @@ create_style_guide( ) ``` -### style guides -These functions are the style guides implemented. -``` -tidyverse_style( - scope = "tokens", - strict = TRUE, - indent_by = 2, - start_comments_with_one_space = FALSE, - reindention = tidyverse_reindention(), - math_token_spacing = tidyverse_math_token_spacing() -) -``` - ### Helpers These are helper functions used to specify the style guides in use. @@ -65,10 +67,5 @@ specify_reindention( indention = 0, comments_only = TRUE ) -``` - -These are helper functions that simply forward to the helper functions above. -``` -tidyverse_reindention() -tidyverse_math_token_spacing()) +initialize_default_attributes(pd_flat) ``` From e49213456b8d2741613086f766e0842b1626411a Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 17:29:44 +0100 Subject: [PATCH 12/22] add documentation with example --- R/initialize.R | 4 +++ man/initialize_default_attributes.Rd | 53 ++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 man/initialize_default_attributes.Rd diff --git a/R/initialize.R b/R/initialize.R index 3c3fe2eaa..9c0e6f206 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -4,6 +4,10 @@ #' entries in the parse table and adds this information to the table. #' @param pd_flat A parse table. #' @importFrom utils tail +#' @examples +#' string_to_format <- "call( 3)" +#' pd <- styler:::compute_parse_data_nested(string_to_format) +#' styler:::pre_visit(pd, c(initialize_default_attributes)) #' @export initialize_default_attributes <- function(pd_flat) { diff --git a/man/initialize_default_attributes.Rd b/man/initialize_default_attributes.Rd new file mode 100644 index 000000000..38762bc26 --- /dev/null +++ b/man/initialize_default_attributes.Rd @@ -0,0 +1,53 @@ +% Generated by roxygen2: do not edit by hand +% Please edit documentation in R/initialize.R +\name{initialize_default_attributes} +\alias{initialize_default_attributes} +\alias{initialize_newlines} +\alias{initialize_spaces} +\alias{initialize_multi_line} +\alias{initialize_indention_ref_pos_id} +\alias{initialize_indent} +\alias{validate_parse_data} +\title{Enrich parse table with space and line break information} +\usage{ +initialize_default_attributes(pd_flat) + +initialize_newlines(pd_flat) + +initialize_spaces(pd_flat) + +initialize_multi_line(pd_flat) + +initialize_indention_ref_pos_id(pd_flat) + +initialize_indent(pd_flat) + +validate_parse_data(pd_flat) +} +\arguments{ +\item{pd_flat}{A parse table.} +} +\description{ +This function computes difference (as column and line difference) between two +entries in the parse table and adds this information to the table. +} +\section{Functions}{ +\itemize{ +\item \code{initialize_newlines}: Initializes \code{newlines} and \code{lag_newlines}. + +\item \code{initialize_spaces}: Initializes \code{spaces}. + +\item \code{initialize_multi_line}: Initializes \code{multi_line}. + +\item \code{initialize_indention_ref_pos_id}: Initializes \code{indention_ref_ind}. + +\item \code{initialize_indent}: Initializes \code{indent}. + +\item \code{validate_parse_data}: validates the parse data. +}} + +\examples{ +string_to_format <- "call( 3)" +pd <- styler:::compute_parse_data_nested(string_to_format) +styler:::pre_visit(pd, c(initialize_default_attributes)) +} From a7b47ff4c0b28f04842fc770f9ad1f4255cac7a4 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 17:43:34 +0100 Subject: [PATCH 13/22] Don't describe initializers in the exported function. --- DESCRIPTION | 2 +- R/initialize.R | 17 +++++++++----- man/initialize_default_attributes.Rd | 33 ---------------------------- 3 files changed, 12 insertions(+), 40 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f2e9a24a5..f179bae57 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,5 +1,5 @@ Package: styler -Title: Non-Invasive Pretty Printing of R code +Title: Non-Invasive Pretty Printing of R Code Version: 1.0.0 Authors@R: c(person("Kirill", "Müller", role = c("aut"), email = "krlmlr+r@mailbox.org"), person("Lorenz", "Walthert", role = c("cre", "aut"), email = "lorenz.walthert@icloud.com")) diff --git a/R/initialize.R b/R/initialize.R index 9c0e6f206..882940a29 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -22,7 +22,12 @@ initialize_default_attributes <- function(pd_flat) { init_pd } -#' @describeIn initialize_default_attributes Initializes `newlines` and `lag_newlines`. +#' Initialize attributes +#' +#' @name initialize_attributes +NULL + +#' @describeIn initialize_attributes Initializes `newlines` and `lag_newlines`. initialize_newlines <- function(pd_flat) { pd_flat$line3 <- lead(pd_flat$line1, default = tail(pd_flat$line2, 1)) pd_flat$newlines <- pd_flat$line3 - pd_flat$line2 @@ -31,7 +36,7 @@ initialize_newlines <- function(pd_flat) { pd_flat } -#' @describeIn initialize_default_attributes Initializes `spaces`. +#' @describeIn initialize_attributes Initializes `spaces`. initialize_spaces <- function(pd_flat) { pd_flat$col3 <- lead(pd_flat$col1, default = tail(pd_flat$col2, 1) + 1L) pd_flat$col2_nl <- if_else(pd_flat$newlines > 0L, @@ -48,7 +53,7 @@ remove_attributes <- function(pd_flat, attributes) { pd_flat } -#' @describeIn initialize_default_attributes Initializes `multi_line`. +#' @describeIn initialize_attributes Initializes `multi_line`. initialize_multi_line <- function(pd_flat) { nrow <- nrow(pd_flat) pd_flat$multi_line <- if_else(pd_flat$terminal, @@ -58,13 +63,13 @@ initialize_multi_line <- function(pd_flat) { pd_flat } -#' @describeIn initialize_default_attributes Initializes `indention_ref_ind`. +#' @describeIn initialize_attributes Initializes `indention_ref_ind`. initialize_indention_ref_pos_id <- function(pd_flat) { pd_flat$indention_ref_pos_id <- NA pd_flat } -#' @describeIn initialize_default_attributes Initializes `indent`. +#' @describeIn initialize_attributes Initializes `indent`. initialize_indent <- function(pd_flat) { if (!("indent" %in% names(pd_flat))) { pd_flat$indent <- 0 @@ -72,7 +77,7 @@ initialize_indent <- function(pd_flat) { pd_flat } -#' @describeIn initialize_default_attributes validates the parse data. +#' @describeIn initialize_attributes validates the parse data. validate_parse_data <- function(pd_flat) { if (any(pd_flat$spaces < 0L)) { stop("Invalid parse data") diff --git a/man/initialize_default_attributes.Rd b/man/initialize_default_attributes.Rd index 38762bc26..a4e0a9eed 100644 --- a/man/initialize_default_attributes.Rd +++ b/man/initialize_default_attributes.Rd @@ -2,27 +2,9 @@ % Please edit documentation in R/initialize.R \name{initialize_default_attributes} \alias{initialize_default_attributes} -\alias{initialize_newlines} -\alias{initialize_spaces} -\alias{initialize_multi_line} -\alias{initialize_indention_ref_pos_id} -\alias{initialize_indent} -\alias{validate_parse_data} \title{Enrich parse table with space and line break information} \usage{ initialize_default_attributes(pd_flat) - -initialize_newlines(pd_flat) - -initialize_spaces(pd_flat) - -initialize_multi_line(pd_flat) - -initialize_indention_ref_pos_id(pd_flat) - -initialize_indent(pd_flat) - -validate_parse_data(pd_flat) } \arguments{ \item{pd_flat}{A parse table.} @@ -31,21 +13,6 @@ validate_parse_data(pd_flat) This function computes difference (as column and line difference) between two entries in the parse table and adds this information to the table. } -\section{Functions}{ -\itemize{ -\item \code{initialize_newlines}: Initializes \code{newlines} and \code{lag_newlines}. - -\item \code{initialize_spaces}: Initializes \code{spaces}. - -\item \code{initialize_multi_line}: Initializes \code{multi_line}. - -\item \code{initialize_indention_ref_pos_id}: Initializes \code{indention_ref_ind}. - -\item \code{initialize_indent}: Initializes \code{indent}. - -\item \code{validate_parse_data}: validates the parse data. -}} - \examples{ string_to_format <- "call( 3)" pd <- styler:::compute_parse_data_nested(string_to_format) From 916408384bfb9b4e81249d893535b188c2dcc9b4 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 20:24:36 +0100 Subject: [PATCH 14/22] rename to default_style_guide_attributes --- API | 4 ++-- NAMESPACE | 2 +- R/indent.R | 2 +- R/initialize.R | 4 ++-- R/nested_to_tree.R | 4 ++-- R/serialized_tests.R | 4 ++-- R/style_guides.R | 4 ++-- man/create_style_guide.Rd | 2 +- ...lt_attributes.Rd => default_style_guide_attributes.Rd} | 8 ++++---- vignettes/customizing_styler.Rmd | 6 +++--- .../gsoc_proposal/manipulating_nested_parse_data.Rmd | 2 +- 11 files changed, 21 insertions(+), 21 deletions(-) rename man/{initialize_default_attributes.Rd => default_style_guide_attributes.Rd} (73%) diff --git a/API b/API index 9b63e8294..27492bf95 100644 --- a/API +++ b/API @@ -2,8 +2,8 @@ ## Exported functions -create_style_guide(initialize = initialize_default_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) -initialize_default_attributes(pd_flat) +create_style_guide(initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) +default_style_guide_attributes(pd_flat) specify_math_token_spacing(zero = NULL, one = c("'+'", "'-'", "'*'", "'/'", "'^'")) specify_reindention(regex_pattern = NULL, indention = 0, comments_only = TRUE) style_dir(path = ".", ..., style = tidyverse_style, transformers = style(...), filetype = "R", recursive = TRUE, exclude_files = NULL) diff --git a/NAMESPACE b/NAMESPACE index 0b94a2612..41b19166a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -2,7 +2,7 @@ S3method(print,vertical) export(create_style_guide) -export(initialize_default_attributes) +export(default_style_guide_attributes) export(specify_math_token_spacing) export(specify_reindention) export(style_dir) diff --git a/R/indent.R b/R/indent.R index cf9212cb9..77d77dab2 100644 --- a/R/indent.R +++ b/R/indent.R @@ -1,7 +1,7 @@ #' Update indention information of parse data #' #' @param pd A nested or flat parse table that is already enhanced with -#' line break and space information via [initialize_default_attributes()]. +#' line break and space information via [default_style_guide_attributes()]. #' @param indent_by How many spaces should be added after the token of interest. #' @param token The token the indention should be based on. #' @name update_indention diff --git a/R/initialize.R b/R/initialize.R index 882940a29..4ed415dcf 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -7,9 +7,9 @@ #' @examples #' string_to_format <- "call( 3)" #' pd <- styler:::compute_parse_data_nested(string_to_format) -#' styler:::pre_visit(pd, c(initialize_default_attributes)) +#' styler:::pre_visit(pd, c(default_style_guide_attributes)) #' @export -initialize_default_attributes <- function(pd_flat) { +default_style_guide_attributes <- function(pd_flat) { init_pd <- initialize_newlines(pd_flat) %>% diff --git a/R/nested_to_tree.R b/R/nested_to_tree.R index fd01836d4..3509bc463 100644 --- a/R/nested_to_tree.R +++ b/R/nested_to_tree.R @@ -7,7 +7,7 @@ #' @importFrom purrr when create_tree <- function(text, structure_only = FALSE) { compute_parse_data_nested(text) %>% - pre_visit(c(initialize_default_attributes)) %>% + pre_visit(c(default_style_guide_attributes)) %>% create_node_from_nested_root(structure_only) %>% as.data.frame() } @@ -25,7 +25,7 @@ create_tree <- function(text, structure_only = FALSE) { #' if (getRversion() >= 3.2) { #' code <- "a <- function(x) { if(x > 1) { 1+1 } else {x} }" #' nested_pd <- styler:::compute_parse_data_nested(code) -#' initialized <- styler:::pre_visit(nested_pd, c(initialize_default_attributes)) +#' initialized <- styler:::pre_visit(nested_pd, c(default_style_guide_attributes)) #' styler:::create_node_from_nested_root(initialized, structure_only = FALSE) #' } create_node_from_nested_root <- function(pd_nested, structure_only) { diff --git a/R/serialized_tests.R b/R/serialized_tests.R index 3a6501724..d83ecf51b 100644 --- a/R/serialized_tests.R +++ b/R/serialized_tests.R @@ -144,7 +144,7 @@ NULL style_empty <- function(text) { transformers <- list( # transformer functions - initialize = initialize_default_attributes, + initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, @@ -163,7 +163,7 @@ style_op <- function(text) { transformers <- list( # transformer functions - initialize = initialize_default_attributes, + initialize = default_style_guide_attributes, line_break = NULL, space = partial(indent_op, indent_by = 2), token = NULL, diff --git a/R/style_guides.R b/R/style_guides.R index ce39f7f0b..f495d705f 100644 --- a/R/style_guides.R +++ b/R/style_guides.R @@ -136,7 +136,7 @@ tidyverse_style <- function(scope = "tokens", create_style_guide( # transformer functions - initialize = initialize_default_attributes, + initialize = default_style_guide_attributes, line_break = line_break_manipulators, space = space_manipulators, token = token_manipulators, @@ -177,7 +177,7 @@ tidyverse_style <- function(scope = "tokens", #' } #' style_text("a <- function(x) { x }", style = set_line_break_before_curly_opening_style) #' @export -create_style_guide <- function(initialize = initialize_default_attributes, +create_style_guide <- function(initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, diff --git a/man/create_style_guide.Rd b/man/create_style_guide.Rd index a242edf2c..f553b5288 100644 --- a/man/create_style_guide.Rd +++ b/man/create_style_guide.Rd @@ -4,7 +4,7 @@ \alias{create_style_guide} \title{Create a style guide} \usage{ -create_style_guide(initialize = initialize_default_attributes, +create_style_guide(initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, indention = NULL, use_raw_indention = FALSE, reindention = tidyverse_reindention()) } diff --git a/man/initialize_default_attributes.Rd b/man/default_style_guide_attributes.Rd similarity index 73% rename from man/initialize_default_attributes.Rd rename to man/default_style_guide_attributes.Rd index a4e0a9eed..f82801b8a 100644 --- a/man/initialize_default_attributes.Rd +++ b/man/default_style_guide_attributes.Rd @@ -1,10 +1,10 @@ % Generated by roxygen2: do not edit by hand % Please edit documentation in R/initialize.R -\name{initialize_default_attributes} -\alias{initialize_default_attributes} +\name{default_style_guide_attributes} +\alias{default_style_guide_attributes} \title{Enrich parse table with space and line break information} \usage{ -initialize_default_attributes(pd_flat) +default_style_guide_attributes(pd_flat) } \arguments{ \item{pd_flat}{A parse table.} @@ -16,5 +16,5 @@ entries in the parse table and adds this information to the table. \examples{ string_to_format <- "call( 3)" pd <- styler:::compute_parse_data_nested(string_to_format) -styler:::pre_visit(pd, c(initialize_default_attributes)) +styler:::pre_visit(pd, c(default_style_guide_attributes)) } diff --git a/vignettes/customizing_styler.Rmd b/vignettes/customizing_styler.Rmd index ade903d37..40d7b81fe 100644 --- a/vignettes/customizing_styler.Rmd +++ b/vignettes/customizing_styler.Rmd @@ -73,12 +73,12 @@ table"): ```{r} string_to_format <- "call( 3)" pd <- styler:::compute_parse_data_nested(string_to_format) %>% - styler:::pre_visit(c(initialize_default_attributes)) + styler:::pre_visit(c(default_style_guide_attributes)) pd$child[[1]] %>% select(token, terminal, text, newlines, spaces) ``` -`initialize_default_attributes()` is called to initialize some variables, it does not actually +`default_style_guide_attributes()` is called to initialize some variables, it does not actually transform the parse table. All the function `remove_space_after_opening_paren()` now does is to look for @@ -155,7 +155,7 @@ respectively, so we need both. The sequence in which styler applies rules on each level of nesting is given in the list below: -* call `initialize_default_attributes()` to initialize some variables. +* call `default_style_guide_attributes()` to initialize some variables. * modify the line breaks (modifying `lag_newlines` only based on `token`, `token_before`, `token_after` and `text`). * modify the spaces (modifying `spaces` only based on `lag_newlines`, diff --git a/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd b/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd index 4e2126d2c..2b0cebd4b 100644 --- a/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd +++ b/vignettes/gsoc_proposal/manipulating_nested_parse_data.Rmd @@ -23,7 +23,7 @@ use a [visitor approach](https://en.wikipedia.org/wiki/Visitor_pattern) to separate the algorithm (computing white space information and later apply transformations) from the object (nested data structure). The function `create_filler()` (name depreciated, now called -`initialize_default_attributes()`) can then be used to compute current +`default_style_guide_attributes()`) can then be used to compute current white space information on every level of nesting within the nested parse data if applied in combination with the visitor. In the sequel, a parse table at one level of nesting will be denoted with the term *nest*, which always From 2a5199ad41241e38ce8724e893c19ea6110c9485 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 23:39:24 +0100 Subject: [PATCH 15/22] update news --- NEWS.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/NEWS.md b/NEWS.md index 3bc53d00a..2d151660d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -43,7 +43,7 @@ tidyverse_math_token_spacing()) This function is used to create a style guide. ``` create_style_guide( - initialize = initialize_attributes, + initialize = default_style_guide_attributes, line_break = NULL, space = NULL, token = NULL, From e133152d9c9516a0bccc636821a7a9182c68826d Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Wed, 6 Dec 2017 23:45:43 +0100 Subject: [PATCH 16/22] Rephrase helpfile. --- R/initialize.R | 6 +++--- man/default_style_guide_attributes.Rd | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/R/initialize.R b/R/initialize.R index 4ed415dcf..386384c35 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -1,7 +1,7 @@ -#' Enrich parse table with space and line break information +#' Intialize default style guide attributes #' -#' This function computes difference (as column and line difference) between two -#' entries in the parse table and adds this information to the table. +#' This function initialises and removes various variables from the parse +#' table. #' @param pd_flat A parse table. #' @importFrom utils tail #' @examples diff --git a/man/default_style_guide_attributes.Rd b/man/default_style_guide_attributes.Rd index f82801b8a..9fdb37b08 100644 --- a/man/default_style_guide_attributes.Rd +++ b/man/default_style_guide_attributes.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/initialize.R \name{default_style_guide_attributes} \alias{default_style_guide_attributes} -\title{Enrich parse table with space and line break information} +\title{Intialize default style guide attributes} \usage{ default_style_guide_attributes(pd_flat) } @@ -10,8 +10,8 @@ default_style_guide_attributes(pd_flat) \item{pd_flat}{A parse table.} } \description{ -This function computes difference (as column and line difference) between two -entries in the parse table and adds this information to the table. +This function initialises and removes various variables from the parse +table. } \examples{ string_to_format <- "call( 3)" From 285dba464f06dd962fbdd0653dd34c506342ec15 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Thu, 7 Dec 2017 23:05:56 +0100 Subject: [PATCH 17/22] add test environment --- cran-comments.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cran-comments.md b/cran-comments.md index 2b78e9ec3..3d4d67b2f 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,5 +1,5 @@ ## Test environments -* local OS X install, R 3.4.2 +* local OS X install, R 3.4.2, R 3.4.3 * ubuntu 12.04 (on travis-ci), R 3.4.2 * win-builder (devel and release) From 3bdd908c992a512fbedad1c4b0ce16e68cff539a Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Thu, 7 Dec 2017 22:18:59 +0100 Subject: [PATCH 18/22] styling R/ with strict = TRUE and scope = "tokens" --- R/addins.R | 15 +++++----- R/communicate.R | 1 - R/dplyr.R | 10 ++++--- R/expr-is.R | 2 +- R/indent.R | 12 ++++---- R/initialize.R | 1 - R/nest.R | 7 +++-- R/nested_to_tree.R | 7 +++-- R/parse.R | 5 ++-- R/reindent.R | 13 ++++----- R/relevel.R | 6 ++-- R/rules-spacing.R | 14 ++++++---- R/serialize.R | 6 ++-- R/serialized_tests.R | 65 ++++++++++++++++++++++++-------------------- R/set-assert-args.R | 1 - R/style_guides.R | 48 ++++++++++++++++++++------------ R/token-create.R | 2 +- R/transform-code.R | 5 ++-- R/transform-files.R | 3 +- R/ui.R | 8 ++---- R/unindent.R | 7 +++-- R/visit.R | 33 ++++++++++++---------- 22 files changed, 149 insertions(+), 122 deletions(-) diff --git a/R/addins.R b/R/addins.R index 31dc67b4c..c5d8a9488 100644 --- a/R/addins.R +++ b/R/addins.R @@ -50,13 +50,14 @@ try_transform_as_r_file <- function(context, transformer) { tryCatch( transformer(context$contents), error = function(e) stop( - paste( - "Styling of unsaved files is only supported for R files with valid code.", - "Please save the file (as .R or .Rmd) and make sure that the R code in it", - "can be parsed. Then, try to style again.", - "The error was \n", e - ), call. = FALSE - )) + paste( + "Styling of unsaved files is only supported for R files with valid code.", + "Please save the file (as .R or .Rmd) and make sure that the R code in it", + "can be parsed. Then, try to style again.", + "The error was \n", e + ), call. = FALSE + ) + ) } #' @describeIn styler_addins Styles the highlighted selection in a `.R` or diff --git a/R/communicate.R b/R/communicate.R index f274f8714..b7f14e520 100644 --- a/R/communicate.R +++ b/R/communicate.R @@ -23,5 +23,4 @@ communicate_summary <- function(changed, ruler_width) { cli::cat_bullet("\t", sum(changed, na.rm = TRUE), "\tFile changed.", bullet = "info") cli::cat_bullet(bullet = "cross", "\t", sum(is.na(changed)), "\tStyling threw an eror.") cli::cat_rule(width = max(40, ruler_width)) - } diff --git a/R/dplyr.R b/R/dplyr.R index 488e7f3e8..d55cc1908 100644 --- a/R/dplyr.R +++ b/R/dplyr.R @@ -24,8 +24,10 @@ arrange <- function(.data, ...) { stopifnot(is.data.frame(.data)) ord <- eval(substitute(order(...)), .data, parent.frame()) if (length(ord) != nrow(.data)) { - stop("Length of ordering vectors don't match data frame size", - call. = FALSE) + stop( + "Length of ordering vectors don't match data frame size", + call. = FALSE + ) } .data[ord, , drop = FALSE] } @@ -83,7 +85,7 @@ left_join <- function(x, y, by, ...) { res } -nth <- function (x, n, order_by = NULL, default = x[NA_real_]) { +nth <- function(x, n, order_by = NULL, default = x[NA_real_]) { stopifnot(length(n) == 1, is.numeric(n)) n <- trunc(n) if (n == 0 || n > length(x) || n < -length(x)) { @@ -101,7 +103,7 @@ nth <- function (x, n, order_by = NULL, default = x[NA_real_]) { } -last <- function (x, order_by = NULL, default = x[NA_real_]) { +last <- function(x, order_by = NULL, default = x[NA_real_]) { nth(x, -1L, order_by = order_by, default = default) } diff --git a/R/expr-is.R b/R/expr-is.R index a691f8dfd..695ee1333 100644 --- a/R/expr-is.R +++ b/R/expr-is.R @@ -47,7 +47,7 @@ contains_else_expr_that_needs_braces <- function(pd) { non_comment_after_else <- next_non_comment(pd, else_idx) sub_expr <- pd$child[[non_comment_after_else]] # needs braces if NOT if_condition, NOT curly expr - !is_cond_expr(sub_expr) && !is_curly_expr(sub_expr) + !is_cond_expr(sub_expr) && !is_curly_expr(sub_expr) } else { FALSE } diff --git a/R/indent.R b/R/indent.R index 77d77dab2..d35ccfd4b 100644 --- a/R/indent.R +++ b/R/indent.R @@ -28,8 +28,8 @@ indent_op <- function(pd, special_token, "LEFT_ASSIGN", "EQ_ASSIGN", - "'$'") - ) { + "'$'" + )) { indent_indices <- compute_indent_indices(pd, token) pd$indent[indent_indices] <- pd$indent[indent_indices] + indent_by pd @@ -62,8 +62,8 @@ indent_assign <- function(pd, indent_by, token = NULL) { #' statements that do not have curly parenthesis. indent_without_paren <- function(pd, indent_by = 2) { pd %>% - indent_without_paren_for_while_fun(indent_by) %>% - indent_without_paren_if_else(indent_by) + indent_without_paren_for_while_fun(indent_by) %>% + indent_without_paren_if_else(indent_by) } #' @describeIn update_indention Is used to indent for and statements and function @@ -90,8 +90,8 @@ indent_without_paren_if_else <- function(pd, indent_by) { expr_after_else_idx <- next_non_comment(pd, else_idx) has_else_without_curly_or_else_chid <- any(pd$token == "ELSE") && - pd$child[[expr_after_else_idx]]$token[1] != "'{'" && - pd$child[[expr_after_else_idx]]$token[1] != "IF" + pd$child[[expr_after_else_idx]]$token[1] != "'{'" && + pd$child[[expr_after_else_idx]]$token[1] != "IF" if (has_else_without_curly_or_else_chid) { pd$indent[seq(else_idx + 1, nrow(pd))] <- indent_by } diff --git a/R/initialize.R b/R/initialize.R index 386384c35..0c2833963 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -10,7 +10,6 @@ #' styler:::pre_visit(pd, c(default_style_guide_attributes)) #' @export default_style_guide_attributes <- function(pd_flat) { - init_pd <- initialize_newlines(pd_flat) %>% initialize_spaces() %>% diff --git a/R/nest.R b/R/nest.R index 5f7ab70ae..76b44a35a 100644 --- a/R/nest.R +++ b/R/nest.R @@ -65,8 +65,10 @@ add_terminal_token_before <- function(pd_flat) { filter(terminal) %>% arrange(pos_id) - data_frame(id = terminals$id, - token_before = lag(terminals$token, default = "")) %>% + data_frame( + id = terminals$id, + token_before = lag(terminals$token, default = "") + ) %>% left_join(pd_flat, ., by = "id") } @@ -144,7 +146,6 @@ combine_children <- function(child, internal_child) { bound <- bind_rows(child, internal_child) if (nrow(bound) == 0) return(NULL) bound[order(bound$pos_id), ] - } #' Get the start right diff --git a/R/nested_to_tree.R b/R/nested_to_tree.R index 3509bc463..56da7fdef 100644 --- a/R/nested_to_tree.R +++ b/R/nested_to_tree.R @@ -43,8 +43,9 @@ create_node_from_nested_root <- function(pd_nested, structure_only) { #' @param parent The parent of the node to be created. #' @importFrom purrr map2 map create_node_from_nested <- function(pd_nested, parent, structure_only) { - if (is.null(pd_nested)) + if (is.null(pd_nested)) { return() + } node_info <- create_node_info(pd_nested, structure_only) @@ -62,6 +63,6 @@ create_node_info <- function(pd_nested, structure_only) { pd_nested$short, " [", pd_nested$lag_newlines, "/", pd_nested$spaces, "] {", - pd_nested$pos_id, "}") - + pd_nested$pos_id, "}" + ) } diff --git a/R/parse.R b/R/parse.R index c7b50b478..60394e49d 100644 --- a/R/parse.R +++ b/R/parse.R @@ -57,7 +57,7 @@ add_id_and_short <- function(pd) { #' for potential reparsing. verify_str_txt <- function(pd_with_terminal_text, text) { string_ind <- pd_with_terminal_text$token == "STR_CONST" - strings <- pd_with_terminal_text[string_ind,] + strings <- pd_with_terminal_text[string_ind, ] parent_of_strings_ind <- pd_with_terminal_text$id %in% strings$parent other_ind <- !(string_ind | parent_of_strings_ind) if (nrow(strings) == 0 || !any(substr(strings$text, 1, 1) == "[")) { @@ -71,8 +71,7 @@ verify_str_txt <- function(pd_with_terminal_text, text) { bind_rows( new_strings, pd_with_terminal_text[other_ind, ], - pd_with_terminal_text[parent_of_strings_ind,] + pd_with_terminal_text[parent_of_strings_ind, ] ) %>% arrange(pos_id) - } diff --git a/R/reindent.R b/R/reindent.R index f772bf541..db140bd12 100644 --- a/R/reindent.R +++ b/R/reindent.R @@ -30,7 +30,7 @@ update_indention_ref_fun_call <- function(pd_nested) { non_comment <- which(pd_nested$token != "COMMENT") first_non_comment_after_call <- non_comment[non_comment > 2][1] if ((current_is_call) && - pd_nested$lag_newlines[first_non_comment_after_call] == 0) { + pd_nested$lag_newlines[first_non_comment_after_call] == 0) { candidates <- seq2(3, nrow(pd_nested) - 1) child_is_call <- map_lgl(pd_nested$child, is_function_call) @@ -109,7 +109,6 @@ apply_ref_indention_one <- function(flattened_pd, target_token) { flattened_pd$col1[cols_to_update] <- flattened_pd$col1[cols_to_update] + shift flattened_pd$col2[cols_to_update] <- flattened_pd$col2[cols_to_update] + shift flattened_pd - } @@ -131,16 +130,16 @@ apply_ref_indention_one <- function(flattened_pd, target_token) { #' the tokens that match `regex.` #' @importFrom purrr map flatten_int set_regex_indention <- function(flattened_pd, - pattern, - target_indention = 0, - comments_only = TRUE) { + pattern, + target_indention = 0, + comments_only = TRUE) { if (comments_only) { cond <- which( (flattened_pd$token == "COMMENT") & (flattened_pd$lag_newlines > 0) ) if (length(cond) < 1) return(flattened_pd) - to_check <- flattened_pd[cond,] - not_to_check <- flattened_pd[-cond,] + to_check <- flattened_pd[cond, ] + not_to_check <- flattened_pd[-cond, ] } else { to_check <- flattened_pd not_to_check <- NULL diff --git a/R/relevel.R b/R/relevel.R index 800fb694b..8ca6f18ed 100644 --- a/R/relevel.R +++ b/R/relevel.R @@ -24,7 +24,7 @@ flatten_operators <- function(pd_nested) { #' @include token-define.R flatten_operators_one <- function(pd_nested) { pd_token_left <- c(special_token, math_token, "'$'") - pd_token_right <- c(special_token, "LEFT_ASSIGN", "'+'", "'-'") + pd_token_right <- c(special_token, "LEFT_ASSIGN", "'+'", "'-'") bound <- pd_nested %>% flatten_pd(pd_token_left, left = TRUE) %>% flatten_pd(pd_token_right, left = FALSE) @@ -182,7 +182,7 @@ find_block_id <- function(pd) { relocate_eq_assign_one <- function(pd) { idx_eq_assign <- which(pd$token == "EQ_ASSIGN") eq_ind <- seq2(idx_eq_assign[1] - 1L, last(idx_eq_assign) + 1L) - eq_expr <- pd[eq_ind,] %>% + eq_expr <- pd[eq_ind, ] %>% wrap_expr_in_expr() %>% add_line_col_to_wrapped_expr() %>% remove_attributes(c( @@ -191,7 +191,7 @@ relocate_eq_assign_one <- function(pd) { )) eq_expr$id <- NA eq_expr$parent <- NA - non_eq_expr <- pd[-eq_ind,] + non_eq_expr <- pd[-eq_ind, ] pd <- bind_rows(eq_expr, non_eq_expr) %>% arrange(pos_id) pd diff --git a/R/rules-spacing.R b/R/rules-spacing.R index fec33ee9c..577380653 100644 --- a/R/rules-spacing.R +++ b/R/rules-spacing.R @@ -63,7 +63,7 @@ remove_space_after_unary_pm <- function(pd_flat) { pm_after <- pd_flat$token %in% op_pm pd_flat$spaces[pm_after & (pd_flat$newlines == 0L) & - (lag(pd_flat$token) %in% op_pm_unary_after)] <- 0L + (lag(pd_flat$token) %in% op_pm_unary_after)] <- 0L pd_flat } @@ -84,7 +84,8 @@ fix_quotes <- function(pd_flat) { vapply( lapply(pd_flat$text[str_const][str_const_change], parse_text), deparse, - character(1L)) + character(1L) + ) pd_flat } @@ -144,7 +145,7 @@ remove_space_before_comma <- function(pd_flat) { comma_after <- pd_flat$token == "','" if (!any(comma_after)) return(pd_flat) comma_before <- lead(comma_after, default = FALSE) - idx <- comma_before & (pd_flat$newlines == 0L) + idx <- comma_before & (pd_flat$newlines == 0L) pd_flat$spaces[idx] <- 0L pd_flat } @@ -183,8 +184,10 @@ start_comments_with_space <- function(pd, force_one = FALSE) { comment_pos <- pd$token == "COMMENT" if (!any(comment_pos)) return(pd) - comments <- rematch2::re_match(pd$text[comment_pos], - "^(?#+'*)(? *)(?.*)$") + comments <- rematch2::re_match( + pd$text[comment_pos], + "^(?#+'*)(? *)(?.*)$" + ) comments$space_after_prefix <- nchar( comments$space_after_prefix, type = "width" @@ -275,5 +278,4 @@ set_space_between_eq_sub_and_comma <- function(pd) { op_before <- which(pd$token == "EQ_SUB" & lead(pd$token == "','")) pd$spaces[op_before] <- 1L pd - } diff --git a/R/serialize.R b/R/serialize.R index a588f6235..01ba4fe2e 100644 --- a/R/serialize.R +++ b/R/serialize.R @@ -6,8 +6,10 @@ serialize_parse_data_flattened <- function(flattened_pd, start_line = 1) { flattened_pd$lag_newlines[1] <- start_line - 1 res <- with(flattened_pd, - paste0(collapse = "", - map(lag_newlines, add_newlines), map(lag_spaces, add_spaces), text) + paste0( + collapse = "", + map(lag_newlines, add_newlines), map(lag_spaces, add_spaces), text ) + ) strsplit(res, "\n")[[1L]] } diff --git a/R/serialized_tests.R b/R/serialized_tests.R index d83ecf51b..961759e35 100644 --- a/R/serialized_tests.R +++ b/R/serialized_tests.R @@ -33,9 +33,11 @@ test_collection <- function(test, sub_test = NULL, "in\\.R(?:|md)$" ) - in_names <- list.files(file.path(path), - pattern = pattern, - full.names = FALSE) + in_names <- list.files( + file.path(path), + pattern = pattern, + full.names = FALSE + ) if (length(in_names) < 1) stop("no items to check") @@ -47,11 +49,12 @@ test_collection <- function(test, sub_test = NULL, out_trees <- construct_tree(in_items) pwalk(list(in_items, out_items, in_names, out_names, out_trees), - transform_and_check, - transformer = transformer, - write_back = write_back, - write_tree = write_tree, - ...) + transform_and_check, + transformer = transformer, + write_back = write_back, + write_tree = write_tree, + ... + ) } #' Construct *-out.R from a *-in.R @@ -96,7 +99,6 @@ transform_and_check <- function(in_item, out_item, transformer, write_back, write_tree = NA, out_tree = "_tree", ...) { - write_tree <- set_arg_write_tree(write_tree) read_in <- enc::read_lines_enc(in_item) if (write_tree) { @@ -114,11 +116,15 @@ transform_and_check <- function(in_item, out_item, ) if (transformed) { - warning(in_name, " was different from ", out_name, - immediate. = TRUE, call. = FALSE) + warning( + in_name, " was different from ", out_name, + immediate. = TRUE, call. = FALSE + ) } else { - message(in_name, " was identical to ", out_name, - immediate. = TRUE, call. = FALSE) + message( + in_name, " was identical to ", out_name, + immediate. = TRUE, call. = FALSE + ) } } @@ -145,13 +151,12 @@ style_empty <- function(text) { transformers <- list( # transformer functions initialize = default_style_guide_attributes, - line_break = NULL, - space = NULL, - token = NULL, - + line_break = NULL, + space = NULL, + token = NULL, # transformer options use_raw_indention = FALSE, - reindention = specify_reindention(), + reindention = specify_reindention(), NULL ) transformed_text <- parse_transform_serialize(text, transformers) @@ -160,23 +165,21 @@ style_empty <- function(text) { #' @describeIn test_transformer Transformations for indention based on operators style_op <- function(text) { - transformers <- list( # transformer functions initialize = default_style_guide_attributes, - line_break = NULL, - space = partial(indent_op, indent_by = 2), - token = NULL, + line_break = NULL, + space = partial(indent_op, indent_by = 2), + token = NULL, # transformer options use_raw_indention = FALSE, - reindention = specify_reindention(), + reindention = specify_reindention(), NULL ) transformed_text <- parse_transform_serialize(text, transformers) transformed_text - } @@ -220,8 +223,9 @@ stop_insufficient_r_version <- function() { #' out manually. generate_test_samples <- function() { gen <- function(x) { - if (length(x) == 0) "" - else { + if (length(x) == 0) { + "" + } else { c( paste0(x[1], gen(x[-1])), paste0(x[1], " # comment\n", paste(x[-1], collapse = "")) @@ -239,10 +243,11 @@ generate_test_samples <- function() { collapse(gen(c("if", "(", "TRUE", ")", "NULL", " else", " NULL"))), file = "tests/testthat/insertion_comment_interaction/if_else-in.R" ) - cat(collapse(gen(c( - "if", "(", "TRUE", ")", "NULL", " else", " if", "(", "FALSE", ")", "NULL", - " else", " NULL"))), + cat( + collapse(gen(c( + "if", "(", "TRUE", ")", "NULL", " else", " if", "(", "FALSE", ")", "NULL", + " else", " NULL" + ))), file = "tests/testthat/insertion_comment_interaction/if_else_if_else-in.R" ) } - diff --git a/R/set-assert-args.R b/R/set-assert-args.R index e2338120f..0301d4786 100644 --- a/R/set-assert-args.R +++ b/R/set-assert-args.R @@ -70,4 +70,3 @@ assert_tokens <- function(tokens) { ) } } - diff --git a/R/style_guides.R b/R/style_guides.R index f495d705f..1d5359d5f 100644 --- a/R/style_guides.R +++ b/R/style_guides.R @@ -57,13 +57,12 @@ tidyverse_style <- function(scope = "tokens", start_comments_with_one_space = FALSE, reindention = tidyverse_reindention(), math_token_spacing = tidyverse_math_token_spacing()) { - scope <- character_to_ordered( scope, c("none", "spaces", "indention", "line_breaks", "tokens") ) - space_manipulators <- if (scope >= "spaces") + space_manipulators <- if (scope >= "spaces") { lst( partial(indent_braces, indent_by = indent_by), partial(indent_op, indent_by = indent_by), @@ -89,36 +88,48 @@ tidyverse_style <- function(scope = "tokens", remove_space_before_dollar, remove_space_after_fun_dec, remove_space_around_colons, - partial(start_comments_with_space, - force_one = start_comments_with_one_space), + partial( + start_comments_with_space, + force_one = start_comments_with_one_space + ), remove_space_after_unary_pm_nested, if (strict) set_space_before_comments else add_space_before_comments, set_space_between_levels, set_space_between_eq_sub_and_comma ) + } use_raw_indention <- scope < "indention" - line_break_manipulators <- if (scope >= "line_breaks") + line_break_manipulators <- if (scope >= "line_breaks") { lst( remove_line_break_before_curly_opening, if (strict) remove_line_break_before_round_closing_after_curly else identity, if (strict) remove_line_break_before_round_closing_fun_dec else identity, partial(style_line_break_around_curly, strict), - if (strict) partial( - set_line_break_after_opening_if_call_is_multi_line, - except_token_after = "COMMENT", - except_text_before = c("switch", "ifelse", "if_else") - ) else identity, - if (strict) partial( - set_line_break_before_closing_call, except_token_before = "COMMENT" - ) else identity, + if (strict) { + partial( + set_line_break_after_opening_if_call_is_multi_line, + except_token_after = "COMMENT", + except_text_before = c("switch", "ifelse", "if_else") + ) + } else { + identity + } , + if (strict) { + partial( + set_line_break_before_closing_call, except_token_before = "COMMENT" + ) + } else { + identity + } , remove_line_break_in_empty_fun_call, add_line_break_after_pipe ) + } - token_manipulators <- if (scope >= "tokens") + token_manipulators <- if (scope >= "tokens") { lst( force_assignment_op, resolve_semicolon, @@ -126,6 +137,7 @@ tidyverse_style <- function(scope = "tokens", remove_terminal_token_before_and_after, if (strict) wrap_if_else_multi_line_in_curly else identity ) + } indention_modifier <- @@ -228,7 +240,7 @@ specify_reindention <- function(regex_pattern = NULL, regex_pattern, indention, comments_only -) + ) #' @describeIn reindention Simple forwarder to #' `specify_reindention` with reindention according to the tidyverse style @@ -252,8 +264,10 @@ tidyverse_reindention <- function() { #' construction of the factor fails. character_to_ordered <- function(x, levels, name = substitute(x)) { if (!all((x %in% levels))) { - stop("all values in ", name, " must be one of the following: ", - paste(levels, collapse = ", "), call. = FALSE) + stop( + "all values in ", name, " must be one of the following: ", + paste(levels, collapse = ", "), call. = FALSE + ) } factor(x, levels = levels, ordered = TRUE) } diff --git a/R/token-create.R b/R/token-create.R index 0f1b815cd..fa617bd05 100644 --- a/R/token-create.R +++ b/R/token-create.R @@ -33,7 +33,7 @@ create_tokens <- function(tokens, len_text <- length(text) data_frame( token = tokens, - text = texts, + text = texts, short = substr(texts, 1, 5), lag_newlines = lag_newlines, newlines = lead(lag_newlines), diff --git a/R/transform-code.R b/R/transform-code.R index 8045bab1b..1eaf51b63 100644 --- a/R/transform-code.R +++ b/R/transform-code.R @@ -12,7 +12,8 @@ transform_code <- function(path, fun, verbose = FALSE, ...) { } else if (is_rmd_file(path)) { enc::transform_lines_enc( path, fun = partial(transform_rmd, transformer_fun = fun), ..., - verbose = verbose) + verbose = verbose + ) } else { stop(path, " is not an R or Rmd file") } @@ -71,5 +72,5 @@ identify_chunks <- function(lines) { #' #' @inheritParams identify_chunks get_knitr_pattern <- function(lines) { - knitr::all_patterns[["md"]] + knitr::all_patterns[["md"]] } diff --git a/R/transform-files.R b/R/transform-files.R index 98c69965e..37daadb77 100644 --- a/R/transform-files.R +++ b/R/transform-files.R @@ -80,7 +80,6 @@ make_transformer <- function(transformers) { function(text) { transformed_text <- parse_transform_serialize(text, transformers) transformed_text - } } @@ -108,7 +107,7 @@ parse_transform_serialize <- function(text, transformers) { pattern = transformers$reindention$regex_pattern, target_indention = transformers$reindention$indention, comments_only = transformers$reindention$comments_only - ) + ) serialized_transformed_text <- serialize_parse_data_flattened(flattened_pd, start_line = start_line) diff --git a/R/ui.R b/R/ui.R index 564c0e89e..8e4546567 100644 --- a/R/ui.R +++ b/R/ui.R @@ -53,7 +53,6 @@ style_pkg <- function(pkg = ".", } prettify_pkg <- function(transformers, filetype, exclude_files) { - filetype <- set_and_assert_arg_filetype(filetype) r_files <- vignette_files <- readme <- NULL @@ -98,7 +97,6 @@ style_text <- function(text, ..., style = tidyverse_style, transformers = style(...)) { - transformer <- make_transformer(transformers) styled_text <- transformer(text) construct_vertical(styled_text) @@ -166,9 +164,9 @@ prettify_any <- function(transformers, filetype, recursive, exclude_files) { #' @family stylers #' @export style_file <- function(path, - ..., - style = tidyverse_style, - transformers = style(...)) { + ..., + style = tidyverse_style, + transformers = style(...)) { changed <- withr::with_dir( dirname(path), transform_files(basename(path), transformers) diff --git a/R/unindent.R b/R/unindent.R index 90f2d7a07..53be19c03 100644 --- a/R/unindent.R +++ b/R/unindent.R @@ -21,8 +21,9 @@ set_unindention_child <- function(pd, token = "')'", unindent_by) { non_candidates <- pd[-cand_ind, ] candidates$child <- map(candidates$child, - unindent_child, - unindent_by = abs(pd$indent[closing] - pd$indent[closing-1])) + unindent_child, + unindent_by = abs(pd$indent[closing] - pd$indent[closing - 1]) + ) bind_rows(candidates, non_candidates) %>% arrange(pos_id) @@ -38,7 +39,7 @@ unindent_child <- function(pd, token = c("')'", "'}'"), unindent_by = 2) { if (!("indent" %in% names(pd))) { pd$indent <- 0 } - if ((length(closing) > 0) && (closing == nrow(pd))) { + if ((length(closing) > 0) && (closing == nrow(pd))) { pd$indent[closing] <- pd$indent[closing] - unindent_by } pd diff --git a/R/visit.R b/R/visit.R index 4792dec89..67f031688 100644 --- a/R/visit.R +++ b/R/visit.R @@ -40,8 +40,10 @@ post_visit <- function(pd_nested, funs) { #' @family visitors #' @importFrom purrr reduce visit_one <- function(pd_flat, funs) { - reduce(funs, function(x, fun) fun(x), - .init = pd_flat) + reduce( + funs, function(x, fun) fun(x), + .init = pd_flat + ) } @@ -59,19 +61,22 @@ context_to_terminals <- function(pd_nested, outer_indent, outer_spaces, outer_indention_refs) { - if (is.null(pd_nested)) return() pd_transformed <- context_towards_terminals( pd_nested, outer_lag_newlines, outer_indent, outer_spaces, outer_indention_refs ) - pd_transformed$child <- pmap(list(pd_transformed$child, - pd_transformed$lag_newlines, - pd_transformed$indent, - pd_transformed$spaces, - pd_transformed$indention_ref_pos_id), - context_to_terminals) + pd_transformed$child <- pmap( + list( + pd_transformed$child, + pd_transformed$lag_newlines, + pd_transformed$indent, + pd_transformed$spaces, + pd_transformed$indention_ref_pos_id + ), + context_to_terminals + ) pd_transformed } @@ -147,7 +152,8 @@ enrich_terminals <- function(flattened_pd, use_raw_indention = FALSE) { split(groups) %>% lapply(function(.x) { .x$col2 <- cumsum(.x$nchar + .x$lag_spaces) - .x}) %>% + .x + }) %>% bind_rows() flattened_pd$col1 <- flattened_pd$col2 - flattened_pd$nchar flattened_pd @@ -175,11 +181,10 @@ enrich_terminals <- function(flattened_pd, use_raw_indention = FALSE) { choose_indention <- function(flattened_pd, use_raw_indention) { if (!use_raw_indention) { flattened_pd$lag_spaces <- if_else(flattened_pd$lag_newlines > 0, - flattened_pd$indent, - flattened_pd$lag_spaces) + flattened_pd$indent, + flattened_pd$lag_spaces + ) } flattened_pd$indent <- NULL flattened_pd } - - From 4f904a6693f6c7e922fed58913339e5052a4dbfc Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Fri, 8 Dec 2017 09:34:02 +0100 Subject: [PATCH 19/22] tweak allignment --- R/serialized_tests.R | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/R/serialized_tests.R b/R/serialized_tests.R index 961759e35..691fb0cbc 100644 --- a/R/serialized_tests.R +++ b/R/serialized_tests.R @@ -167,11 +167,10 @@ style_empty <- function(text) { style_op <- function(text) { transformers <- list( # transformer functions - initialize = default_style_guide_attributes, + initialize = default_style_guide_attributes, line_break = NULL, space = partial(indent_op, indent_by = 2), token = NULL, - # transformer options use_raw_indention = FALSE, reindention = specify_reindention(), From 285334df847813b7a987b33d414a838993565cfa Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 9 Dec 2017 13:32:16 +0100 Subject: [PATCH 20/22] spelling --- R/initialize.R | 2 +- man/default_style_guide_attributes.Rd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/R/initialize.R b/R/initialize.R index 0c2833963..5ff082849 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -1,4 +1,4 @@ -#' Intialize default style guide attributes +#' Initialize default style guide attributes #' #' This function initialises and removes various variables from the parse #' table. diff --git a/man/default_style_guide_attributes.Rd b/man/default_style_guide_attributes.Rd index 9fdb37b08..172cc5276 100644 --- a/man/default_style_guide_attributes.Rd +++ b/man/default_style_guide_attributes.Rd @@ -2,7 +2,7 @@ % Please edit documentation in R/initialize.R \name{default_style_guide_attributes} \alias{default_style_guide_attributes} -\title{Intialize default style guide attributes} +\title{Initialize default style guide attributes} \usage{ default_style_guide_attributes(pd_flat) } From 2d6a97eb4d43b487e0e5d8158cfe29d5f8d95504 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 9 Dec 2017 14:05:00 +0100 Subject: [PATCH 21/22] inherit params --- R/initialize.R | 1 + 1 file changed, 1 insertion(+) diff --git a/R/initialize.R b/R/initialize.R index 5ff082849..a3e8a1134 100644 --- a/R/initialize.R +++ b/R/initialize.R @@ -24,6 +24,7 @@ default_style_guide_attributes <- function(pd_flat) { #' Initialize attributes #' #' @name initialize_attributes +#' @inheritParams default_style_guide_attributes NULL #' @describeIn initialize_attributes Initializes `newlines` and `lag_newlines`. From 1e57c645e7fba6e94975081c5f6ca608d52e1a74 Mon Sep 17 00:00:00 2001 From: Lorenz Walthert Date: Sat, 9 Dec 2017 14:07:38 +0100 Subject: [PATCH 22/22] udpate test inputs --- .../testthat/public-api/xyz-r-and-rmd-dir/random-rmd-script.Rmd | 2 +- .../xyz-r-and-rmd-dir/subdir/random-rmd-script-in-subdir.Rmd | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/testthat/public-api/xyz-r-and-rmd-dir/random-rmd-script.Rmd b/tests/testthat/public-api/xyz-r-and-rmd-dir/random-rmd-script.Rmd index 3c40bdb82..8a2767ca2 100644 --- a/tests/testthat/public-api/xyz-r-and-rmd-dir/random-rmd-script.Rmd +++ b/tests/testthat/public-api/xyz-r-and-rmd-dir/random-rmd-script.Rmd @@ -6,7 +6,7 @@ output: html_document --- ```{r setup, include=FALSE} -1+1 +1 + 1 ``` ## R Markdown diff --git a/tests/testthat/public-api/xyz-r-and-rmd-dir/subdir/random-rmd-script-in-subdir.Rmd b/tests/testthat/public-api/xyz-r-and-rmd-dir/subdir/random-rmd-script-in-subdir.Rmd index 3c40bdb82..8a2767ca2 100644 --- a/tests/testthat/public-api/xyz-r-and-rmd-dir/subdir/random-rmd-script-in-subdir.Rmd +++ b/tests/testthat/public-api/xyz-r-and-rmd-dir/subdir/random-rmd-script-in-subdir.Rmd @@ -6,7 +6,7 @@ output: html_document --- ```{r setup, include=FALSE} -1+1 +1 + 1 ``` ## R Markdown