Skip to content

Commit

Permalink
Add Makefile and pre-commit config
Browse files Browse the repository at this point in the history
  • Loading branch information
Nenuial committed Jul 20, 2024
1 parent 0ff08f2 commit af275f5
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 3 deletions.
7 changes: 4 additions & 3 deletions .Rbuildignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
^.*\.Rproj$
^LICENSE\.md$
^\.Rproj\.user$
^\.github$
^\.lintr$
^\.pre-commit-config\.yaml$
^_pkgdown\.yml$
^data-raw$
^docs$
^pkgdown$
^\.github$
^LICENSE\.md$
^\.lintr$
65 changes: 65 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
repos:
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.2
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
- id: roxygenize
- id: use-tidy-description
- id: spell-check
exclude: >
(?x)^(
.*\.[rR]|
.*\.feather|
.*\.jpeg|
.*\.pdf|
.*\.png|
.*\.py|
.*\.RData|
.*\.rds|
.*\.Rds|
.*\.Rproj|
.*\.sh|
(.*/|)\.gitignore|
(.*/|)\.gitlab-ci\.yml|
(.*/|)\.lintr|
(.*/|)\.pre-commit-.*|
(.*/|)\.Rbuildignore|
(.*/|)\.Renviron|
(.*/|)\.Rprofile|
(.*/|)\.travis\.yml|
(.*/|)appveyor\.yml|
(.*/|)NAMESPACE|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
\.github/workflows/.*|
data/.*|
Makefile|
)$
- id: lintr
- id: parsable-R
- id: no-browser-statement
- id: no-print-statement
- id: no-debug-statement
- id: deps-in-desc
- id: pkgdown
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
args: ['--maxkb=200']
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- id: end-of-file-fixer
exclude: '\.Rd'
- repo: local
hooks:
- id: forbid-to-commit
name: Don't commit common R artifacts
entry: Cannot commit .Rhistory, .RData, .Rds or .rds.
language: fail
files: '\.(Rhistory|RData|Rds|rds)$'
# `exclude: <regex>` to allow committing specific files
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
document:
R -e 'devtools::document()'

build:
R -e 'devtools::build()'

install:
R -e 'pak::local_install(upgrade = FALSE)'

0 comments on commit af275f5

Please sign in to comment.