Skip to content

Commit

Permalink
ci: add pre-commit configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mehalter committed Oct 4, 2024
1 parent 9ada260 commit d90f0b3
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 8 deletions.
21 changes: 21 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: mixed-line-ending
- id: check-json
- id: check-yaml
- id: check-toml
- id: check-merge-conflict
- repo: https://github.com/psf/black
rev: 24.8.0
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
- repo: https://github.com/crate-ci/typos
rev: v1.24.6
hooks:
- id: typos
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
python 3.11
pre-commit 3
35 changes: 27 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,15 @@ If you navigate to the "Actions" tab at the top of the repository and go to the
the workflow then the script will calculate the appropriate version, create a
new tag, and create a new release in GitHub.

> [!NOTE]
> By default this is set up to follow a date based versioning schema. This is in
> the format of `YYYY.MM.DD`. If multiple versions are tagged on the same day
> then a revision number will be appended to the end such as `YYYY.MM.DD.1`.
> [!NOTE] By default this is set up to follow a date based versioning schema.
> This is in the format of `YYYY.MM.DD`. If multiple versions are tagged on the
> same day then a revision number will be appended to the end such as
> `YYYY.MM.DD.1`.
## Best Practices

### Development Tools

This repository comes bundled with the recommended CAPE practices such as type
checking and format checking. It is recommended to use the following tools to
make sure the tests pass:
Expand All @@ -46,8 +48,25 @@ make sure the tests pass:
properly check the types and validity of the code
- Use `black` and `isort` to format the code

> [!TIP]
> The repository comes with the necessary configuration for VS Code built in.
> When loading the project it may pop up to install recommended extensions. If
> you install all of them then the editor will configure itself to follow the
> [!TIP] The repository comes with the necessary configuration for VS Code built
> in. When loading the project it may pop up to install recommended extensions.
> If you install all of them then the editor will configure itself to follow the
> above practices.
### Commit Hooks

This repository comes bundled with a [pre-commit](https://pre-commit.com)
configuration file for making sure commits are well formed before being
committed. This is useful if you want to run some basic sanity checks before
sending the code out to GitHub and run it through the CI/CD. These are
configured to check if things like formatting are being followed or if there are
any typos.

These hooks are optional and rely on
[pre-commit being installed](https://pre-commit.com/#install). If pre-commit is
installed, then they can be enabled for a repository by running the following
command from the root of the repository:

```sh
pre-commit install
```

0 comments on commit d90f0b3

Please sign in to comment.