Skip to content

Add linter and guard, apply fixes and suppress by scope#49

Open
WalterWoshid wants to merge 3 commits intoj-plugins:mainfrom
WalterWoshid:feat/apply-fix-and-suppress
Open

Add linter and guard, apply fixes and suppress by scope#49
WalterWoshid wants to merge 3 commits intoj-plugins:mainfrom
WalterWoshid:feat/apply-fix-and-suppress

Conversation

@WalterWoshid
Copy link

@WalterWoshid WalterWoshid commented Feb 11, 2026

Mago inspection now runs lint and guard together with analyze and shows all results in the editor. You can apply Mago autofixes from annotations and suppress issues by statement, function, method, or class. Fixes and suppress actions support intention preview (Ctrl+Q).

Changes

  • Linter and guard – When enabled in settings, the pipeline runs mago lint and mago guard in addition to analyze and merges problems into the same annotations. Lint and guard issues get the same apply-fix and suppress quick fixes as analyze.
    image

  • Better descriptions
    image

  • Apply fix – Apply a single Mago autofix from the problem annotation (Alt+Enter). Fix text uses issue help or message, prefixed with "Mago: ". Before there was a global "Mago: fix the whole file", which only ran the formatter. This has been removed.
    image

  • Apply all by safety – Submenus: "Fix all (safe only)", "Fix all (potentially unsafe)", "Fix all (unsafe)". Each applies only that tier; apply-all uses in-memory edits (no CLI run) so undo works.
    image

  • Mago: Ignore/Expect – Quick fix to add @mago-ignore/expect category:code with options: for statement, for function, for method, for class. Submenu when multiple apply. Same-category codes merged into one comment.
    image

  • Ignore/Expect appends correctly to an existing comment
    image

  • Mago: Navigate to cause - Places the cursor to the problem (works with problems that are reporting in other files!)
    image
    image

  • \Mago\inspect(...) support
    image
    image
    image

  • Improved debug notification
    image

  • Format after fix option - Runs the formatter after applying a fix.
    image

  • Workspace mappings - Multiple workspace support
    image

  • Platform – Target PhpStorm (PS) 2025.3.2, adjust Plugin versions + Docker

Required Mago Changes for optimal usage

  • --stdin-input Support - This allows passing the editor file contents to the Mago commands. Why? Because if running it without the option will analyze the unsaved file and the annotations are broken/misplaced. I added fallback without --stdin-input if Mago is used with an older version, but that can be removed in the future and only display an error.

  • Baseline ignored when using --workspace fix - When Mago is launched from the plugin (from a remote interpreter) it uses the / working directory and --workspace, but it doesn't correctly resolve the baseline entries. This fixes it.

@WalterWoshid
Copy link
Author

This Pull Request also makes #47 obsolete, because it is included.

@WalterWoshid WalterWoshid force-pushed the feat/apply-fix-and-suppress branch from 654e856 to 3a848ce Compare February 12, 2026 14:21
Copy link
Contributor

@xepozz xepozz left a comment

Choose a reason for hiding this comment

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

Thanks for improving the plugin, but let's make it a bit clear first

@WalterWoshid
Copy link
Author

WalterWoshid commented Feb 12, 2026

Thanks for the review, will do that tomorrow :)

@zip-fa
Copy link

zip-fa commented Feb 25, 2026

@WalterWoshid hey! sorry for bothering, do you still work on this?

@WalterWoshid
Copy link
Author

Hi @zip-fa, I was still working on this #49 (comment) but got distracted in real life, gonna try to continue with this. I can also push a branch with my current implementation if you need it.

@WalterWoshid WalterWoshid force-pushed the feat/apply-fix-and-suppress branch 3 times, most recently from c00bb18 to c5e6aec Compare March 3, 2026 23:53
- Run mago lint and guard with analyze; merge results into annotations
- Apply single fix or apply-all by safety (safe / potentially unsafe / unsafe)
- Format after fix: run Mago formatter when the option is enabled in settings
- Mago: Suppress for statement, function, method, class (submenu when multiple);
  always show "for statement" so narrowest scope is available
- Intention preview (Ctrl+Q) for apply and suppress
@WalterWoshid WalterWoshid force-pushed the feat/apply-fix-and-suppress branch from c5e6aec to 86cdbf3 Compare March 4, 2026 02:23
@WalterWoshid
Copy link
Author

@xepozz I updated the issue description and resolved all your comments!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants