|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Contributions are welcome, and they are greatly appreciated! |
| 4 | +Every little bit helps, and credit will always be given. |
| 5 | + |
| 6 | +## Environment setup |
| 7 | + |
| 8 | +Nothing easier! |
| 9 | + |
| 10 | +Fork and clone the repository, then: |
| 11 | + |
| 12 | +```bash |
| 13 | +cd mkdocs-autorefs |
| 14 | +make setup |
| 15 | +``` |
| 16 | + |
| 17 | +!!! note |
| 18 | + If it fails for some reason, |
| 19 | + you'll need to install |
| 20 | + [Poetry](https://github.com/python-poetry/poetry) |
| 21 | + manually. |
| 22 | + |
| 23 | + You can install it with: |
| 24 | + |
| 25 | + ```bash |
| 26 | + python3 -m pip install --user pipx |
| 27 | + pipx install poetry |
| 28 | + ``` |
| 29 | + |
| 30 | + Now you can try running `make setup` again, |
| 31 | + or simply `poetry install`. |
| 32 | + |
| 33 | +You now have the dependencies installed. |
| 34 | + |
| 35 | +Run `make help` to see all the available actions! |
| 36 | + |
| 37 | +## Tasks |
| 38 | + |
| 39 | +This project uses [duty](https://github.com/pawamoy/duty) to run tasks. |
| 40 | +A Makefile is also provided. The Makefile will try to run certain tasks |
| 41 | +on multiple Python versions. If for some reason you don't want to run the task |
| 42 | +on multiple Python versions, you can do one of the following: |
| 43 | + |
| 44 | +1. `export PYTHON_VERSIONS= `: this will run the task |
| 45 | + with only the current Python version |
| 46 | +2. run the task directly with `poetry run duty TASK`, |
| 47 | + or `duty TASK` if the environment was already activated |
| 48 | + through `poetry shell` |
| 49 | + |
| 50 | +The Makefile detects if the Poetry environment is activated, |
| 51 | +so `make` will work the same with the virtualenv activated or not. |
| 52 | + |
| 53 | +## Development |
| 54 | + |
| 55 | +As usual: |
| 56 | + |
| 57 | +1. create a new branch: `git checkout -b feature-or-bugfix-name` |
| 58 | +1. edit the code and/or the documentation |
| 59 | + |
| 60 | +If you updated the documentation or the project dependencies: |
| 61 | + |
| 62 | +1. run `make docs-regen` |
| 63 | +1. run `make docs-serve`, |
| 64 | + go to http://localhost:8000 and check that everything looks good |
| 65 | + |
| 66 | +**Before committing:** |
| 67 | + |
| 68 | +1. run `make format` to auto-format the code |
| 69 | +1. run `make check` to check everything (fix any warning) |
| 70 | +1. run `make test` to run the tests (fix any issue) |
| 71 | +1. follow our [commit message convention](#commit-message-convention) |
| 72 | + |
| 73 | +If you are unsure about how to fix or ignore a warning, |
| 74 | +just let the continuous integration fail, |
| 75 | +and we will help you during review. |
| 76 | + |
| 77 | +Don't bother updating the changelog, we will take care of this. |
| 78 | + |
| 79 | +## Commit message convention |
| 80 | + |
| 81 | +Commits messages must follow the |
| 82 | +[Angular style](https://gist.github.com/stephenparish/9941e89d80e2bc58a153#format-of-the-commit-message): |
| 83 | + |
| 84 | +``` |
| 85 | +<type>[(scope)]: Subject |
| 86 | +
|
| 87 | +[Body] |
| 88 | +``` |
| 89 | + |
| 90 | +Scope and body are optional. Type can be: |
| 91 | + |
| 92 | +- `build`: About packaging, building wheels, etc. |
| 93 | +- `chore`: About packaging or repo/files management. |
| 94 | +- `ci`: About Continuous Integration. |
| 95 | +- `docs`: About documentation. |
| 96 | +- `feat`: New feature. |
| 97 | +- `fix`: Bug fix. |
| 98 | +- `perf`: About performance. |
| 99 | +- `refactor`: Changes which are not features nor bug fixes. |
| 100 | +- `style`: A change in code style/format. |
| 101 | +- `tests`: About tests. |
| 102 | + |
| 103 | +**Subject (and body) must be valid Markdown.** |
| 104 | +If you write a body, please add issues references at the end: |
| 105 | + |
| 106 | +``` |
| 107 | +Body. |
| 108 | +
|
| 109 | +References: #10, #11. |
| 110 | +Fixes #15. |
| 111 | +``` |
| 112 | + |
| 113 | +## Pull requests guidelines |
| 114 | + |
| 115 | +Link to any related issue in the Pull Request message. |
| 116 | + |
| 117 | +During review, we recommend using fixups: |
| 118 | + |
| 119 | +```bash |
| 120 | +# SHA is the SHA of the commit you want to fix |
| 121 | +git commit --fixup=SHA |
| 122 | +``` |
| 123 | + |
| 124 | +Once all the changes are approved, you can squash your commits: |
| 125 | + |
| 126 | +```bash |
| 127 | +git rebase -i --autosquash master |
| 128 | +``` |
| 129 | + |
| 130 | +And force-push: |
| 131 | + |
| 132 | +```bash |
| 133 | +git push -f |
| 134 | +``` |
| 135 | + |
| 136 | +If this seems all too complicated, you can push or force-push each new commit, |
| 137 | +and we will squash them ourselves if needed, before merging. |
0 commit comments