If you're reading this you're probably interested in contributing to
bootstrapper
. First, I'd like to say: thank you! Projects like this one
live-and-die based on the support they receive from others, and the fact that
you're even considering supporting bootstrapper
is incredibly generous
of you.
This document lays out guidelines and advice for contributing to
bootstrapper
. If you're thinking of contributing, start by reading this
thoroughly and getting a feel for how contributing to the project works. If
you've still got questions after reading this, you should go ahead and
contact Patrick (on Twitter, or via
email)
The guide is split into sections based on the type of contribution you're thinking of making, with a section that covers general guidelines for all contributors.
bootstrapper
has one very important guideline governing all forms of
contribution, including things like reporting bugs or requesting features.
The guideline is be cordial or be on your
way. All
contributions are welcome, but they come with an implicit social contract:
everyone must be treated with respect.
This can be a difficult area to judge, so the maintainer will enforce the following policy. If any contributor acts rudely or aggressively towards any other contributor, regardless of whether they perceive themselves to be acting in retaliation for an earlier breach of this guideline, they will be subject to the following steps:
- They must apologise. This apology must be genuine in nature: "I'm sorry you were offended" is not sufficient. The judgement of 'genuine' is at the discretion of the maintainer.
- If the apology is not offered, any outstanding and future contributions from the violating contributor will be rejected immediately.
Everyone involved in the bootstrapper
project, the maintainer included,
is bound by this policy. Failing to abide by it leads to the offender being
kicked off the project.
If you are contributing, do not feel the need to sit on your contribution until it is perfectly polished and complete. It helps everyone involved for you to seek feedback as early as you possibly can. Submitting an early, unfinished version of your contribution for feedback in no way prejudices your chances of getting that contribution accepted, and can save you from putting a lot of work into a contribution that is not suitable for the project.
The project maintainer has the last word on whether or not a contribution is
suitable for bootstrapper
. All contributions will be considered, but from
time to time contributions will be rejected because they do not suit the
project.
If your contribution is rejected, don't despair! So long as you followed these guidelines, you'll have a much better chance of getting your next contribution accepted.
When contributing code, you'll want to follow this checklist:
- Fork the repository on GitHub
- Create yourself a new feature branch for your new feature, branching from
the
develop
branch. There's no naming convention that you need to follow, but the name should be descriptive (if you're adding dropups to the Button class, a branch name like "dropup-buttons" would be appropriate). Then runcomposer install
. - Run the tests to confirm they all pass on your system. If they don't, you'll need to investigate why they fail. If you're unable to diagnose this yourself, contact Patrick.
- Write tests that demonstrate your bug or feature. Ensure that they fail.
- Make your change.
- Run the entire test suite again, confirming that all tests pass including the ones you just added.
- Send a GitHub Pull Request to the main repository's
develop
branch. GitHub Pull Requests are the expected method of code collaboration on this project. If you object to the GitHub workflow, you may mail a patch to the maintainer.
The following sub-sections go into more detail on some of the points above.
bootstrapper
has a substantial suite of tests. Whenever you contribute, you
must write tests that exercise your contributed code, and you must not regress
the code coverage. We use phpspec
for our tests, which is installed with
Bootstrapper.
If you've done this but want to get contributing right away, you can take
advantage of the fact that bootstrapper
uses a continuous integration
system. This will automatically run the tests against any pull request raised
against the main bootstrapper
repository.
Before a contribution is merged it must have a green run through the CI system.
Contributions that do not follow this may still be merged, but will invariably take much longer to do so
Contributions will not be merged until they've been code reviewed. You should implement any code review feedback unless you strongly object to it. In the event that you object to the code review feedback, you should make your case clearly and calmly. If, after doing so, the feedback is judged to still apply, you must either apply the feedback or withdraw your contribution.
The following aren't all necessarily hard and fast rules, but following these guidelines will certainly be helpful.
- Follow PSR-2 for your code. The quick rundown - use
camelCase
for your method names,UpperCamelCase
for your class names, indent with 4 spaces. Most editors have some way of reformatting your code to follow these rules. - Most public methods should be chainable (ie, return
$this
) - New public method names should be chosen to be, for want of a better phrase, "human speakable". Most people will be using Bootstrapper just in their views, and should be able to read off a chained method call to someone with them knowing exactly what the result will be.
- Methods should try to be no longer than 30 lines. This is usually enough to fit into the most people's editor window, and means that anyone can skim read the method and know what it does.
Documentation improvements are always welcome! The documentation files live in the Bootstrapper Docs repository and are written using Laravel.
Bug reports are hugely important! Before you raise one, though, please check through the GitHub issues, both open and closed, to confirm that the bug hasn't been reported before. Duplicate bug reports are a huge drain on the time of other contributors, and should be avoided as much as possible.
Feature requests are always welcome, but please note that all the general guidelines for contribution apply. Also note that the importance of a feature request without an associated Pull Request is always lower than the importance of one with an associated Pull Request: code is more valuable than ideas.