Skip to content

Commit

Permalink
More permissive hooks and mamba (#166)
Browse files Browse the repository at this point in the history
* Remove heavy R pre-commit hook

* Replace conda by mamba where appropriate.

* Make ruff list more lenient / useful.

* [pre-commit.ci] pre-commit autoupdate (#165)

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
hmgaudecker and pre-commit-ci[bot] authored Oct 11, 2024
1 parent 2b12953 commit 02fb4dc
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 59 deletions.
45 changes: 2 additions & 43 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ repos:
hooks:
- id: yamlfix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: check-added-large-files
args: [--maxkb=25]
Expand All @@ -37,7 +37,7 @@ repos:
hooks:
- id: yamllint
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.8
rev: v0.6.9
hooks:
# Run the linter.
- id: ruff
Expand Down Expand Up @@ -72,47 +72,6 @@ repos:
rev: v2.3.0
hooks:
- id: codespell

# R specific hooks: https://github.com/lorenzwalthert/precommit
- repo: https://github.com/lorenzwalthert/precommit
rev: v0.4.3.9001
hooks:
- id: style-files
args: [--style_pkg=styler, --style_fun=tidyverse_style]
- id: spell-check
exclude: >
(?x)^(
.*\.[rR]|
.*\.feather|
.*\.jpeg|
.*\.pdf|
.*\.png|
.*\.py|
.*\.RData|
.*\.rds|
.*\.Rds|
.*\.Rproj|
.*\.sh|
(.*/|)\.gitignore|
(.*/|)\.gitlab-ci\.yml|
(.*/|)\.lintr|
(.*/|)\.pre-commit-.*|
(.*/|)\.Rbuildignore|
(.*/|)\.Renviron|
(.*/|)\.Rprofile|
(.*/|)\.travis\.yml|
(.*/|)appveyor\.yml|
(.*/|)NAMESPACE|
(.*/|)renv/settings\.dcf|
(.*/|)renv\.lock|
(.*/|)WORDLIST|
\.github/workflows/.*|
data/.*|
)$
- id: readme-rmd-rendered
- id: parsable-R
- id: no-browser-statement
- id: no-debug-statement
- repo: local
hooks:
- id: forbid-to-commit
Expand Down
6 changes: 3 additions & 3 deletions docs_template/scripts/task_create_visualization_for_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
for case in ("model_steps_full", "model_steps_select", "steps_only_full"):

@pytask.task(id=case)
def task_visualize_organisational_steps( # noqa: D103
def task_visualize_organisational_steps(
case=case,
produces=FIGURES / f"{case}.png",
):
Expand All @@ -25,7 +25,7 @@ def task_visualize_organisational_steps( # noqa: D103
for tex_file in ("root_bld_src", "src"):

@pytask.task(id=tex_file)
def task_compile_latex( # noqa: D103
def task_compile_latex(
depends_on=DOCS_SCRIPTS / "latex" / f"{tex_file}.tex",
produces=DOCS_SCRIPTS / "latex" / f"{tex_file}.png",
):
Expand All @@ -43,7 +43,7 @@ def task_compile_latex( # noqa: D103
time.sleep(1)

@pytask.task(id=tex_file)
def task_copy_png_to_figures( # noqa: D103
def task_copy_png_to_figures(
depends_on=DOCS_SCRIPTS / "latex" / f"{tex_file}.png",
produces=FIGURES / f"{tex_file}.png",
):
Expand Down
4 changes: 2 additions & 2 deletions docs_template/source/development/how-to-contribute.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,15 @@ for some immediate and clearly defined tasks.
repo):

```console
$ conda env create -f environment.yml
$ mamba env create -f environment.yml
$ conda activate template_project
```

1. In case you work on the documentation, you also have to install and activate the
documentation environment:

```console
$ conda env create -f docs_template/rtd_environment.yml
$ mamba env create -f docs_template/rtd_environment.yml
$ conda activate ept-docs
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ attributed to changes you make rather than the original template.

```console
$ cd /to/root/of/template_project
$ conda env create
$ mamba env create
```

1. Activate the installed environment
Expand Down
2 changes: 1 addition & 1 deletion docs_template/source/getting_started/second_machine.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Powershell on Windows. Then type
```console
$ git clone <url_of_your_repository>
$ cd <name_of_your_project>
$ conda env create -f environment.yml
$ mamba env create -f environment.yml
$ conda activate <conda_environment_name>
$ pre-commit install
```
Expand Down
2 changes: 1 addition & 1 deletion docs_template/source/getting_started/template_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ changes you make rather than the original template.

```console
$ cd /to/root/of/template
$ conda env create -f environment.yml
$ mamba env create -f environment.yml
```

1. Activate the installed environment
Expand Down
2 changes: 1 addition & 1 deletion docs_template/source/guides_explanations/environments.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ If you want to add a package to your environment, add it to the environment.yml
Once you have edited the environment.yml file, run

```console
$ conda env update -f environment.yml
$ mamba env update -f environment.yml
```

**Choosing between conda and pip**
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,15 @@ fix = true
[tool.ruff.lint]
select = ["ALL"]
extend-ignore = [
"S101", # Use of `assert` detected.
"ANN", # Missing type annotations
"D100", # Missing docstring in public module
"D104", # Missing docstring in public package (__init__.py files)
"S301", # pickle module is unsafe
"COM812", # Conflict with ruff-format
"D10", # Missing docstrings
"ISC001", # Conflict with ruff-format
"PD901", # df is a great name with functional data management
"PLR0913", # Too many arguments in function definition
# ignore because conflict with ruff-format
"COM812",
"ISC001",
"RET504", # Don't force to calculate upon return
"S101", # Use of `assert` detected.
"S301", # pickle module is unsafe
]

[tool.ruff.lint.per-file-ignores]
Expand Down

0 comments on commit 02fb4dc

Please sign in to comment.