diff --git a/.github/workflows/pr-commands.yaml b/.github/workflows/pr-commands.yaml index eea58c5c..cff4cf77 100644 --- a/.github/workflows/pr-commands.yaml +++ b/.github/workflows/pr-commands.yaml @@ -8,7 +8,7 @@ name: Commands jobs: document: - if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/document') }} + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') || github.event.comment.author_association == 'CONTRIBUTOR') && startsWith(github.event.comment.body, '/document') }} name: document runs-on: ubuntu-latest env: @@ -45,7 +45,7 @@ jobs: repo-token: ${{ secrets.GITHUB_TOKEN }} style: - if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') && startsWith(github.event.comment.body, '/style') }} + if: ${{ github.event.issue.pull_request && (github.event.comment.author_association == 'MEMBER' || github.event.comment.author_association == 'OWNER') || github.event.comment.author_association == 'CONTRIBUTOR') && startsWith(github.event.comment.body, '/style') }} name: style runs-on: ubuntu-latest env: diff --git a/.github/workflows/pre-commit.yaml b/.github/workflows/pre-commit.yaml deleted file mode 100644 index fc0c5c01..00000000 --- a/.github/workflows/pre-commit.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: pre-commit - -on: - pull_request: - push: - branches: [main] - -jobs: - pre-commit: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-python@v3 - - uses: ./.github/actions/pre-commit diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 364c3d12..07413981 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,24 +6,33 @@ repos: rev: v0.4.3 hooks: - id: style-files - args: [--style_pkg=styler, --style_fun=tidyverse_style] + args: [--style_pkg=styler, --style_fun=tidyverse_style, + --cache-root=styler-perm] + - id: roxygenize - id: use-tidy-description - id: lintr - id: readme-rmd-rendered - id: parsable-R - id: no-browser-statement - id: no-print-statement + exclude: '^tests/testthat/test-print\.R$' - id: no-debug-statement - id: deps-in-desc - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 - hooks: + hooks: - id: check-added-large-files args: ['--maxkb=200'] - id: file-contents-sorter files: '^\.Rbuildignore$' - id: end-of-file-fixer - exclude: '\.Rd' + exclude: '(\.Rd)|(tests/testthat/_snaps/)' + - id: check-yaml + - id: check-toml + - id: mixed-line-ending + args: ['--fix=lf'] + - id: trailing-whitespace + exclude: 'tests/testthat/_snaps/' - repo: https://github.com/pre-commit-ci/pre-commit-ci-config rev: v1.6.1 hooks: @@ -38,6 +47,40 @@ repos: files: '\.(Rhistory|RData|Rds|rds)$' # `exclude: ` to allow committing specific files ##### +# Python +- repo: https://github.com/psf/black + 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.13.2 + hooks: + - id: isort + args: ['--profile', 'black', + '--line-length', '79'] +- repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.4.2 + hooks: + - id: ruff +##### +# Java +- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks + rev: v2.13.0 + hooks: + - id: pretty-format-java + args: [--aosp,--autofix] +##### +# Julia +# Due to lack of first-class Julia support, this needs Julia local install +# and JuliaFormatter.jl installed in the library +# - repo: https://github.com/domluna/JuliaFormatter.jl +# rev: v1.0.39 +# hooks: +# - id: julia-formatter +##### # Secrets - repo: https://github.com/Yelp/detect-secrets rev: v1.4.0 @@ -46,4 +89,13 @@ repos: args: ['--baseline', '.secrets.baseline'] exclude: package.lock.json ci: - autoupdate_schedule: monthly + autofix_commit_msg: | + [pre-commit.ci] auto fixes from pre-commit.com hooks + + for more information, see https://pre-commit.ci + autofix_prs: true + autoupdate_branch: '' + autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate' + autoupdate_schedule: weekly + skip: [roxygenize] + submodules: false diff --git a/DESCRIPTION b/DESCRIPTION index d07939e2..e48840b0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,12 +17,12 @@ Description: Add logging, metadata handling, and data handling License: Apache License (>= 2) Encoding: UTF-8 Roxygen: list(markdown = TRUE) -RoxygenNote: 7.3.2 +RoxygenNote: 7.3.1 Suggests: testthat (>= 3.0.0), withr Config/testthat/edition: 3 -Imports: +Imports: AzureRMR, AzureStor, cli, diff --git a/NEWS.md b/NEWS.md index 250c6f66..341aec67 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,6 @@ # CFAEpiNow2Pipeline (development version) +* Updated, faster pre-commit checks * Azure Blob file download utilities * CI running on Ubuntu only & working pkgdown deploy to Github Pages * Initial R package with checks running in CI diff --git a/R/add.R b/R/add.R index ff856f47..e8ba5fac 100644 --- a/R/add.R +++ b/R/add.R @@ -1,5 +1,7 @@ #' A temp function #' +#' Adding some meaningless text to test rendering via PR command. +#' #' @param x A number #' @param y Another number #' @return Their sum diff --git a/README.md b/README.md index 5539c84a..c4c95d6c 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ ## Overview A lightweight wrapper around [{EpiNow2}](https://github.com/epiforecasts/EpiNow2) to add functionality for deployment in Azure Batch. -It holds some helper functions to interface with Azure services, convert input data to EpiNow2's expected input format, and save expected outputs. +It holds some helper functions to interface with Azure services, convert input data to EpiNow2's expected input format, and save expected outputs. It also adds metadata and logging. This package is meant to enhance the `{EpiNow2}` package to support deployment in CFA's computational environment. diff --git a/man/fetch_blob_container.Rd b/man/fetch_blob_container.Rd index 96307ed7..bcece11d 100644 --- a/man/fetch_blob_container.Rd +++ b/man/fetch_blob_container.Rd @@ -16,10 +16,10 @@ A Blob endpoint \description{ This \strong{impure} function depends on the environment variables: \itemize{ -\item TENANT_ID -\item SUBSCRIPTION -\item RESOURCE_GROUP -\item STORAGE_ACCOUNT +\item az_tenant_id +\item az_subscription_id +\item az_resource_group +\item az_storage_account } } \details{