Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polish lint and styling actions #295

Merged
merged 67 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
108b61b
check pre-commit code checks and formatters via precommit-ci-lite bot
philipp-baumann Sep 12, 2024
f9b040f
fix according pre-commit hoooks
philipp-baumann Sep 12, 2024
a99e688
debug: slim down hooks to styler
philipp-baumann Sep 13, 2024
be6b395
remove roxygenize
philipp-baumann Sep 13, 2024
1048dae
avoid pre-commit action and only use the lite (applies fixes)
philipp-baumann Sep 13, 2024
ba7ca89
add space to test linter
philipp-baumann Sep 13, 2024
f2c9995
use latest; add back precommit action
philipp-baumann Sep 13, 2024
026e8f6
now after pre-commit-lite ci enabled
philipp-baumann Sep 13, 2024
8c51a0c
disable unused hooks
philipp-baumann Sep 13, 2024
b8d6bf0
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 13, 2024
6c46d03
parsable R and no browser()
philipp-baumann Sep 13, 2024
f38c3a2
remove old lintr action
philipp-baumann Sep 13, 2024
9e8b9db
avoid race conditions
philipp-baumann Sep 13, 2024
17894c4
also add .lintr hook
philipp-baumann Sep 13, 2024
95efc16
please lintr
philipp-baumann Sep 13, 2024
276b3b6
exclude test-fetchers.R
philipp-baumann Sep 13, 2024
4aba03f
exclude lintr
philipp-baumann Sep 13, 2024
d393956
update linter config, fix lints
philipp-baumann Sep 14, 2024
07755af
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
1699a4b
fix lints
philipp-baumann Sep 14, 2024
308960b
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 14, 2024
b55a097
fix more lints
philipp-baumann Sep 14, 2024
ee536cc
fix lint cmd
philipp-baumann Sep 14, 2024
24d802f
lint
philipp-baumann Sep 14, 2024
1d7ccb9
again fix remaing lint errors
philipp-baumann Sep 14, 2024
a16202d
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 14, 2024
f3bcb1d
fix lints
philipp-baumann Sep 14, 2024
e83d9cc
exclude from lintr
philipp-baumann Sep 14, 2024
e1a05c7
fix rhub nix runner to use current branch
philipp-baumann Sep 14, 2024
d3eb26f
exclude vignettes
philipp-baumann Sep 14, 2024
5d93726
more fixes
philipp-baumann Sep 14, 2024
e2aedaa
try fix rhub gh url
philipp-baumann Sep 14, 2024
39a39f8
remote already there
philipp-baumann Sep 14, 2024
04d3f2b
Merge branch 'main' into precommit-ci-lite-linter
philipp-baumann Sep 16, 2024
c10c2bd
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
b5fe46d
add docopt for precommit nix R hooks
philipp-baumann Sep 16, 2024
e83f8bb
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
a421aba
use forked action
philipp-baumann Sep 16, 2024
9eefc15
use fixed fork revision
philipp-baumann Sep 16, 2024
ad1211a
test nix styler
philipp-baumann Sep 16, 2024
049e68a
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Sep 16, 2024
b6020de
no renv
philipp-baumann Sep 16, 2024
d12e833
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
ceb15e6
add precommit to the dev env
philipp-baumann Sep 16, 2024
83f2e30
update fork revision
philipp-baumann Sep 16, 2024
8c66d2f
lint with flint
philipp-baumann Sep 16, 2024
17a5741
update precommit fork revision
philipp-baumann Sep 16, 2024
016a51e
do an extra precommit clean and use original R action
philipp-baumann Sep 16, 2024
d4d8f2d
clean cache
philipp-baumann Sep 16, 2024
2ffc9de
direct styling, no extra PR
philipp-baumann Sep 16, 2024
363c25a
fix styling
philipp-baumann Sep 16, 2024
65c8faa
manual fix
philipp-baumann Sep 16, 2024
42c94c7
do pull before committing
philipp-baumann Sep 16, 2024
3ae73f5
add fetch PR
philipp-baumann Sep 16, 2024
4077475
Style
philipp-baumann Sep 16, 2024
2786531
remove precommit
philipp-baumann Sep 16, 2024
1d89a9d
Merge remote-tracking branch 'refs/remotes/origin/precommit-ci-lite-l…
philipp-baumann Sep 16, 2024
fd411f7
commit only if changes
philipp-baumann Sep 16, 2024
2d5f20a
run rhub nix action only on main not in PR
philipp-baumann Sep 16, 2024
705e3b2
add lintr and combine lint-and-style action
philipp-baumann Sep 16, 2024
a68af1f
name and rename action
philipp-baumann Sep 16, 2024
0137a6f
fix syntax
philipp-baumann Sep 16, 2024
673734b
exclude files from lints
philipp-baumann Sep 16, 2024
385f5cf
reformat
philipp-baumann Sep 16, 2024
2ecc2e0
fix linter config format
philipp-baumann Sep 16, 2024
dc9a962
add flint to ignores and set up flint
philipp-baumann Sep 16, 2024
fdd2889
add flint rules
philipp-baumann Sep 16, 2024
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
25 changes: 25 additions & 0 deletions .github/workflows/format-code.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check code
on:
pull_request:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
main:
runs-on: ubuntu-22.04
philipp-baumann marked this conversation as resolved.
Show resolved Hide resolved
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/action@v3.0.1
- uses: pre-commit-ci/lite-action@v1.0.3
name: pre-commit-ci-lite
if: always()
with:
msg: apply code formatting
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
155 changes: 155 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
# 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.3
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style, --cache-root=styler-perm]
exclude: >
(?x)^(
tests/testthat/in/.*|
renv/.*
)$
- 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: 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/.*|
LICENSE|
revdep/.*|
tests/testthat/in/.*|
)$
- id: readme-rmd-rendered
- id: parsable-R
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- id: no-browser-statement
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- id: no-debug-statement
exclude: >
(?x)^(
tests/testthat/in/.*|
)$
- 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
- id: end-of-file-fixer
exclude: '\.Rd' # sometimes roxygen fails to generate EOF blank line.
- id: file-contents-sorter
files: '^\.Rbuildignore$'
- 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: https://github.com/lorenzwalthert/gitignore-tidy
rev: 0.1.2
hooks:
- id: tidy-gitignore
- repo: local
hooks:
- id: consistent-release-tag
name: consistent-release-tag
entry: Rscript inst/hooks/local/consistent-release-tag.R
language: r
additional_dependencies:
- docopt
- fs
- yaml
- purrr
- glue
- rlang
- git2r
- desc
- lorenzwalthert/precommit
stages: [commit, push]
- id: hooks-config-to-inst
name: hooks-config-to-inst
entry: Rscript inst/hooks/local/hooks-config-to-inst.R
language: r
stages: [commit, push]
additional_dependencies:
- fs
require_serial: True
- id: spell-check-exclude-identical
name: spell-check-exclude-identical
entry: Rscript inst/hooks/local/spell-check-exclude-identical.R
language: r
stages: [commit, push]
additional_dependencies:
- magrittr
- purrr
- yaml
- here
- rlang
require_serial: True
- 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: Rscript inst/hooks/local/spell-check-ordered-exclude.R
language: r
files: '^(.*/|)\.?pre-commit-config.*\.yaml$'
additional_dependencies:
- magrittr
- yaml
- purrr
- rlang

default_stages: ["commit"]

ci:
skip: [consistent-release-tag, spell-check-ordered-exclude, pkgdown]
autoupdate_schedule: monthly
6 changes: 3 additions & 3 deletions man/rix.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading