Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
22 changes: 11 additions & 11 deletions Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ This repo follows the [Contributor Covenant](http://contributor-covenant.org/ver

This repo uses automated tools to standardize the formatting of code, text files and
commits.
- [Pre-commit hooks](#pre-commit-hooks) validate and automatically apply code
- [Pre-commit/prek hooks](#pre-commitprek-hooks) validate and automatically apply code
formatting rules.
- [gitlint](#gitlint) is used as a commit message hook to validate that
commit messages follow the convention.
Expand All @@ -28,19 +28,19 @@ Run these commands in each of your sandboxes to enable our pre-commit hooks and

```sh
pip install -e '.[dev]'
pre-commit install
prek install
gitlint install-hook
git submodule foreach 'pre-commit install'
git submodule foreach 'prek install'
git submodule foreach 'gitlint install-hook'
```

## Pre-commit hooks
## Pre-commit/prek hooks

The ReadAlong Studio team has agreed to systematically use a number of pre-commit hooks to
normalize formatting of code. You need to install and enable pre-commit to have these used
automatically when you do your own commits.
normalize formatting of code. You need to install and enable prek (fast replacement of pre-commit)
to have these used automatically when you do your own commits.

Pre-commit hooks enabled:
Pre-commit hooks we use:
- check-yaml validates YAML files
- end-of-file-fixer makes sure each text file ends with exactly one newline character
- trailing-whitespace removes superfluous whitespace at the end of lines in text files
Expand All @@ -58,15 +58,15 @@ Pre-commit hooks enabled:
### Enabling pre-commit hooks

All the pre-commit hooks are executed using a tool called
[pre-commit](https://pre-commit.com/). Once you enable pre-commit, it will run all the
[prek](https://prek.j178.dev/). Once you enable prek, it will run all the
hooks each time you try to commit anything in this repo.

The developer dependencies are listed in the dev extra in [pyproject.toml](pyproject.toml)
to make them easy to install:

```sh
pip install -e '.[dev]'
pre-commit install
prek install
```

Note that you have to run the second command in every sandbox you create, so please
Expand Down Expand Up @@ -142,13 +142,13 @@ gitlint install-hook

### Initializing submodules too

The EveryVoice repo uses submodules, and the gitlint and pre-commit
The EveryVoice repo uses submodules, and the gitlint and prek/pre-commit
initialization has to be done separately in each of one them. You can cd into
each submodule directory and run the same commands shown above, but there is a
shortcut:

```sh
git submodule foreach 'pre-commit install'
git submodule foreach 'prek install'
git submodule foreach 'gitlint install-hook'
```

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ Please make sure our standard Git hooks are activated, by running these commands

```sh
pip install -e '.[dev]'
pre-commit install
prek install
gitlint install-hook
git submodule foreach 'pre-commit install'
git submodule foreach 'prek install'
git submodule foreach 'gitlint install-hook'
```

Expand Down
4 changes: 2 additions & 2 deletions docs/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ Before you can run the test suites, you'll also need to install the dev dependen
If you plan to contribute to the project, please install our Git hooks:

```sh
pre-commit install
prek install
gitlint install-hook
git submodule foreach 'pre-commit install'
git submodule foreach 'prek install'
git submodule foreach 'gitlint install-hook'
```
2 changes: 1 addition & 1 deletion everyvoice/model/feature_prediction/FastSpeech2_lightning
2 changes: 1 addition & 1 deletion everyvoice/model/vocoder/HiFiGAN_iSTFT_lightning
6 changes: 3 additions & 3 deletions make-everyvoice-env
Original file line number Diff line number Diff line change
Expand Up @@ -246,8 +246,8 @@ echo "Environment creation completed with success"
echo ""
echo "Configuring your sandbox in case you want to contribute to the project."
if [[ ! -f .git/hooks/pre-commit ]]; then
if ! pre-commit install; then
echo "Error running \"pre-commit install\". Your \"$ENV2ACTIVATE\" environment is good, but if you want to submit contributions to the project, please rerun \"pre-commit install\" in your sandbox."
if ! prek install; then
echo "Error running \"prek install\". Your \"$ENV2ACTIVATE\" environment is good, but if you want to submit contributions to the project, please rerun \"prek install\" in your sandbox."
fi
fi
if [[ ! -f .git/hooks/commit-msg ]]; then
Expand All @@ -257,7 +257,7 @@ if [[ ! -f .git/hooks/commit-msg ]]; then
fi
fi
# Try to install pre-commit and gitlint hooks in the submodules but don't complain on failure
git submodule foreach 'test -f $(cat .git|cut -f2 -d" ")/hooks/pre-commit || pre-commit install || true' >& /dev/null || true
git submodule foreach 'test -f $(cat .git|cut -f2 -d" ")/hooks/pre-commit || prek install || true' >& /dev/null || true
git submodule foreach 'test -f $(cat .git|cut -f2 -d" ")/hooks/commit-msg || gitlint install-hook || true' >& /dev/null || true

echo ""
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ dev = [
"gitlint-core>=0.19.0",
"isort>=5.10.1",
"mypy>=1.8.0",
"pre-commit>=3.2.0",
"prek>=0.3",
"types-pyyaml>=6.0.5",
"types-requests>=2.27.11",
"types-setuptools>=57.4.9",
Expand Down
Loading