Add Symfony LSP diagnostics to CI - #87
Open
loevgaard wants to merge 3 commits into
Open
Conversation
Run `symfony lsp:check` (https://symfony.com/blog/introducing-symfony-lsp-check-symfony-aware-diagnostics-in-your-ci) as a new "symfony-diagnostics" job so that unknown routes, services, templates, translation keys, deprecated configuration keys etc. are reported as GitHub annotations. symfony-lsp only discovers a Symfony application when its composer.json requires symfony/framework-bundle and, to boot it, needs a PSR-4 entry pointing at the kernel plus <project>/vendor/autoload.php. The test application is not a standalone Composer project, so: - tests/Application/composer.json declares the framework-bundle requirement and the PSR-4 namespace of the kernel (nothing is ever installed from this file) - tests/Application/vendor is a symlink to the root vendor directory - phpunit.xml.dist excludes tests/Application and vendor because PHPUnit follows symlinks when discovering tests - .symfony-lsp.json points symfony-lsp at tests/Application and enables translation diagnostics
framework.form.legacy_error_messages and security.enable_authenticator_manager are deprecated no-ops on Symfony 6.4.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.14.x #87 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 2 2
===========================================
Files 2 2
Lines 16 16
===========================================
Hits 16 16 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
The check belongs with the other lint steps rather than in a job of its own.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Integrates symfony lsp:check into the build workflow as a step of the
coding-standardsjob (PHP 8.1, highest deps), next to the YAML and Twig lint steps. It runssymfony lsp:check --format=github, so unknown routes/services/templates/translation keys, deprecated config keys etc. show up as annotations on pull requests.Repository changes needed for symfony-lsp to find and boot the test application
symfony-lsp discovers an application only if its
composer.jsonrequiressymfony/framework-bundle, locates the kernel through a PSR-4 entry in thatcomposer.json, and boots it via<project>/vendor/autoload.php. The test application is not a standalone Composer project, hence:tests/Application/composer.jsonnow declares thesymfony/framework-bundlerequirement and the PSR-4 namespace of the kernel. Nothing is ever installed from this file; it is only a marker (as it already was for project-dir resolving).tests/Application/vendoris a symlink to the rootvendordirectory.phpunit.xml.distexcludestests/Applicationandvendorfrom test discovery because PHPUnit follows symlinks (without this it would try to load the 500+ test classes shipped in vendor)..symfony-lsp.jsonpoints symfony-lsp attests/Applicationand enables translation diagnostics.CLAUDE.mddocuments the command.The second commit removes the two deprecated config keys the check flagged in the test application (
framework.form.legacy_error_messages,security.enable_authenticator_manager). Both are no-ops on Symfony 6.4.Verification (local, PHP 8.3, symfony-lsp 0.20.0)
symfony-lsp check: 0 diagnostics, exit code 0 (2 deprecation warnings before the second commit)vendor/bin/phpunit: 3 tests OK, only the plugin's own tests are discoveredbin/console lint:container(test env) andlint:yamlpassRunning the check locally requires the Symfony CLI 5.20 or newer (
symfony lsp:check), or the standalonesymfony-lspbinary from https://github.com/symfony/language-tools/releases.