feat: update mago analyze#217
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens and stabilises Mago static analysis in both local DDEV workflows and CI, while making a few small reliability refactors in CLI/build-related PHP code.
Changes:
- Harden Mago configuration and CI execution (new excludes, fail-on-any-finding threshold, quieter default logging).
- Refactor “run once” logic from static locals to instance properties in theme build/clean flows.
- Add small robustness tweaks around regex matching and CLI environment checks.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
mago.toml |
Adds excludes and sets analysis to fail on any finding (minimum-fail-level = "note"). |
.github/workflows/static-analysis.yml |
Documents stricter fail semantics and sets MAGO_LOG=error for cleaner CI logs. |
.ddev/commands/web/mago |
Adjusts local mago analyze wrapper defaults (log level) and messaging. |
src/Service/StandardThemeBuilder.php |
Replaces static “grunt tasks ran” tracking with an instance property. |
src/Console/Command/Theme/CleanCommand.php |
Replaces static “global cleaned” tracking with an instance property. |
src/Console/Command/Theme/TokensCommand.php |
Makes getcwd() handling more robust with a fallback. |
src/Console/Command/Theme/BuildCommand.php |
Initialises $matches before preg_match() in summary formatting. |
src/Console/Command/System/CheckCommand.php |
Initialises $matches before regex parsing and improves dynamic getter invocation. |
src/Console/Command/AbstractCommand.php |
Tweaks interactive-terminal detection to avoid relying on STDIN outside CLI SAPI. |
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.
This pull request introduces several improvements to static analysis configuration, error logging, and code reliability, as well as minor refactoring for maintainability. The main themes are stricter static analysis enforcement, improved error handling and logging, and refactoring of static variables to instance properties.
Static Analysis and Logging Improvements:
mago.tomlto exclude problematic directories, setminimum-fail-level = "note"(failing on any finding, not just errors), and document why certain paths are excluded. This ensures static analysis is stricter and more reliable. [1] [2].ddev/commands/web/magoand.github/workflows/static-analysis.ymlto suppress harmless log warnings and only display real errors by settingMAGO_LOG=errorby default, making logs clearer and failures more meaningful. [1] [2]Code Reliability and Refactoring:
CleanCommandandStandardThemeBuilderto properly track one-time operations (like cleaning global directories or running Grunt tasks) within the object’s lifecycle, improving maintainability and correctness. [1] [2] [3] [4]$matchesarrays before use in several methods, preventing potential bugs and making code more robust. [1] [2] [3] [4]