# config used to run all hooks we have defined in this repo in .github/workflows/end-2-end.yml
# All available hooks: https://pre-commit.com/hooks.html
# R specific hooks: https://github.com/lorenzwalthert/precommit
default_stages: ["commit"]
repos:
-   repo: https://github.com/lorenzwalthert/precommit
    rev: v0.1.3.9008
    hooks: 
    -   id: style-files
        args: [--style_pkg=styler, --style_fun=tidyverse_style]
        exclude: '^tests/testthat/in/.*\.R'
    -   id: roxygenize
        additional_dependencies:
        -    cli
        -    fs
        -    here
        -    magrittr
        -    purrr
        -    R.cache
        -    rlang
        -    rprojroot
        -    rstudioapi
        -    withr
        -    yaml
        -    r-lib/pkgapi
    # codemeta must be above use-tidy-description when both are used
    -   id: codemeta-description-updated
    -   id: lintr
    -   id: use-tidy-description
    -   id: spell-check
        exclude: >
          (?x)^(
          .*\.[rR]|
          .*\.feather|
          .*\.jpeg|
          .*\.pdf|
          .*\.png|
          .*\.py|
          .*\.RData|
          .*\.rds|
          .*\.Rds|
          .*\.Rproj|
          .*\.sh|
          (.*/|)\.gitignore|
          (.*/|)\.pre-commit-.*|
          (.*/|)\.Rbuildignore|
          (.*/|)\.Renviron|
          (.*/|)\.Rprofile|
          (.*/|)\.travis\.yml|
          (.*/|)appveyor\.yml|
          (.*/|)NAMESPACE|
          (.*/|)renv/settings\.dcf|
          (.*/|)renv\.lock|
          (.*/|)WORDLIST|
          \.github/workflows/.*|
          data/.*|
          inst/hooks/.*|
          inst/pre-commit-.*|
          )$
    -   id: readme-rmd-rendered
    -   id: parsable-R
    -   id: parsable-roxygen
    -   id: no-browser-statement
    -   id: no-print-statement
    -   id: no-debug-statement
    -   id: deps-in-desc
    -   id: pkgdown
-   repo: local
    hooks:
    -   id: consistent-release-tag
        name: consistent-release-tag
        entry: inst/hooks/local/consistent-release-tag.R
        language: script
        stages: [commit, push]
    -   id: hooks-config-to-inst
        name: hooks-config-to-inst
        entry: inst/hooks/local/hooks-config-to-inst.R
        language: script
        stages: [commit, push]
    -   id: spell-check-exclude-identical
        name: spell-check-exclude-identical
        entry: inst/hooks/local/spell-check-exclude-identical.R
        language: script
        stages: [commit, push]
    -   id: forbid-to-commit
        name: Don't commit common R artifacts
        entry: Cannot commit .Rhistory, .Rdata, .csv and similar.
        language: fail
        files: '\.(Rhistory|csv|RData|Rds|rds)$'
        # `exclude: <regex>` to allow committing specific files.
    -   id: spell-check-ordered-exclude
        name: Ordered regex pattern for spell-check exclusion
        description: Ensure alphabetical order in `exclude:` key of spell check.
        entry: inst/hooks/local/spell-check-ordered-exclude.R
        language: script
        files: '^(.*/|)\.?pre-commit-config.*\.yaml$'
