Migrate static code analysis from Psalm to PHPStan
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
调研方向
Work through the three repositories listed, comparing their dependency files, lockfiles, Psalm configuration, Composer scripts, and GitHub workflows with open-runtimes/executor. Start by reviewing the existing Psalm setup and executor's PHPStan configuration, then raise analysis from level 1 toward level 8. Done means all three repositories use the shared PHPStan settings, expose composer check, and run it from code-analysis.yml on pushes.
由索引模型根据 Issue 内容生成。
描述
Introduction
Static code analysis allows programmers to check their code for bugs ahead of time. There are many ways to do it, but this one specifically understands code without running it, allowing for very fast and reliable checks.
Starting this issue requires an understanding of PHP syntax. Finishing this issue will give you basic understanding about Composer (PHP package manager) and GitHub Actions.
Task summary
Your goal is to implement static code analysis in the following repositories:
1. Remove Psalm code analysis
Remove Psalm from all necessary places in the repository. Make sure those include:
- Removing from dependency manager (and it's lockfile)
- Removing Psalm configuration file
- Removing GitHub action automating Psalm code check
2. Install and configure PHPStan
Install PHPStan by using Composer, a PHP dependency manager.
Make sure the version for this dependency is set to automatically upgrade minor and patch versions, but not the major version.
If those terms seem new to you, check out Semantic Versioning.
To configure PHPStan, you use a specific JSON file. Please refer to the PHPStan documentation to learn more.
Your goal is to configure PHPStan in all repositories to the same settings. Please set it to the same settings as we used in another one of our open-source repositories open-runtimes/executor.
In rare scenarios, PHPStan can have issues seeing typings for PHP extensions such as Swoole or Redis. If this happens to you, you might need to mention their helpers in the scanDirectories of the PHPStan configuration.
3. Add command to run static code analysis
Set up Composer scripts called check. This command should run PHPStan on all directories including PHP files. We usually only store PHP code in directories src, app and tests, but make sure to double check it.
When running the PHPStan check, we strive for level 8 of strictness. We recommend you to start with low level of 1, and work your way up, inspecting new errors with each higher level.
If you face issue you can't find a way to solve, please discuss with us and in rare scenarios we allow ignoring a line of code in code analysis.
If you ever get stuck, you can again refer to open-runtimes/executor, to see how it's been done there.
4. Add GitHub automation
Add GitHub action to run linter (composer check) on each push, so pull requests run linter as check.
Store the new GitHub action in the code-analysis.yml file.
Just like before, if you feel stuck, you can refer to Open Runtimes Executor to validate your approach.
- 主要语言
- PHP
- 星标
- 4
- 派生
- 1
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
相似的 Issue
-
[CoreBundle] Migrations are silently skipped on MariaDB with DBAL 4 (AbstractMigration::isMySql())未关闭Potential Bug
难度 2/5 1-3 小时 新手友好度 78/100
Sylius/Sylius#19270 · 1 条评论 · 4 个 reaction ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
invoiceninja/invoiceninja#13320 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
维护者通常 1 天内回复
-
sync-en
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
Перевод устарел
难度 2/5 1-3 小时 新手友好度 68/100