Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
^renv$
^renv\.lock$
inst/examples
.gitignore
^\.Rproj\.user$
Expand Down
2 changes: 2 additions & 0 deletions .Rprofile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Sys.setenv(RENV_CONFIG_AUTO_SNAPSHOT = "FALSE")
source("renv/activate.R")
8 changes: 8 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
- id: formatr
name: formatR
description: Uses formatR to format R files
entry: Rscript scripts/pre-commit-formatR.R
language: r
types: [text]
files: '.*.[rR]$'
additional_dependencies: [docopt]
17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,20 @@ to

[![R source code after
reformatting](https://db.yihui.org/imgur/TBZm0B8.png)](https://yihui.shinyapps.io/formatR/)

## Pre-commit Hook

formatR is available as a pre-commit hook. The following arguments are available:

```
Options:
--no-comments Remove comments.
--no-blanks Remove blank lines.
--arrow If given, arrows will not be substituted for = signs.
--pipe If given, pipes will not be changed.
--brace-newline If given, braces will not be put on new lines.
--indent=INDENT Number of indents. [default: 4]
--no-wrap Skip wrapping the text.
--width-cutoff=WIDTH Text width cutoff. [default: 80]
--args-newline If TRUE, arguments are started on a new line after a function call. [default: FALSE]
```
23 changes: 23 additions & 0 deletions renv.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"R": {
"Version": "4.3.3",
"Repositories": [
{
"Name": "CRAN",
"URL": "https://cran.csiro.au"
}
]
},
"Packages": {
"renv": {
"Package": "renv",
"Version": "1.0.5",
"Source": "Repository",
"Repository": "CRAN",
"Requirements": [
"utils"
],
"Hash": "32c3f93e8360f667ca5863272ec8ba6a"
}
}
}
7 changes: 7 additions & 0 deletions renv/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
library/
local/
cellar/
lock/
python/
sandbox/
staging/
Loading