|
1 |
| -# Contributing to OCamlFormat |
| 1 | +# OCamlFormat Contribution Guide |
2 | 2 |
|
3 |
| -## Reporting Issues |
| 3 | +Welcome and thank you for your interest in contributing to OCamlFormat. This contribution guide will help you through the contribution process. |
4 | 4 |
|
5 |
| -If you encounter a problem when using OCamlFormat or if you have any questions, please open a [GitHub issue](https://github.com/ocaml-ppx/ocamlformat/issues/). |
| 5 | +## Reporting Issues |
6 | 6 |
|
7 |
| -1. Check first if your issue has already been [reported](https://github.com/ocaml-ppx/ocamlformat/issues/). |
8 |
| -2. Include the version of OCamlFormat you are using (`ocamlformat --version`). |
9 |
| -3. Include a (preferably short) source file which demonstrates the issue. |
10 |
| -4. Describe the expected and actual behavior. |
11 |
| -5. Do not unsubscribe from the issue until it is closed, the maintainers may ask for your feedback. |
| 7 | +If you encounter an issue with OCamlFormat, or if you have inquiries, we encourage you to open a [GitHub issue](https://github.com/ocaml-ppx/ocamlformat/issues/). Please follow the steps below: |
12 | 8 |
|
13 |
| -When acknowledged, the project maintainers will add [labels](#ocamlformat-labels) to your issue throughout its lifespan. |
| 9 | +1. First, verify if your issue hasn't already been [reported](https://github.com/ocaml-ppx/ocamlformat/issues/). |
| 10 | +2. Specify the OCamlFormat version you're using (`ocamlformat --version`). |
| 11 | +3. Include a (preferably short) source file that replicates the issue. |
| 12 | +4. Clearly define the expected and actual behavior. |
| 13 | +5. Remain engaged with the issue until closure as your feedback might be needed. |
14 | 14 |
|
15 | 15 | ## Pull Requests
|
16 | 16 |
|
17 |
| -We actively welcome pull requests. |
| 17 | +We heartily welcome pull requests. To ensure an effective contribution, please adhere to the steps below: |
18 | 18 |
|
19 |
| -1. Prior to investing a large amount of time into significant or invasive changes, or those that affect the output, it is likely more efficient to first open an issue for discussion and planning. |
20 |
| -2. If you are not familiar with the project, focus first on the [Good first issues](https://github.com/ocaml-ppx/ocamlformat/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Good-first-issue+%3A%2B1%3A%22). |
| 19 | +1. For significant, invasive, or output-affecting changes, consider opening an issue for discussion before committing substantial time and effort. |
| 20 | +2. If you're new to the project, starting with the [Good first issues](https://github.com/ocaml-ppx/ocamlformat/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Good-first-issue+%3Agreen_heart%3A%22) can be beneficial. |
21 | 21 | 3. Fork the repository and create your branch from `main`.
|
22 |
| -4. If you have added code that should be tested, add tests (they should be located in the `tests/passing` directory). |
23 |
| -'. |
24 |
| -5. Ensure the test suite passes (see [Running the tests](#running-the-tests)). |
25 |
| - |
26 |
| -When acknowledged, the project maintainers will add [labels](#ocamlformat-labels) to your pull request throughout its lifespan. |
27 |
| - |
| 22 | +4. If you've added code that should be tested, supplement it with tests located in the `test/` directory. |
| 23 | +5. Ensure that the test suite passes (see [Running the tests](#running-the-tests) for instructions). |
28 | 24 |
|
29 |
| -### Running the tests |
| 25 | +### Running the Tests |
30 | 26 |
|
31 |
| -Once OCamlFormat has been built, run `make test` to check for regressions. |
| 27 | +After building OCamlFormat, execute `dune runtest` to check for any regressions. There should be no unexpected diffs. If there are, promote all the diffs with `dune promote`. |
32 | 28 |
|
33 |
| -The first step of `make test` is to ensure that invoking OCamlFormat on its own source code produces the same source code (you can run `make fixpoint` to only check this). If OCamlFormat is not integrated with the editor you use, you should run `make fmt` to reformat all OCamlFormat source files. |
| 29 | +Once the test suite passes, test your pull requests against code in external repositories by executing `tools/test_branch.sh`. If your pull request modifies an option, also run `tools/test_branch.sh "<option>=<value>"` to test with the option enabled. |
34 | 30 |
|
35 |
| -The second part of `make test` is to ensure the test suite passes. You should not see any unexpected diff. One can accept all diffs at once with `make regtests-promote`. |
| 31 | +The `tools/test_branch.sh` script compares two `ocamlformat` versions (the specified branch or `HEAD` if omitted, and its main merge base) on other project code and reports any formatting differences. Inspect any differences to make sure they are intentional. Differences in the formatted code with the option disabled should be summarised and explained in the pull request discussion. |
36 | 32 |
|
37 |
| -Once `make test` passes, pull requests should be tested on the code in a set of external repositories. This can be done by executing `tools/test_branch.sh <rev>` where `<rev>` is the git revision/branch containing the pull request's changes. If a pull request affects an option, `OCAMLFORMAT=<option>=<value> tools/test_branch.sh <rev>` should also be run to test with the option enabled. |
| 33 | +OCamlformat's own code must be formatted with the development version and not with the latest release. This can be done with `dune build @fmt`. |
38 | 34 |
|
39 |
| -The `tools/test_branch.sh` script runs two versions of `ocamlformat` (the specified branch, or `HEAD` if omitted, and its merge base with main) on the test code and reports the differences in the formatted code. Formatting failures may also be reported on the terminal, these will need to be fixed before a pull request can be merged. The differences should be inspected to ensure they are as intended. Pull requests changing the format of code should generally introduce an option to enable the alternate style (if in doubt, open an issue for discussion). Any differences in the formatted code with the option disabled should be summarized and explained in the pull request discussion. |
| 35 | +## Licensing |
40 | 36 |
|
41 |
| -To benefit from the autocompletion of git branch names in the `tools/test_branch.sh` script, if you use the `bash` shell, add the following line to your `~/.bashrc` file: |
42 |
| -``` |
43 |
| -source <path-to-ocamlformat>/tools/ocamlformat_test_branch |
44 |
| -``` |
45 |
| - |
46 |
| -If you use the `zsh` shell, add the following lines to your `~/.zshrc` file: |
47 |
| -``` |
48 |
| -autoload bashcompinit |
49 |
| -bashcompinit |
50 |
| -source <path-to-ocamlformat>/tools/ocamlformat_test_branch |
51 |
| -``` |
52 |
| - |
53 |
| -## License |
54 |
| - |
55 |
| -By contributing to OCamlFormat, you agree that your contributions will be licensed under the LICENSE file in the root directory of this source tree. |
| 37 | +By contributing to OCamlFormat, you accept that your contributions will fall under the LICENSE located in the root directory of this source tree. |
56 | 38 |
|
57 | 39 | ## OCamlFormat Labels
|
58 | 40 |
|
59 |
| -### Issue specific |
| 41 | +To better manage issues and pull requests, we use the following labels: |
| 42 | + |
| 43 | +### Issue-Specific Labels |
60 | 44 |
|
61 |
| -- [Good-first-issue](https://github.com/ocaml-ppx/ocamlformat/labels/Good-first-issue%20%3A%2B1%3A): This issue is a good entry point in the project for new contributors |
| 45 | +- [Good-first-issue](https://github.com/ocaml-ppx/ocamlformat/labels/Good-first-issue%20%3A%2B1%3A): Suitable for newcomers to the project |
62 | 46 |
|
63 |
| -### Kind |
| 47 | +### Kind Labels |
64 | 48 |
|
65 |
| -- [Kind/Bug](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FBug%20%3Ax%3A): This issue describes a problem or this contribution addresses a problem (erroneous/unintended behavior) |
66 |
| -- [Kind/Docs](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FDocs): This is related to a documentation change (user documentation or source code documentation) |
67 |
| -- [Kind/Feature-request](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FFeature-request): This issue or contribution proposes a new feature |
68 |
| -- [Kind/Style-suggestion](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FStyle%20suggestion): This issue or contribution proposes a style modification for the formatted output |
69 |
| -- [Kind/To-discuss](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FTo-discuss): Discussion needed to converge to a solution |
| 49 | +- [Kind/Bug](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2FBug%20%3Ax%3A): Represents a problem or solution to an erroneous/unintended behavior |
| 50 | +- [Kind/Docs](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2Fdocs): Pertains to changes in user or source code documentation |
| 51 | +- [Kind/Feature-request](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2Ffeature-request): Proposes a new feature |
| 52 | +- [Kind/Style-suggestion](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2Fstyle-suggestion): Suggests a modification for the formatted output |
| 53 | +- [Kind/To-discuss](https://github.com/ocaml-ppx/ocamlformat/labels/Kind%2Fto-discuss): Invites discussion to converge on a solution |
70 | 54 |
|
71 |
| -Feel free to contribute on the [Help wanted](https://github.com/ocaml-ppx/ocamlformat/labels/Help%20wanted%20%3Afire%3A) issues and pull requests. |
| 55 | +You're welcome to contribute to issues and pull requests marked as ["Help wanted"](https://github.com/ocaml-ppx/ocamlformat/labels/Help-wanted%20%3Awarning%3A), or any other issues. |
0 commit comments