Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- repo: https://github.com/Casyfill/codestyle
rev: '982233638ee63e70ff40999a1314ae7c9067aa13' # pick a git hash / tag to point to
hooks:
- id: catalyst-make-codestyle
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

### Added

-
- added `pre-commit` hook to run codestyle checker on commit ([#1257](https://github.com/catalyst-team/catalyst/pull/1257))

### Changed

Expand Down
23 changes: 19 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ It's much harder to merge in a large change with a lot of disjoint features.
3. Submit the update as a GitHub pull request against the `master` branch.
4. Make sure that you provide docstrings for all your new methods and classes.
5. Add new unit tests for your code ([PR examples](#pr-examples)).
6. Check the [codestyle](#codestyle)
6. (Optional) Check the [codestyle](#codestyle). We use a pre-commit hook that runs the formatting on commit, so you don't have to.
7. Make sure that your code [passes the Github CI](#github-ci)


Expand All @@ -115,15 +115,30 @@ Please use it as a collaborative platform, if you have any issues during the PR.
### Codestyle

We also have our own [catalyst-codestyle](https://github.com/catalyst-team/codestyle)
package to help with code formatting issues.
package to help with code formatting issues.

You could check the codestyle for your PR with:
You could check the codestyle manually for your PR with:

```bash
catalyst-make-codestyle && catalyst-check-codestyle
```

Once again, make sure that your python packages complied with `requirements/requirements.txt` and `requirements/requirements-dev.txt` to get codestyle run clean:
Alternatively, this repository has a pre-commit hook that checks and formats the code on commit, automatically. Instead of installing the `codestyle` and running it manually, you can run the pre-commit hook via CLI:
```bash
pre-commit run
```
Pre-commit will automatically run the formatting on commit, and halt the commit on any error. For more information, read the [pre-commit documentation](https://pre-commit.com/).

If for some reason you want to turn the hook off temporarily, you can do that with:
```bash
SKIP=catalyst-make-codestyle git commit -m "foo"
```
Or you can uninstall it completely (that will affect everyone on PR):
```bash
pre-commit uninstall
```

Once again, make sure that your python packages complied with `requirements/requirements.txt` and `requirements/requirements-dev.txt` to get codestyle and pre-commit run clean:
```bash
pip install -r requirements/requirements.txt -r requirements/requirements-dev.txt
```
Expand Down
1 change: 1 addition & 0 deletions requirements/requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ mock==3.0.5
catalyst-codestyle==21.03rc2
catalyst-sphinx-theme==1.1.2
toml==0.10.0
pre-commit==2.13.0