mirror of
https://github.com/jongracecox/anybadge.git
synced 2025-07-21 12:21:03 +02:00
Add pre-commit config and apply changes (#54)
- Add .pre-commit-config.yaml with initial config. - Add python black pre-commit config - Apply pre-commit code changes - Add information to CONTRIBUTING.md - Add pre-commit to build requirements - Run pre-commit during travis CI build - Use a travis build matrix to control when pre-commit runs in the CI process. Use explicit include to only run pre-commit on Python 3.9.
This commit is contained in:
@@ -8,7 +8,7 @@ I love your input! I want to make contributing to this project as easy and trans
|
||||
- Becoming a maintainer
|
||||
|
||||
## I use [Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow), so all code changes happen through pull requests
|
||||
Pull requests are the best way to propose changes to the codebase (I use
|
||||
Pull requests are the best way to propose changes to the codebase (I use
|
||||
[Github Flow](https://docs.github.com/en/get-started/quickstart/github-flow)). I actively welcome your pull requests:
|
||||
|
||||
1. Fork the repo and create your branch from `master`
|
||||
@@ -20,7 +20,7 @@ Pull requests are the best way to propose changes to the codebase (I use
|
||||
|
||||
## Any contributions you make will be under the MIT Software License
|
||||
When you submit code changes, your submissions are understood to be under the same
|
||||
[MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers
|
||||
[MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers
|
||||
if that's a concern.
|
||||
|
||||
## Report bugs using Github's [issues](https://github.com/jongracecox/anybadge/issues)
|
||||
@@ -48,6 +48,42 @@ By contributing, you agree that your contributions will be licensed under its MI
|
||||
|
||||
# Technical stuff
|
||||
|
||||
## Pre-commit
|
||||
This projects makes use of [pre-commit](https://pre-commit.com) to add some safety checks and create consistency
|
||||
in the project code. When committing changes to this project, please first [install pre-commit](https://pre-commit.com/#install),
|
||||
then activate it for this project:
|
||||
|
||||
```bash
|
||||
pip install pre-commit
|
||||
pre-commit install
|
||||
```
|
||||
|
||||
After installing pre-commit to your project (with `pre-commit install`), committing to the project will trigger a series
|
||||
of checks, and fixers. This process may reject your commit or make changes to your code to bring it into line with the
|
||||
project standards. For example, [Python black](https://github.com/psf/black) will be used to reformat any code. When
|
||||
changes are made by these pre-commit hooks you will need to re-add and commit those changes in order for pre-commit to
|
||||
pass.
|
||||
|
||||
Here is some example output from pre-commit:
|
||||
|
||||
```
|
||||
trim trailing whitespace.................................................Failed
|
||||
- hook id: trailing-whitespace
|
||||
- exit code: 1
|
||||
- files were modified by this hook
|
||||
|
||||
Fixing tests/test_anybadge.py
|
||||
|
||||
fix end of files.........................................................Failed
|
||||
- hook id: end-of-file-fixer
|
||||
- exit code: 1
|
||||
- files were modified by this hook
|
||||
|
||||
Fixing examples/color_teal.svg
|
||||
```
|
||||
|
||||
This shows that two files were updated by hooks, and need to be re-added (with `git add`) before trying to commit again.
|
||||
|
||||
## Documentation
|
||||
The `README.md` file contains a table showing example badges for the different built-in colors. If you modify the
|
||||
appearance of badges, or the available colors please update the table using the following code:
|
||||
|
Reference in New Issue
Block a user