Add experimental --turbo option running the reco Go binary - #80
Merged
Merged
Conversation
Turbo mode now resolves the full ecs.php config - paths, rules (with each fixer's configuration) and skips - dumps it to a temp JSON file, and passes it to reco via --ecs-config, so reco maps the ECS rules to its native ones rather than running a fixed set. The same JSON is exposed standalone via a new dump-config command. RecoConfigDumper builds the JSON; TurboRunner writes and runs it.
The config consumer now lives in tomasvotruba/ecs-go, whose fixers are named by their PHP-CS-Fixer class, so the dumped config maps across by name. Rename RecoBinaryLocator to EcsGoBinaryLocator (locating ecs-go / vendor/bin/ecs-go, ECS_TURBO_BIN unchanged) and RecoConfigDumper to TurboConfigDumper, and adjust the invocation: ecs-go reports by default and rewrites with --fix, so turbo passes --ecs-config <file> and adds --fix in fix mode.
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.
What
Adds an experimental
--turboflag tobin/ecs check. Instead of running the PHP engine, it hands the resolved paths to therecoGo binary - a PHP parser and rewriter written in Go.How
ecs.php(and any CLI paths) exactly as usual, then invokes reco over them.--turborunsreco run --dry-run <paths>- reports without writing.--turbo --fixrunsreco run <paths>- rewrites in place.ECS_TURBO_BINenv var ->vendor/bin/reco->recoonPATH.CHANGED_CODE_OR_FOUND_ERRORS).symfony/processis inreplace, so the shell-out usespassthruwith escaped arguments.Prototype caveat
This is an RFC-stage prototype. In turbo mode reco runs its own native rule set, not the sniffs and fixers configured in
ecs.php- only the paths are shared, the rule selection is ignored for now. A turbo run is not yet equivalent to a normal ECS run. This is documented indocs/turbo.md.Remaining delivery work
For
--turboto work out of the box the reco binary has to ship alongside ECS:vendor/bin/reco.Until then, build reco and point
ECS_TURBO_BINat it, or put it onPATH.Tests
New unit tests under
tests/Turbo.composer lint(phpstan level 8 + rector + check-cs) andcomposer testpass locally.