Download the PHP package uzulla/phpstorm-inspect-code-cli-runner without Composer
On this page you can find all versions of the php package uzulla/phpstorm-inspect-code-cli-runner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download uzulla/phpstorm-inspect-code-cli-runner
More information about uzulla/phpstorm-inspect-code-cli-runner
Files in uzulla/phpstorm-inspect-code-cli-runner
Package phpstorm-inspect-code-cli-runner
Short Description CLI tool that runs PhpStorm's code inspections and outputs structured results for easier refactoring and find bugs.
License MIT
Informations about the package phpstorm-inspect-code-cli-runner
phpstorm-inspect-code-cli-runner
This package enables you to comfortably use PhpStorm as a CLI tool for static analysis.
Features
- Wrapper for PhpStorm's
inspect.shscript with additional functionality - Waits for PhpStorm to finish already running inspections
- Clears PhpStorm's cache before every run to prevent stale cache issues
- Parses XML output generated by PhpStorm and presents it in a readable form
- Supports both text and checkstyle output formats
- Modern PHP 8.3 implementation with Symfony Console integration
- Tested with PHPStorm 2024.3
Installation
Usage
Arguments
--inspect-sh: Path toinspect.shscript--system-path: Path to.WebIde*/systemdirectory--project-path: Path to project directory (that contains.ideadirectory)--profile: Path to inspection profile XML file--directory: Path in which are the inspected sources--format: Format of output result, accepted values: "text" (default) / "checkstyle"
Environment Configuration
You can configure PhpStorm binary paths using a .env file:
-
Copy the
.env.examplefile to.envin the project root: - Edit the
.envfile with your specific paths:
When environment variables are set, you can omit the corresponding command-line options:
Example Usage
Creating a Simple Inspection Profile
If you don't have an existing inspection profile, you can create a simple one:
Save this to a file named inspection-profile.xml in your project directory.
Running the Inspection
You can run the inspection on your project's source code:
Self-Inspection Example
A good way to test the tool is to use it to inspect its own code:
Sample Output (Text Format)
When running the self-inspection example above, you'll get output similar to this:
This output shows various code quality issues that PhpStorm's inspection has found, such as:
- Missing PHPDoc comments
- Missing class constant types
- Missing parent method calls
- Fully qualified name usage that could be replaced with imports
- Unused declarations
- And more
Sample Output (Checkstyle Format)
You can also get the output in checkstyle format, which is useful for integration with CI tools:
Output:
The checkstyle format is particularly useful for integrating with CI/CD pipelines and other tools that can process this standard format.
Tips for Effective Usage
Customizing Inspection Profiles
For more comprehensive code quality checks, you can create a custom inspection profile in PhpStorm:
- Open your project in PhpStorm
- Go to Settings/Preferences → Editor → Inspections
- Configure the inspections you want to enable/disable
- Click the gear icon and select "Export" to save your profile as an XML file
- Use this exported file with the
--profileoption
Integrating with CI/CD
To integrate with CI/CD pipelines:
- Use the checkstyle output format (
--format=checkstyle) - Save the output to a file:
php bin/phpstorm-inspect ... --format=checkstyle > phpstorm-inspection.xml - Use a tool like checkstyle-formatter to convert the output to HTML or other formats
- Configure your CI system to fail the build if certain types or numbers of issues are found
Performance Considerations
- The first run may take longer as PhpStorm builds its indexes
- For large projects, consider inspecting specific directories rather than the entire project
- Clearing the cache (which this tool does automatically) helps prevent stale cache issues but may increase inspection time
License
MIT License (see LICENSE file)
This is a modernized version of shopsys/phpstorm-inspect updated for PHP 8.3.
All versions of phpstorm-inspect-code-cli-runner with dependencies
symfony/console Version ^6.0
symfony/filesystem Version ^6.0
symfony/process Version ^6.0
symfony/dotenv Version ^6.0
arvenil/ninja-mutex Version ^0.6.0