Add static code analysis and including CI/CD check
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Tính năng
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- github-actions, php
- Lĩnh vực
- build-system, ci-cd, tooling
Hướng nghiên cứu
Compare the static-analysis setup in open-runtimes/executor, then inspect the Composer configuration and PHP source directories in utopia-php/cache, utopia-php/platform, and utopia-php/dsn. Start by running the existing checks and progressively validate PHPStan configuration toward level 8. Done means each repository has a check command and a code-analysis.yml workflow that runs composer check on every push.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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. 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.
2. 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.
3. 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.
- Ngôn ngữ chính
- PHP
- Star
- 33
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
filamentphp/filament#20630 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
needs-maintainer-review review:approve
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Ultimate-Multisite/ultimate-ai-connector-compatible-endpoints#163 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100