From 2e2ccf393e5ba6c6a7e17964f0c315f1bb878855 Mon Sep 17 00:00:00 2001 From: Jon Calder Date: Mon, 12 Aug 2019 23:15:32 +0200 Subject: [PATCH 1/2] Add config for pre-commit hooks and update README --- .pre-commit-config.yaml | 7 +++++++ README.md | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..ff9cfa07 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,7 @@ +repos: +- repo: https://github.com/lorenzwalthert/pre-commit-hooks + rev: v0.0.0.9015 + hooks: + - id: style-files + - id: parsable-R + \ No newline at end of file diff --git a/README.md b/README.md index 434e84ca..3e7dc6d8 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,8 @@ To fix a bug you should [create a pull request from a fork](https://help.github. ### Development dependencies You'll need to have a recent version of [R](https://cran.r-project.org/) installed on your system, as well as the `testthat` package (run `install.packages('testthat')` from the R console to install) in order to run tests. +Optionally, you may also want to install [pre-commit](https://pre-commit.com/) in order to make use of the suggested pre-commit hooks (these will assist with automated code style checks etc). See the [Style Guide](#style-guide) for more info. + ### Example solution The example solution doesn't have to be perfect, but should pass all of the tests and ideally also strive for a healthy balance of human readability and computational efficiency. @@ -135,6 +137,12 @@ Note however that at the moment only the following linting rules are strictly en To perform these specific checks locally, run `source("bin/run_lints.R")`. +We also recommend using [styler](https://github.com/r-lib/styler). You can have styler run automatically (when making code commits) by making use of a [pre-commit](https://pre-commit.com) hook. + +Simply follow the installation instructions available [here](https://pre-commit.com/#install) +and then from the terminal run `pre-commit install` in your repo. The hooks defined in `.pre-commit-config.yaml` will then run automatically on any subsequent commits. This should help deal with most of the linting requirements. + +You can run `pre-commit autoupdate` occassionally to update the hook revisions. ## R icon The R logo was created by [Hadley Wickham](https://github.com/hadley) and others at [RStudio](https://www.rstudio.com/). The original file is licensed under version [4.0 of the Creative Commons Attribution-Share Alike license](https://creativecommons.org/licenses/by-sa/4.0/). We have adapted it, changing the colour scheme, for use on Exercism. From 5b811eaf7b9a1295a07e10f4bcd65f2ec216e483 Mon Sep 17 00:00:00 2001 From: Katrin Leinweber <9948149+katrinleinweber@users.noreply.github.com> Date: Tue, 13 Aug 2019 09:33:59 +0200 Subject: [PATCH 2/2] Fix typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3e7dc6d8..e3f6150d 100644 --- a/README.md +++ b/README.md @@ -142,7 +142,7 @@ We also recommend using [styler](https://github.com/r-lib/styler). You can have Simply follow the installation instructions available [here](https://pre-commit.com/#install) and then from the terminal run `pre-commit install` in your repo. The hooks defined in `.pre-commit-config.yaml` will then run automatically on any subsequent commits. This should help deal with most of the linting requirements. -You can run `pre-commit autoupdate` occassionally to update the hook revisions. +You can run `pre-commit autoupdate` occasionally to update the hook revisions. ## R icon The R logo was created by [Hadley Wickham](https://github.com/hadley) and others at [RStudio](https://www.rstudio.com/). The original file is licensed under version [4.0 of the Creative Commons Attribution-Share Alike license](https://creativecommons.org/licenses/by-sa/4.0/). We have adapted it, changing the colour scheme, for use on Exercism.