Skip to content

Commit

Permalink
Merge 8aa3092 into 9305b62
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzwalthert authored Dec 28, 2021
2 parents 9305b62 + 8aa3092 commit d338888
Show file tree
Hide file tree
Showing 101 changed files with 1,072 additions and 239 deletions.
35 changes: 17 additions & 18 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
^Meta$
^doc$
^.*-in_tree$
^.*\.Rproj$
^\.Rproj\.user$
^API$
^README\.Rmd$
^CONTRIBUTING\.md$
^LICENSE\.md$
^Meta$
^README-.*\.png$
^appveyor\.yml$
^tic\.R$
^docs$
^_pkgdown\.yml$
CONTRIBUTING.md
^README\.Rmd$
^\.Rproj\.user$
^\.github$
^\.gitsum$
^gitsum$
revdep
^\.pre-commit-config\.yaml$
^_pkgdown\.yml$
^cran-comments\.md$
^doc$
^docs$
^gitsum$
^inst/WORDLIST$
^inst/hooks/.*$
^revdep$
^tests/testmanual$
^\.pre-commit-config\.yaml$
^brew\-log$
^\.github/$
^tic\.R$
^touchstone$
^\.github$
^LICENSE\.md$
^inst/hooks/$
^inst/WORDLIST$
^vignettes/gsoc_proposal$
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
tests/testthat/**/*_tree linguist-generated=true
tests/testthat/**/*_tree linguist-generated=true
10 changes: 8 additions & 2 deletions .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:

name: R-CMD-check

concurrency:
group: ${{ github.action }}-${{ github.event_path }}
cancel-in-progress: true


jobs:
R-CMD-check:
runs-on: ${{ matrix.config.os }}
Expand All @@ -27,9 +32,10 @@ jobs:
matrix:
config:
- {os: macOS-latest, r: 'release'}
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: windows-latest, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/latest"}
- {os: ubuntu-18.04, r: 'devel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest", http-user-agent: "R/4.0.0 (ubuntu-18.04) R (4.0.0 x86_64-pc-linux-gnu x86_64 linux-gnu) on GitHub Actions" }
- {os: ubuntu-18.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: 'oldrel', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
- {os: ubuntu-18.04, r: '3.6', rspm: "https://packagemanager.rstudio.com/cran/__linux__/bionic/latest"}
Expand Down
13 changes: 0 additions & 13 deletions .github/workflows/cancel.yaml

This file was deleted.

Empty file removed .github/workflows/check-full.yaml
Empty file.
2 changes: 1 addition & 1 deletion .github/workflows/pkgdown.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
on:
push:
branches: master
branches: main

name: pkgdown

Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: pre-commit
on:
push:
branches-ignore:
- 'master'
- 'main'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

jobs:
pre-commit:
runs-on: ubuntu-18.04
if: >-
!contains(github.event.head_commit.message, 'ci skip') &&
(
startsWith(github.ref, 'refs/heads') ||
github.event.pull_request.draft == false
)
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
# your system installation code here
# sudo apt-get install -y libcurl4-openssl-dev
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
architecture: "x64"
- name: Run pre-commit
uses: pre-commit/[email protected]
- name: Commit files
if: failure() && startsWith(github.ref, 'refs/heads')
run: |
if [[ `git status --porcelain --untracked-files=no` ]]; then
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git checkout -- .github/workflows
git commit -m "pre-commit" -a
fi
- name: Push changes
if: failure() && startsWith(github.ref, 'refs/heads')
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
env:
RENV_CONFIG_CACHE_ENABLED: FALSE
9 changes: 7 additions & 2 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
on:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main

name: test-coverage

concurrency:
group: ${{ github.action }}-${{ github.event_path }}
cancel-in-progress: true


jobs:
test-coverage:
runs-on: macOS-latest
Expand Down
14 changes: 7 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.RData
.Rhistory
.Rproj.user
.gitsum
Meta
R/scratch
doc
.Rproj.user
.Rhistory
.RData
inst/doc
docs
.gitsum
gitsum
R/scratch
inst/doc
revdep/
!revdep/*.md
!revdep/problems.md
touchstone/*
!touchstone/script.R
!touchstone/config.json
!touchstone/script.R
36 changes: 28 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@ default_stages: [commit]

repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.1.3.9014
rev: v0.2.2.9006
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
exclude: >
(?x)^(
tests/testthat/.*/.*\.R(md)?|
tests/testthat/.*/.*\.R(md|nw)?|
vignettes/customizing_styler\.Rmd|
tests/testthat/public-api/xyzfile-rnw/random4\.Rnw|
vignettes/detect-alignment\.Rmd|
tests/testmanual/addins/.*invalid.*|
tests/testmanual/addins/r-valid\.R|
)$
- id: roxygenize
additional_dependencies:
- r-lib/pkgapi
- id: use-tidy-description
- id: spell-check
exclude: >
Expand Down Expand Up @@ -47,9 +52,11 @@ repos:
exclude: >
(?x)^(
tests/testthat/public-api/xyzaddin/addin_region-.*|
tests/testmanual/addins/r-invalid\.R|
tests/.*invalid.*|
tests/testthat/rmd/no-tidy-out\.Rmd|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/indention_operators/base_pipe_and_assignment-.*|
tests/testthat/indention_operators/.*pipe.*|
tests/testthat/line_breaks_and_other/.*pipe.*|
tests/testthat/exception_handling/parser-error.R|
)$
- id: no-browser-statement
Expand All @@ -58,25 +65,38 @@ repos:
tests/testthat/public-api/xyzaddin/addin_region-.*|
tests/testmanual/addins/r-invalid\.R|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/indention_operators/base_pipe_and_assignment-.*|
tests/testthat/indention_operators/.*pipe.*|
tests/testthat/line_breaks_and_other/.*pipe.*|
tests/testthat/exception_handling/parser-error.R|
)$
- id: deps-in-desc
exclude: >
(?x)^(
touchstone/.*|
tests/testmanual/addins/r-invalid\.R|
tests/testmanual/addins/.*invalid.*|
tests/testthat/escaping/basic-escape-out\.R|
tests/testthat/rnw/011-conditional-eval-out\.Rnw|
tests/testthat/.*\.R(md)?
)$
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.1.0
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
files: "\\.Rbuildignore$"
- id: end-of-file-fixer
exclude: '\.Rd'
exclude: >
(?x)^(
\.Rd|
tests/testthat/exception_handling/empty_file\.R|
tests/testthat/parse_comments/eol_eof_spaces-.*|
tests/testthat/reference-objects/.*|
)$
- repo: https://github.com/lorenzwalthert/gitignore-tidy
rev: b3eaceb0bf2df137cc80f85b3943b6684f204c48
hooks:
- id: tidy-gitignore
- repo: local
hooks:
- id: forbid-to-commit
Expand Down
8 changes: 4 additions & 4 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: styler
Title: Non-Invasive Pretty Printing of R Code
Version: 1.6.2
Version: 1.6.2.9000
Authors@R:
c(person(given = "Kirill",
family = "Müller",
Expand All @@ -16,8 +16,9 @@ Description: Pretty-prints R code without changing the user's formatting
License: MIT + file LICENSE
URL: https://github.com/r-lib/styler, https://styler.r-lib.org
BugReports: https://github.com/r-lib/styler/issues
Depends:
R (>= 3.4.0)
Imports:
backports (>= 1.1.0),
cli (>= 1.1.0),
glue,
magrittr (>= 2.0.0),
Expand All @@ -29,7 +30,6 @@ Imports:
tibble (>= 1.4.2),
tools,
withr (>= 1.0.0),
xfun (>= 0.1)
Suggests:
data.tree (>= 0.1.6),
digest,
Expand All @@ -46,7 +46,7 @@ VignetteBuilder:
Encoding: UTF-8
Roxygen: list(markdown = TRUE, roclets = c("rd", "namespace", "collate",
"pkgapi::api_roclet"))
RoxygenNote: 7.1.1.9001
RoxygenNote: 7.1.2
Collate:
'addins.R'
'communicate.R'
Expand Down
57 changes: 56 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,59 @@
# styler 1.2
# styler 1.6.2.9000 (Development version)

**API changes**

* new R option `styler.cache_root` (defaulting to `"styler"`) that determines
the sub-directory under the {R.cache} cache directory that {styler} uses. Non-
default caches won't be cleaned up by {styler}. We suggest `"styler-perm"`
(also used by {precommit}).

* stylerignore markers are now interpreted as regular expressions instead of
comments that must match exactly. This allows to specify multiple markers in
one regular expression for `styler.ignore_start` and `styler.ignore_stop`,
e.g. to use markers for lintr and styler on the same line, you can use
`options(styler.ignore_start = "nolint start|styler: off"`:

```r
# nolint start, styler: off
1 +1
# nolint end
# styler: on
```
As a consequence of this approach, the defaults for `styler.ignore_start` and
`styler.ignore_stop` omit the `#` (#849).


**Other changes**

* Piped function without brackets `substitute(x %>% y)` don't get `()` added
anymore, as this can change outcome of the code (#876).
* Add vignette on distributing style guide (#846, #861).
* Alignment detection respects stylerignore (#850).
* `Warning: Unknown or uninitialised column:` was fixed (#885).
* Unaligned expressions with quoted key (e.g. `c("x" = 2)`) are now correctly
detected (#881).
* ensure a trailing blank line also if the input is cached (#867).
* Preserve trailing blank line in roxygen examples to simplify concatenation of
examples (#880).
* Fix argument name `filetype` in Example for `style_dir()` (#855).
* An error is now thrown on styling if input unicode characters can't be
correctly parsed for Windows and R < 4.2 (#883).


**Infrastructure**

* Remove dependency on {xfun} (#866).
* Bump minimal R requirement to 3.4 in line with the
[tidyverse](https://www.tidyverse.org/blog/2019/04/r-version-support/), which
allowed to remove the dependency at {backports} and some exception handling.
* rename default branch to main (#859).
* the built package size has been reduced by ~50% by listing `*-in_tree` files
in `.Rbuildignore` (#879).
* Enable pre-commit.ci (#843).
* use pre-commit via GitHub Actions (#872).


# styler 1.6.2

* clean up cache files older than one week (#842).

Expand Down
4 changes: 2 additions & 2 deletions R/addins.R
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#' Helper functions for styling via RStudio Addins.
#' @section Addins:
#' - Set style: Select the style transformers to use. For flexibility, the user
#' input is passed to the `transformers` argument, not the `style` argument, so
#' entering `styler::tidyverse_style(scope = "spaces")` in the Addin is
#' input is passed to the `transformers` argument, not the `style` argument,
#' so entering `styler::tidyverse_style(scope = "spaces")` in the Addin is
#' equivalent to `styler::style_text("1+1", scope = "spaces")` and
#' `styler::style_text("1+1", transformers = styler::tidyverse_style(scope = "spaces"))`
#' if the text to style is `1+1`. The style transformers are memorized
Expand Down
2 changes: 1 addition & 1 deletion R/communicate.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @inheritParams can_verify_roundtrip
#' @keywords internal
communicate_warning <- function(changed, transformers) {
if (any(changed, na.rm = TRUE) &&
if (any(changed, na.rm = TRUE) &&
!can_verify_roundtrip(transformers) &&
!getOption("styler.quiet", FALSE)
) {
Expand Down
Loading

0 comments on commit d338888

Please sign in to comment.