Closed MarjovanLier closed 7 months ago
This is an automated message generated by Sweep AI.
PR Description updated to latest commit (https://github.com/MarjovanLier/XhprofTrace/commit/a175bb72a6c73119f9ea761c5ca055827bde1638)
Changelog updates:
psalm.xml
) with specific settings for error level, project files, and issue handling.localTest.sh
).Trace.php
using @psalm-suppress PossiblyUnusedMethod
.to commit the new content to the CHANGELOG.md file, please type: '/update_changelog --pr_update_changelog.push_changelog_changes=true'
Category | Suggestions | |
Enhancement |
Combine multiple
___
**Instead of running two separate | |
Best practice |
Add a failure check condition for the Psalm step in the workflow.___ **Ensure consistency in the workflow by adding a failure check condition for the Psalm step,similar to the preceding steps. This can help in identifying and halting the workflow early in case of a failure in the Psalm analysis.** [.github/workflows/php.yml [123-124]](https://github.com/MarjovanLier/XhprofTrace/pull/25/files#diff-a73bb6555480a5ee79ae276a3f5d71a08fa316e09a4a8da7b643cf1e92c97df9R123-R124) ```diff -if: steps.phan.outcome == 'success' -run: composer test:psalm +if: steps.phan.outcome == 'success' && steps.psalm.outcome == 'success' ```
| Lock the versions of newly added packages to avoid breaking changes.___ **It's recommended to lock the versions of the newly added packages to prevent potentialbreaking changes. Using >= for package versions can lead to unexpected updates that might introduce breaking changes or incompatibilities.** [composer.json [63-64]](https://github.com/MarjovanLier/XhprofTrace/pull/25/files#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34R63-R64) ```diff -"psalm/plugin-phpunit": ">=0.18.4", -"vimeo/psalm": ">=5.22.2" +"psalm/plugin-phpunit": "^0.18.4", +"vimeo/psalm": "^5.22.2" ``` |
Security |
Add a
___
**Consider adding a | |
Maintainability |
Configure Psalm to ignore
___
**Instead of suppressing the |
Auto-approved PR
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
User description
Summary
This Merge Request (MR) adds static analysis capabilities to the project by integrating Psalm, a powerful static analysis tool for PHP. The integration includes the necessary dependencies, configuration files, and automated testing scripts to ensure code quality and catch potential issues during development.
Context and Background
Maintaining code quality and catching errors early becomes increasingly essential as the codebase grows. Static analysis tools help identify potential issues, enforce coding standards, and improve code quality. Psalm is a highly regarded static analysis tool for PHP projects.
Problem Description
While the project already had some static analysis tools in place, such as Phan and PHPStan, there was a need for a more comprehensive and robust solution. Phan has limited support for newer PHP features and can sometimes produce false positives or miss potential issues.
Solution Description
The solution involves introducing Psalm, a static analysis tool known for its accuracy and support for modern PHP features. The following changes have been made:
vimeo/psalm
andpsalm/plugin-phpunit
dependencies have been added to the project through Composer.psalm.xml
file has been added to configure Psalm's behaviour, including error level, project files, plugins, and issue handling.@test:psalm
andtest:psalm
have been added to run Psalm static analysis.localTest.sh
script has been updated to install the required Psalm dependencies during the local testing.src/Trace.php
,@psalm-suppress PossiblyUnusedMethod
annotations have been added to suppress warnings for potentially unused methods that are necessary.List of Changes
composer.json
: Addedvimeo/psalm
andpsalm/plugin-phpunit
dependencies, and new Composer scripts for running Psalm.psalm.xml
: New configuration file for Psalm..github/workflows/php.yml
: Added a step to run Psalm static analysis in the GitHub Actions workflow.localTest.sh
: Added commands to install Psalm dependencies during local testing.src/Trace.php
: Added@psalm-suppress PossiblyUnusedMethod
annotations for potentially unused methods.Type
enhancement, documentation
Description
vimeo/psalm
andpsalm/plugin-phpunit
to dependencies for better static analysis and PHPUnit integration.Trace.php
to avoid false positives.psalm.xml
configuration file to customize Psalm's behavior according to the project's needs.Changes walkthrough
Trace.php
Suppress Psalm Warnings in Trace.php
src/Trace.php
@psalm-suppress PossiblyUnusedMethod
annotations to suppresswarnings for potentially unused methods.
localTest.sh
Update Local Testing Script for Psalm
localTest.sh
testing.
php.yml
Enable Psalm Static Analysis in CI Workflow
.github/workflows/php.yml - Enabled Psalm static analysis in GitHub Actions workflow.
composer.json
Integrate Psalm and Its PHPUnit Plugin
composer.json
vimeo/psalm
andpsalm/plugin-phpunit
dependencies.@test:psalm
script for running Psalm static analysis.psalm.xml
Add Psalm Configuration File
psalm.xml
static analysis.
Summary by CodeRabbit
phan/phan
withvimeo/psalm
and includedpsalm/plugin-phpunit
.