Skip to content

Commit d30d824

Browse files
committed
Add "CONTRIBUTING.md"
1 parent c1d0d50 commit d30d824

2 files changed

Lines changed: 46 additions & 68 deletions

File tree

CONTRIBUTING.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Contributing
2+
3+
To ensure a smooth and effective collaboration, kindly follow the guidelines below.
4+
5+
## Raising issues
6+
7+
* **Open an issue first** - before working on a change, create an issue to discuss it.
8+
* **Example issue title** - `Error when running the route`
9+
10+
> [!NOTE]
11+
> This prevents duplicated work and ensures the change aligns with the project's goals.
12+
13+
## Pull requests
14+
15+
- **Reference the issue** - create a pull request (PR) once the issue is approved.
16+
- **Keep it focused** - each PR should address only one issue.
17+
18+
> [!NOTE]
19+
> A PR title must reference the issue number (e.g., `#1 - Fix for running the route`).
20+
21+
## Workflow
22+
23+
Code must adhere to the project's standards before submitting.
24+
25+
* **Automated tests** - new features and bug fixes must include `phpunit` tests.
26+
```bash
27+
$ composer test
28+
```
29+
30+
* **Code quality** - check for potential bugs and errors with `phpstan`.
31+
```bash
32+
$ composer analyze
33+
```
34+
35+
* **Coding style** - automatically format code with `php-cs-fixer`.
36+
```bash
37+
$ composer restyle
38+
```
39+
40+
> [!NOTE]
41+
> Bug fixes should add a test that fails without the fix.

README.md

Lines changed: 5 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -441,77 +441,13 @@ interface WithPayload
441441
}
442442
```
443443

444-
## Testing
444+
## Change log
445445

446-
If there is a need to check the source code of `Authsum` for development purposes (e.g., creating fixes, new features, etc.), kindly clone this repository first to a local machine:
446+
Please see [CHANGELOG][link-changelog] for more recent changes.
447447

448-
``` bash
449-
$ git clone https://github.com/rougin/authsum.git "Sample"
450-
```
451-
452-
After cloning, use `Composer` to install its required packages:
453-
454-
``` bash
455-
$ cd Sample
456-
$ composer update
457-
```
458-
459-
> [!NOTE]
460-
> Please see also the [build.yml](https://github.com/rougin/authsum/blob/master/.github/workflows/build.yml) of `Authsum` to check any packages that needs to be installed based on the PHP version.
461-
462-
Once the required packages were installed, kindly check the following below on how to maintain the code quality and styling guide when interacting the source code of `Authsum`:
463-
464-
### Unit tests
465-
466-
`Authsum` also contains unit tests that were written in [PHPUnit](https://phpunit.de/index.html):
467-
468-
``` bash
469-
$ composer test
470-
```
471-
472-
When creating fixes or implementing new features, it is recommended to run the above command to always check if the updated code introduces errors during development.
473-
474-
### Code quality
475-
476-
To retain the code quality of `Authsum`, a static code analysis code tool named [PHPStan](https://phpstan.org/) is being used during development. To start, kindly install the specified package in the global environment of `Composer`:
477-
478-
``` bash
479-
$ composer global require phpstan/phpstan --dev
480-
```
481-
482-
Once installed, `PHPStan` can now be run using its namesake command:
483-
484-
``` bash
485-
$ cd Sample
486-
$ phpstan
487-
```
488-
489-
> [!NOTE]
490-
> When running `phpstan`, it will use the `phpstan.neon` file which is already provided by `Authsum`.
491-
492-
### Coding style
493-
494-
Aside from code quality, `Authsum` also uses a tool named [PHP Coding Standards Fixer](https://cs.symfony.com/) for maintaining an opinionated style guide. To use this tooling, it needs also to be installed in the `Composer`'s global environment first:
495-
496-
``` bash
497-
$ composer global require friendsofphp/php-cs-fixer --dev
498-
```
499-
500-
After its installation, kindly use the `php-cs-fixer` command in the same `Authsum` directory:
501-
502-
``` bash
503-
$ cd Sample
504-
$ php-cs-fixer fix --config=phpstyle.php
505-
```
506-
507-
The `phpstyle.php` file provided by `Authsum` currently follows the [PSR-12](https://www.php-fig.org/psr/psr-12/) standard as its baseline for the coding style and uses [Allman](https://en.wikipedia.org/wiki/Indentation_style#Allman_style) as its indentation style.
508-
509-
> [!NOTE]
510-
> Installing both `PHPStan` and `PHP Coding Standards Fixer` requires a minimum version of PHP at least `7.4`.
511-
512-
## Changelog
448+
## Contributing
513449

514-
Please see [CHANGELOG][link-changelog] for more information what has changed recently.
450+
See [CONTRIBUTING][link-contributing] on how to contribute.
515451

516452
## License
517453

@@ -525,6 +461,7 @@ The MIT License (MIT). Please see [LICENSE][link-license] for more information.
525461

526462
[link-build]: https://github.com/rougin/authsum/actions
527463
[link-changelog]: https://github.com/rougin/authsum/blob/master/CHANGELOG.md
464+
[link-contributing]: https://github.com/rougin/authsum/blob/master/CONTRIBUTING.md
528465
[link-contributors]: https://github.com/rougin/authsum/contributors
529466
[link-coverage]: https://app.codecov.io/gh/rougin/authsum
530467
[link-downloads]: https://packagist.org/packages/rougin/authsum

0 commit comments

Comments
 (0)