Skip to content

Commit f039ca8

Browse files
committed
Merge pull request #300 from dunglas/contributing
Add a CONTRIBUTING.md file
2 parents fa45196 + 9378a5c commit f039ca8

File tree

1 file changed

+104
-0
lines changed

1 file changed

+104
-0
lines changed

CONTRIBUTING.md

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
# Contributing to API Platform
2+
3+
First of all, thank you for contributing, you're awesome!
4+
5+
To have your code integrated in the API Platform project, there is some rules to follow, but don't panic, it's easy!
6+
7+
## Reporting bugs
8+
9+
If you happen to find a bug, we kindly request you to report it. However, before submitting it, please:
10+
11+
* Check the [project documentation available online](https://api-platform.com/doc/)
12+
13+
Then, if it appears that it's a real bug, you may report it using Github by following these 3 points:
14+
15+
* Check if the bug is not already reported!
16+
* A clear title to resume the issue
17+
* A description of the workflow needed to reproduce the bug,
18+
19+
> _NOTE:_ Don’t hesitate giving as much information as you can (OS, PHP version extensions...)
20+
21+
## Pull requests
22+
23+
### Writing a Pull Request
24+
25+
First of all, you must decide on what branch your changes will be based. If the changes your are going to make are
26+
fully backward-compatible, you should base your changes on the latest stable branch (`1.0` at the moment).
27+
Otherwise, you should base your changes on the `master` branch.
28+
29+
### Matching coding standards
30+
31+
The API Platform project follows [Symfony coding standards](https://symfony.com/doc/current/contributing/code/standards.html).
32+
But don't worry, you can fix CS issues automatically using the [PHP CS Fixer](http://cs.sensiolabs.org/) tool
33+
34+
```bash
35+
php-cs-fixer.phar fix
36+
```
37+
38+
And then, add fixed file to your commit before push.
39+
Be sure to add only **your modified files**. If another files are fixed by cs tools, just revert it before commit.
40+
41+
### Sending a Pull Request
42+
43+
When you send a PR, just make sure that:
44+
45+
* You add valid test cases (Behat and PHPUnit).
46+
* Tests are green.
47+
* You make a PR on the related documentation in the [api-platform/doc](https://github.com/api-platform/doc) repository.
48+
* You make the PR on the same branch you based your changes on. If you see commits
49+
that you did not make in your PR, you're doing it wrong.
50+
* Also don't forget to add a comment when you update a PR with a ping to the maintainer (`@dunglas`, `@sroze` or `@theofidry`), so he/she will get a notification.
51+
* Squash your commits into one commit. (see the next chapter)
52+
53+
All Pull Requests must include the following header:
54+
55+
```markdown
56+
| Q | A
57+
| ------------- | ---
58+
| Bug fix? | yes/no
59+
| New feature? | yes/no
60+
| BC breaks? | no
61+
| Deprecations? | no
62+
| Tests pass? | yes
63+
| Fixed tickets | #1234, #5678
64+
| License | MIT
65+
| Doc PR | api-platform/doc#1234
66+
```
67+
68+
## Squash your commits
69+
70+
If you have 3 commits. So start with:
71+
72+
```bash
73+
git rebase -i HEAD~3
74+
```
75+
76+
An editor will be opened with your 3 commits, all prefixed by `pick`.
77+
78+
Replace all `pick` prefixes by `fixup` (or `f`) **except the first commit** of the list.
79+
80+
Save and quit the editor.
81+
82+
After that, all your commits where squashed into the first one and the commit message of the first commit.
83+
84+
If you would like to rename your commit message type:
85+
86+
```bash
87+
git commit --amend
88+
```
89+
90+
Now force push to update your PR:
91+
92+
```bash
93+
git push --force
94+
```
95+
96+
# License and copyright attribution
97+
98+
When you open a Pull Request to the API Platform project, you agree to license your code under the [MIT license](LICENSE)
99+
and to transfer the copyright on the submitted code to Kévin Dunglas.
100+
101+
Be sure to you have the right to do that (if you are a professional, ask your company)!
102+
103+
If you include code from another project, please mention it in the Pull Request description and credit the original author.
104+

0 commit comments

Comments
 (0)