From b41c05852835a21e217ffd202c3a5da1dba43a00 Mon Sep 17 00:00:00 2001 From: Zachary Susswein Date: Tue, 17 Sep 2024 10:05:32 -0400 Subject: [PATCH] Use `.pre-commit.config.yaml` from main To fix weirdness with unicode parsing error from.....somewhere? --- .pre-commit-config.yaml | 95 +++++++++++++++++++---------------------- R/write_output.R | 6 ++- 2 files changed, 50 insertions(+), 51 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 195e121d..307d747e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,61 +5,56 @@ repos: - repo: https://github.com/lorenzwalthert/precommit rev: v0.4.3.9001 hooks: - - id: style-files - args: - [ - --style_pkg=styler, - --style_fun=tidyverse_style, - --cache-root=styler-perm, - ] - - id: use-tidy-description - - id: lintr - - id: readme-rmd-rendered - - id: parsable-R - - id: no-browser-statement - - id: no-print-statement + - id: style-files + args: [--style_pkg=styler, --style_fun=tidyverse_style, + --cache-root=styler-perm] + - 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 + - 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 - args: ["--maxkb=200"] - exclude: "tests/testthat/data/sample_fit.RDS" - - id: file-contents-sorter + - id: check-added-large-files + args: ['--maxkb=200'] + - id: file-contents-sorter files: '^\.Rbuildignore$' - - id: end-of-file-fixer + - id: end-of-file-fixer 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 + - 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: - # Only required when https://pre-commit.ci is used for config validation - - id: check-pre-commit-ci-config - - repo: local + # 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 + - 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 +##### +# Python +- repo: https://github.com/psf/black rev: 24.8.0 hooks: - # if you have ipython notebooks, consider using - # `black-jupyter` hook instead - - id: black - args: ["--line-length", "79"] - - repo: https://github.com/PyCQA/isort + # 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 @@ -89,16 +84,16 @@ repos: - repo: https://github.com/Yelp/detect-secrets rev: v1.5.0 hooks: - - id: detect-secrets - args: ["--baseline", ".secrets.baseline"] + - id: detect-secrets + args: ['--baseline', '.secrets.baseline'] exclude: package.lock.json ci: - autofix_commit_msg: | - [pre-commit.ci] auto fixes from pre-commit.com hooks + 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 - submodules: false + 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 + submodules: false diff --git a/R/write_output.R b/R/write_output.R index a2d56438..40ff2f6a 100644 --- a/R/write_output.R +++ b/R/write_output.R @@ -277,7 +277,11 @@ write_parquet <- function(data, path) { # ephemeral from a temporary in-memory DB. There's no actual database to # guard against a SQL injection attack and all the data are already available # here. - query <- paste0("COPY (SELECT * FROM df) TO '", path, "' (FORMAT PARQUET, CODEC 'zstd')") + query <- paste0( + "COPY (SELECT * FROM df) TO '", + path, + "' (FORMAT PARQUET, CODEC 'zstd')" + ) con <- DBI::dbConnect(duckdb::duckdb()) on.exit(expr = DBI::dbDisconnect(con))