|
| 1 | +# Contributing |
| 2 | + |
| 3 | +If you're interested in contributing to this project by submitting bug reports, helping to improve the documentation, or writing actual code, please read on. |
| 4 | + |
| 5 | +##### Table of Contents |
| 6 | + |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Submitting Issues](#submitting-issues) |
| 9 | + - [Got a Question or Problem?](#got-a-question-or-problem) |
| 10 | + - [Found a Bug?](#found-a-bug) |
| 11 | + - [Want a Feature?](#want-a-feature) |
| 12 | +- [Contributing to Development](#contributing-to-development) |
| 13 | + - [Getting Set Up](#getting-set-up) |
| 14 | + - [Coding Style](#coding-style) |
| 15 | + - [Testing](#testing) |
| 16 | + - [Generating Documentation](#generating-documentation) |
| 17 | + - [Generating a Changelog](#generating-a-changelog) |
| 18 | + |
| 19 | + |
| 20 | +## Code of Conduct |
| 21 | + |
| 22 | +Please note that this project has a [Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project, you agree to abide by its terms. |
| 23 | + |
| 24 | + |
| 25 | +## Submitting Issues |
| 26 | + |
| 27 | +When you're considering [submitting an issue to our GitHub repository](https://github.com/nprdm/npr-one-backend-proxy-php/issues/new), please consider the following guidelines: |
| 28 | + |
| 29 | +### Got a Question or Problem? |
| 30 | + |
| 31 | +If you have questions about how to use this package, we would generally prefer that you [contact us via e-mail](mailto:NPROneEnterprise@npr.org) rather than opening a ticket. That said, if you have constructive feedback for how we can make this package better by improving the documentation, by all means, [submit an issue](https://github.com/nprdm/npr-one-backend-proxy-php/issues/new). Please be detailed about your specific pain points, so that we're clear on what aspects of the documentation should be improved. |
| 32 | + |
| 33 | +### Found a Bug? |
| 34 | + |
| 35 | +If you find a bug in the source code or a mistake in the documentation, you can help us by [submitting an issue to our GitHub repository](https://github.com/nprdm/npr-one-backend-proxy-php/issues/new). Even better, you can submit a pull request with a fix. (Please read and follow our [Development Guidelines](#contributing-to-development) before submitting your PR.) |
| 36 | + |
| 37 | +### Want a Feature? |
| 38 | + |
| 39 | +You can request a new feature by [submitting an issue to our GitHub repository](https://github.com/nprdm/npr-one-backend-proxy-php/issues/new). Even if the feature is small and you are able to submit a pull request to implement it yourself, we would prefer to discuss it in the comments on the issue before you run off and write the code. Because this package is largely intended to function as an educational tool and documentation companion, we are trying to keep the codebase as simple and clear as possible, and not all new feature requests will be accepted. That said, you are always welcome to maintain a fork of our repository that has the additional features that you need. |
| 40 | + |
| 41 | + |
| 42 | +## Contributing to Development |
| 43 | + |
| 44 | +If you would like to contribute to the development of this project, here is the additional information you need: |
| 45 | + |
| 46 | +### Getting Set Up |
| 47 | + |
| 48 | +This project uses [Composer](https://getcomposer.org/) and includes a composer.phar for convenience under `/bin`. |
| 49 | + |
| 50 | +- `bin/composer.phar install`: install all dependencies |
| 51 | + |
| 52 | +Additionally, we highly recommend doing your development with [Xdebug enabled](https://xdebug.org/docs/install), to allow you to take advantage of various features, such as automatic code coverage measurement. |
| 53 | + |
| 54 | +### Coding Style |
| 55 | + |
| 56 | +We follow the [PSR-1](http://www.php-fig.org/psr/psr-1/) basic coding standards and [PSR-2](http://www.php-fig.org/psr/psr-2/) coding style guide, with the following addenda, exceptions, and clarifications: |
| 57 | + |
| 58 | +* All variables/property names should be in `$camelCase` only. |
| 59 | +* We put all opening curly braces on their own separate line, even for control structures. |
| 60 | +* We prefer `else if` to `elseif`. |
| 61 | +* We do not enforce any soft limit on line length (but expect developers to practice common sense here). |
| 62 | + |
| 63 | +Pull requests not conforming to our coding style may be asked to be updated before they are merged. |
| 64 | + |
| 65 | +### Testing |
| 66 | + |
| 67 | +This project includes tests which can be executed with PHPUnit. |
| 68 | + |
| 69 | +- `./vendor/bin/phpunit`: runs all unit tests |
| 70 | + |
| 71 | +PHPUnit is configured to generate coverage reports in a `coverage` folder under `test-results` in the root of the project. Overall test coverage can viewed by opening `test-results/coverage/index.html`. (N.B. These coverage reports are purposely excluded from source control.) Note that [Xdebug must be enabled](https://xdebug.org/docs/install) in order for code coverage to be generated. |
| 72 | + |
| 73 | +XML files are also generated for reporting test results and coverage on a CI server; again, those can be found under `test-results`. |
| 74 | + |
| 75 | +### Generating Documentation |
| 76 | + |
| 77 | +We are using [phpDocumentor](http://www.phpdoc.org) paired with the [phpdoc-md](https://github.com/evert/phpdoc-md) plugin to generate documentation in Markdown based on the contents of our PHPDoc blocks. To generate or update the documentation, use: |
| 78 | + |
| 79 | +``` |
| 80 | +./vendor/bin/phpdoc |
| 81 | +./vendor/bin/phpdocmd docs/structure.xml docs --index README.md |
| 82 | +``` |
| 83 | + |
| 84 | +### Generating a Changelog |
| 85 | + |
| 86 | +This will generally only ever be done by a maintainer from within NPR, but just in case: We're using the [phly/changelog-generator](https://github.com/weierophinney/changelog_generator) package, and the CLI command is: |
| 87 | + |
| 88 | +``` |
| 89 | +vendor/bin/changelog_generator.php -t githubAPItoken -u nprdm -r npr-one-backend-proxy-php -m 1 > CHANGELOG.md |
| 90 | +``` |
0 commit comments