Skip to content

feat: update mago analyze#217

Merged
Morgy93 merged 4 commits into
mainfrom
fix-mago-analyze
Jul 4, 2026
Merged

feat: update mago analyze#217
Morgy93 merged 4 commits into
mainfrom
fix-mago-analyze

Conversation

@Morgy93

@Morgy93 Morgy93 commented Jul 4, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Updated mago.toml to exclude problematic directories, set minimum-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]
  • Modified .ddev/commands/web/mago and .github/workflows/static-analysis.yml to suppress harmless log warnings and only display real errors by setting MAGO_LOG=error by default, making logs clearer and failures more meaningful. [1] [2]

Code Reliability and Refactoring:

  • Replaced static variables with instance properties in CleanCommand and StandardThemeBuilder to 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]
  • Improved regular expression handling by initializing $matches arrays before use in several methods, preventing potential bugs and making code more robust. [1] [2] [3] [4]
  • Improved CLI environment checks and callable usage for better compatibility and error handling in console commands. [1] [2] [3]

Copilot AI review requested due to automatic review settings July 4, 2026 18:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .ddev/commands/web/mago
Copilot AI review requested due to automatic review settings July 4, 2026 18:20

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.

@Morgy93 Morgy93 merged commit c25ac12 into main Jul 4, 2026
18 checks passed
@Morgy93 Morgy93 deleted the fix-mago-analyze branch July 4, 2026 18:30
@github-actions github-actions Bot mentioned this pull request Jul 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants