Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: update README #271

Merged
merged 1 commit into from
May 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 42 additions & 28 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,30 @@

Wrapper with pre-defined rules around the [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) package — A tool to automatically fix PHP Coding Standards issues.

This repository aims to provide a standardized way to apply coding standards across multiple projects, ensuring consistency and adherence to best practices.

By using predefined rulesets, it simplifies the setup process and allows teams to quickly integrate PHP-CS-Fixer into their development workflow.
This repository aims to provide a standardized way to apply coding standards across multiple projects, ensuring consistency and adherence to best practices. By using predefined rulesets, it simplifies the setup process and allows teams to quickly integrate PHP-CS-Fixer into their development workflow.

<br>

If you **like/use** this package, please consider ⭐️ **starring** it. Thanks!

<br>

## 📜 Custom Rulesets

**```WayOfDev\PhpCsFixer\Config\RuleSets\DefaultRuleset::class```**

Based on **`@Symfony`** ruleset

* Used by [`@wayofdev`](https://github.com/wayofdev) organization

**`WayOfDev\PhpCsFixer\Config\RuleSets\ExtendedPERSet::class`**

Based on **`@PER-CS2.0`** ruleset

* Used by [`@buggregator`](https://github.com/buggregator) and [`@cycle`](http://github.com/cycle) organizations

Comment on lines +38 to +51
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The DefaultRuleset class was not found in the codebase, while the ExtendedPERSet class was located and its implementation details were partially retrieved.

  • DefaultRuleset class not found.
  • ExtendedPERSet class found in src/RuleSets/ExtendedPERSet.php.

Please verify the existence and correct implementation of the DefaultRuleset class or update the README.md accordingly.

Analysis chain

Verify the accuracy of the new custom rulesets and their descriptions.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the existence and correct implementation of the new custom rulesets.

# Test: Search for the ruleset classes in the codebase. Expect: Definitions of the classes.
rg --type php $'class DefaultRuleset' && rg --type php $'class ExtendedPERSet'

Length of output: 38



Script:

#!/bin/bash
# Description: Verify the existence and correct implementation of the new custom rulesets.

# Test: Search for the ruleset classes in the codebase. Expect: Definitions of the classes.
rg --type php 'class DefaultRuleset' || echo "DefaultRuleset class not found"
rg --type php 'class ExtendedPERSet' || echo "ExtendedPERSet class not found"

# If classes are found, display their file paths and a few lines of context around their definitions.
rg --type php 'class DefaultRuleset' -A 5 -B 5
rg --type php 'class ExtendedPERSet' -A 5 -B 5

Length of output: 1007

<br>

## 💿 Installation

### → Using composer
Expand All @@ -53,9 +67,9 @@ composer req --dev wayofdev/cs-fixer-config

### → Setup

- Create PHP file and name it `.php-cs-fixer.dist.php` and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.
* Create PHP file and name it `.php-cs-fixer.dist.php` and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.

- Example contents of `.php-cs-fixer.dist.php` file:
* Example contents of `.php-cs-fixer.dist.php` file:
Comment on lines +70 to +72
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Clarify the setup instructions for .php-cs-fixer.dist.php to ensure they are easy to follow for new users.

- * Create PHP file and name it `.php-cs-fixer.dist.php` and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.
+ * Create a PHP file named `.php-cs-fixer.dist.php` and place it in the root directory of your project. PHP CS Fixer will automatically recognize this configuration file.

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
* Create PHP file and name it `.php-cs-fixer.dist.php` and place it inside root directory of project. It will be recognized by PHP CS Fixer automatically.
- Example contents of `.php-cs-fixer.dist.php` file:
* Example contents of `.php-cs-fixer.dist.php` file:
* Create a PHP file named `.php-cs-fixer.dist.php` and place it in the root directory of your project. PHP CS Fixer will automatically recognize this configuration file.
* Example contents of `.php-cs-fixer.dist.php` file:


```php
<?php
Expand All @@ -81,7 +95,7 @@ composer req --dev wayofdev/cs-fixer-config

### → Composer Script

- Add `scripts` section to `composer.json`:
* Add `scripts` section to `composer.json`:

```diff
{
Expand All @@ -94,7 +108,7 @@ composer req --dev wayofdev/cs-fixer-config

### → Git

- Place `.build` folder file into `.gitignore`
* Place `.build` folder file into `.gitignore`

```diff
+/.build/
Expand All @@ -103,7 +117,7 @@ composer req --dev wayofdev/cs-fixer-config

### → Makefile

- If you are using [`Makefile`](https://www.gnu.org/software/make/manual/make.html#Introduction), create a `Makefile` with a `lint-php` and `lint-diff` targets:
* If you are using [`Makefile`](https://www.gnu.org/software/make/manual/make.html#Introduction), create a `Makefile` with a `lint-php` and `lint-diff` targets:

```diff
+APP_RUNNER ?= php
Expand All @@ -122,15 +136,15 @@ composer req --dev wayofdev/cs-fixer-config
+.PHONY: lint-diff
```

Or, you can check for one of our pre-configured `Makefile` from any of these repositories:
Or, you can check for one of our pre-configured `Makefile` from any of these repositories:

<https://github.com/wayofdev/php-cs-fixer-config/blob/master/Makefile>
<https://github.com/wayofdev/php-cs-fixer-config/blob/master/Makefile>

<https://github.com/wayofdev/laravel-package-tpl/blob/master/Makefile>
<https://github.com/wayofdev/laravel-package-tpl/blob/master/Makefile>

### → GitHub Actions

- To use this package in [GitHub Actions](https://github.com/features/actions), add a `coding-standards.yml` workflow to your repository:
* To use this package in [GitHub Actions](https://github.com/features/actions), add a `coding-standards.yml` workflow to your repository:

```yaml
---
Expand Down Expand Up @@ -219,9 +233,9 @@ composer req --dev wayofdev/cs-fixer-config
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```

Or, you can check for one of our pre-configured workflows from any of these repositories:
Or, you can check for one of our pre-configured workflows from any of these repositories:

<https://github.com/wayofdev/php-cs-fixer-config/blob/master/.github/workflows/coding-standards.yml>
<https://github.com/wayofdev/php-cs-fixer-config/blob/master/.github/workflows/coding-standards.yml>

<br>

Expand All @@ -239,13 +253,13 @@ vendor/bin/php-cs-fixer fix -v

To use via composer script commands:

- Fixes code to follow coding standards using php-cs-fixer:
* Fixes code to follow coding standards using php-cs-fixer:

```bash
composer cs:diff
```

- Runs php-cs-fixer in dry-run mode and shows diff which will by applied:
* Runs php-cs-fixer in dry-run mode and shows diff which will by applied:

```bash
composer cs:fix
Expand All @@ -255,13 +269,13 @@ To use via composer script commands:

**To use with `Makefile`**

- Fixes code to follow coding standards using php-cs-fixer:
* Fixes code to follow coding standards using php-cs-fixer:

```bash
make lint-php
```

- Runs php-cs-fixer in dry-run mode and shows diff which will by applied:
* Runs php-cs-fixer in dry-run mode and shows diff which will by applied:

```bash
make lint-diff
Expand All @@ -279,10 +293,10 @@ This project has a [security policy](.github/SECURITY.md).

Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:

- 🤔 [Suggest a feature](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
- 🐛 [Report an issue](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
- 📖 [Improve documentation](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
- 👨‍💻 Contribute to the code
* 🤔 [Suggest a feature](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
* 🐛 [Report an issue](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
* 📖 [Improve documentation](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
* 👨‍💻 Contribute to the code
Comment on lines 294 to +299
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Elevate the formal tone of the contribution invitation.

- Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:
+ Thank you for considering a contribution to the wayofdev community! We welcome diverse contributions. Should you wish to:

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
Thank you for considering contributing to the wayofdev community! We are open to all kinds of contributions. If you want to:
- 🤔 [Suggest a feature](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
- 🐛 [Report an issue](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
- 📖 [Improve documentation](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
- 👨‍💻 Contribute to the code
* 🤔 [Suggest a feature](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
* 🐛 [Report an issue](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
* 📖 [Improve documentation](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
* 👨‍💻 Contribute to the code
Thank you for considering a contribution to the wayofdev community! We welcome diverse contributions. Should you wish to:
* 🤔 [Suggest a feature](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+enhancement&projects=&template=2-feature-request.yml&title=%5BFeature%5D%3A+)
* 🐛 [Report an issue](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=1-bug-report.yml&title=%5BBug%5D%3A+)
* 📖 [Improve documentation](https://github.com/wayofdev/php-cs-fixer-config/issues/new?assignees=&labels=type%3A+documentation%2Ctype%3A+maintenance&projects=&template=4-docs-bug-report.yml&title=%5BDocs%5D%3A+)
* 👨‍💻 Contribute to the code


You are more than welcome. Before contributing, kindly check our [contribution guidelines](.github/CONTRIBUTING.md).

Expand All @@ -302,21 +316,21 @@ You are more than welcome. Before contributing, kindly check our [contribution g

## 🌐 Social Links

- **Twitter:** Follow our organization [@wayofdev](https://twitter.com/intent/follow?screen_name=wayofdev) and the author [@wlotyp](https://twitter.com/intent/follow?screen_name=wlotyp).
- **Discord:** Join our community on [Discord](https://discord.gg/CE3TcCC5vr).
* **Twitter:** Follow our organization [@wayofdev](https://twitter.com/intent/follow?screen_name=wayofdev) and the author [@wlotyp](https://twitter.com/intent/follow?screen_name=wlotyp).
* **Discord:** Join our community on [Discord](https://discord.gg/CE3TcCC5vr).

<p align="left">
<a href="https://discord.gg/CE3TcCC5vr" target="_blank"><img alt="Codecov" src="https://img.shields.io/discord/1228506758562058391?style=for-the-badge&logo=discord&labelColor=7289d9&logoColor=white&color=39456d"></a>
<a href="https://x.com/intent/follow?screen_name=wayofdev" target="_blank"><img alt="Follow on Twitter (X)" src="https://img.shields.io/badge/-Follow-black?style=for-the-badge&logo=X"></a>
<a href="https://discord.gg/CE3TcCC5vr" target="_blank"><img alt="Codecov" src="https://img.shields.io/discord/1228506758562058391?style=for-the-badge&logo=discord&labelColor=7289d9&logoColor=white&color=39456d"></a>
<a href="https://x.com/intent/follow?screen_name=wayofdev" target="_blank"><img alt="Follow on Twitter (X)" src="https://img.shields.io/badge/-Follow-black?style=for-the-badge&logo=X"></a>
Comment on lines +319 to +324
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tip

Codebase Verification

The Twitter link returned a 403 Forbidden status, which suggests there might be an issue with the link or access restrictions. The Discord link, however, redirected correctly to a valid invite link.

  • The Twitter link needs to be reviewed and potentially corrected.
  • The Discord link is functioning as expected.
Analysis chain

Confirm the accuracy and functionality of the social links and ensure they lead to the correct pages.

Scripts Executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the functionality of social links.

# Test: Check if the URLs are reachable and correct.
curl -I https://twitter.com/intent/follow?screen_name=wayofdev && curl -I https://discord.gg/CE3TcCC5vr

Length of output: 2103

</p>

<br>

## 🧱 Resources

- Full documentation about all fixers are available here - [PHP-CS-Fixer configuration UI](https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0)
* Full documentation about all fixers is available here - [PHP-CS-Fixer configuration UI](https://mlocati.github.io/php-cs-fixer-configurator/#version:3.0)

- The official [PHP-CS-Fixer documentation](https://github.com/FriendsOfPHP/PHP-CS-Fixer)
* The official [PHP-CS-Fixer documentation](https://github.com/FriendsOfPHP/PHP-CS-Fixer)

<br>

Expand Down
Loading