From 3a494736a5d4209f07c95fd6fc3e1f56c42f7038 Mon Sep 17 00:00:00 2001 From: Zachary Susswein Date: Tue, 6 Aug 2024 20:46:27 +0000 Subject: [PATCH] Use R specific pre-commit --- .pre-commit-config.yaml | 61 ++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 05457317..237d474c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,45 +1,66 @@ +# All available hooks: https://pre-commit.com/hooks.html +# R specific hooks: https://github.com/lorenzwalthert/precommit repos: -##### -# Basic file cleanliness -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 +# R +- 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: lintr + - id: readme-rmd-rendered + - id: parsable-R + - id: no-browser-statement + - id: no-print-statement + - id: no-debug-statement + - id: deps-in-desc +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.6.0 + hooks: - id: check-added-large-files - - id: check-yaml - - id: check-toml + args: ['--maxkb=200'] + - id: file-contents-sorter + files: '^\.Rbuildignore$' - id: end-of-file-fixer - - id: mixed-line-ending - - id: trailing-whitespace + exclude: '\.Rd' +- repo: https://github.com/pre-commit-ci/pre-commit-ci-config + rev: v1.6.1 + hooks: + # Only required when https://pre-commit.ci is used for config validation + - id: check-pre-commit-ci-config +- 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: ` to allow committing specific files ##### # Python - repo: https://github.com/psf/black - rev: 23.10.0 + rev: 24.4.2 hooks: # if you have ipython notebooks, consider using # `black-jupyter` hook instead - id: black args: ['--line-length', '79'] - repo: https://github.com/PyCQA/isort - rev: 5.12.0 + rev: 5.13.2 hooks: - id: isort args: ['--profile', 'black', '--line-length', '79'] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.1.0 + rev: v0.4.2 hooks: - id: ruff ##### -# R -- repo: https://github.com/lorenzwalthert/precommit - rev: v0.4.2 - hooks: - - id: style-files - - id: lintr -##### # Java - repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks - rev: v2.11.0 + rev: v2.13.0 hooks: - id: pretty-format-java args: [--aosp,--autofix] @@ -59,3 +80,5 @@ repos: - id: detect-secrets args: ['--baseline', '.secrets.baseline'] exclude: package.lock.json +ci: + autoupdate_schedule: monthly