Add linter and guard, apply fixes and suppress by scope#49
Add linter and guard, apply fixes and suppress by scope#49WalterWoshid wants to merge 3 commits intoj-plugins:mainfrom
Conversation
|
This Pull Request also makes #47 obsolete, because it is included. |
654e856 to
3a848ce
Compare
xepozz
left a comment
There was a problem hiding this comment.
Thanks for improving the plugin, but let's make it a bit clear first
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoMessageProcessor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoMessageProcessor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoMessageProcessor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoMessageProcessor.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MarkIgnoreAction.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoApplyEditAction.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/intentions/apply/MagoApplyEditAction.kt
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoHtmlAnnotator.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoHtmlAnnotator.kt
Outdated
Show resolved
Hide resolved
src/main/kotlin/com/github/xepozz/mago/qualityTool/MagoHtmlAnnotator.kt
Outdated
Show resolved
Hide resolved
|
Thanks for the review, will do that tomorrow :) |
|
@WalterWoshid hey! sorry for bothering, do you still work on this? |
|
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. |
c5e6aec to
86cdbf3
Compare
|
@xepozz I updated the issue description and resolved all your comments! |
|
@WalterWoshid please discard changes in 19bfb87 As for others, I'll check them this week |
Running buildPlugin uses PhpStorm instead of IntelliJ
- 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 - Improved `mago.toml` logic/completions
86cdbf3 to
ab305d6
Compare
|
For the stdin fallback we should probably manually check if the
|

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).
I have tested these and it worked successfully:
Probably closes these issues:
Changes
Linter and guard - When enabled in settings, the pipeline runs

mago lintandmago guardin 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.Better descriptions

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.

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.

Mago: Ignore/Expect - Quick fix to add

@mago-ignore/expect category:codewith options: for statement, for function, for method, for class. Submenu when multiple apply. Same-category codes merged into one comment.Ignore/Expect appends correctly to an existing comment

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


\Mago\inspect(...)supportImproved debug notification

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

Workspace mappings - Multiple workspace support

Platform - Target PhpStorm (PS) + Docker
Reworked
mago.toml- Better support for completions and merging results togetherRequired Mago Changes for optimal usage
--stdin-inputSupport - 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-inputif Mago is used with an older version, but that can be removed in the future and only display an error.Baseline ignored when using
--workspacefix - 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.