From 23c7792940990d8923e3e1ca527bc04aa383c56b Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 27 Jun 2025 11:17:04 -0400 Subject: [PATCH] adding new php tool docs --- docs/changelog.md | 12 ++++++++++++ docs/tools/list.md | 4 +++- docs/tools/phpcs.md | 47 +++++++++++++++++++++++++++++++++++++++++++++ docs/tools/phpmd.md | 37 +++++++++++++++++++++++++++++++++++ 4 files changed, 99 insertions(+), 1 deletion(-) create mode 100644 docs/tools/phpcs.md create mode 100644 docs/tools/phpmd.md diff --git a/docs/changelog.md b/docs/changelog.md index 240fbdfa..97a10162 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -5,6 +5,18 @@ description: The latest updates and changes to CodeRabbit. sidebar_position: 13 --- +## June 27, 2025 + +### Enhanced PHP Static Analysis: PHPMD and PHPCS Support + +We're excited to announce enhanced PHP static analysis capabilities with two powerful new tools! + +- [PHPMD](https://phpmd.org/) (PHP Mess Detector) is a static analysis tool that detects potential problems in your PHP code such as possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, variables, methods, and classes. + +- [PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) (PHP CodeSniffer) is a development tool that ensures your PHP code conforms to coding standards like PSR-1, PSR-2, PSR-12, and custom standards. It can automatically fix many coding standard violations. + +See our [tools documentation](https://docs.coderabbit.ai/tools/) for more details. + ## June 11, 2025 ### Enhanced Static Analysis: HTMLHint and Checkmake Support diff --git a/docs/tools/list.md b/docs/tools/list.md index 6092e082..bfe5e5ce 100644 --- a/docs/tools/list.md +++ b/docs/tools/list.md @@ -32,7 +32,7 @@ For an overview of how CodeRabbit uses these tools when generating code reviews, | Lua | [Luacheck][Luacheck] | Code Quality | | Makefile | [Checkmake][Checkmake] | Code Quality | | Markdown | [markdownlint][markdownlint], [LanguageTool][LanguageTool] | Code Quality, Grammar Checking | -| PHP | [PHPStan][PHPStan] | Code Quality | +| PHP | [PHPStan][PHPStan], [PHPMD][PHPMD], [PHPCS][PHPCS] | Code Quality | | Plaintext | [LanguageTool][LanguageTool] | Grammar and Spell Checking | | Java | [PMD][PMD] | Code Quality | | Protobuf | [Buf][Buf] | Code Quality | @@ -84,3 +84,5 @@ For an overview of how CodeRabbit uses these tools when generating code reviews, [DotenvLinter]: /tools/dotenv.md [HTMLHint]: /tools/htmlhint.md [Checkmake]: /tools/checkmake.md +[PHPMD]: /tools/phpmd.md +[PHPCS]: /tools/phpcs.md diff --git a/docs/tools/phpcs.md b/docs/tools/phpcs.md new file mode 100644 index 00000000..390c620f --- /dev/null +++ b/docs/tools/phpcs.md @@ -0,0 +1,47 @@ +--- +title: PHPCS +sidebar_label: PHPCS +description: CodeRabbit's guide to PHPCS. +--- + +```mdx-code-block +import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx'; + + +``` + +[PHPCS](https://github.com/squizlabs/PHP_CodeSniffer) (PHP CodeSniffer) is a development tool that ensures your code conforms to a coding standard. It is an essential tool for any development team that wants to ensure their code is consistent and follows best practices. + +## Files + +PHPCS will run on files with the following extensions: + +- `.php` + +## Features + +PHPCS can detect and fix various coding standard violations including: + +- **PSR Standards**: Enforces PSR-1, PSR-2, PSR-12, and other coding standards +- **Custom Standards**: Supports custom coding standards and rules +- **Auto-fixing**: Can automatically fix many coding standard violations +- **Custom Rules**: Allows creation of custom sniff rules +- **Multiple Standards**: Can enforce multiple coding standards simultaneously + +## Popular Standards + +PHPCS supports many coding standards including: + +- **PSR-1**: Basic Coding Standard +- **PSR-2**: Coding Style Guide +- **PSR-12**: Extended Coding Style +- **Squiz**: Squiz Labs coding standard +- **PEAR**: PEAR coding standard +- **Zend**: Zend Framework coding standard + +## Links + +- [PHPCS GitHub Repository](https://github.com/squizlabs/PHP_CodeSniffer) +- [PHPCS Documentation](https://github.com/squizlabs/PHP_CodeSniffer/wiki) +- [Available Coding Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards) +- [Creating Custom Standards](https://github.com/squizlabs/PHP_CodeSniffer/wiki/Coding-Standards#creating-a-coding-standard) diff --git a/docs/tools/phpmd.md b/docs/tools/phpmd.md new file mode 100644 index 00000000..fb191a27 --- /dev/null +++ b/docs/tools/phpmd.md @@ -0,0 +1,37 @@ +--- +title: PHPMD +sidebar_label: PHPMD +description: CodeRabbit's guide to PHPMD. +--- + +```mdx-code-block +import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx'; + + +``` + +[PHPMD](https://phpmd.org/) (PHP Mess Detector) is a static analysis tool for PHP that detects potential problems in your code such as possible bugs, suboptimal code, overcomplicated expressions, and unused parameters, variables, methods, and classes. + +## Files + +PHPMD will run on files with the following extensions: + +- `.php` + +## Features + +PHPMD can detect various code quality issues including: + +- **Clean Code Rules**: Detects code smells and violations of clean code principles +- **Controversial Rules**: Identifies potentially problematic code patterns +- **Design Rules**: Finds design-related issues and architectural problems +- **Naming Rules**: Checks for naming convention violations +- **Unused Code Rules**: Detects unused variables, parameters, methods, and classes +- **Size Rules**: Identifies overly complex methods and classes + +## Links + +- [PHPMD Official Website](https://phpmd.org/) +- [PHPMD GitHub Repository](https://github.com/phpmd/phpmd) +- [PHPMD Documentation](https://phpmd.org/documentation/index.html) +- [Available Rules](https://phpmd.org/rules/index.html)