-
Notifications
You must be signed in to change notification settings - Fork 2
Feature hyva compat checker #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
11634f2
44d98e1
c959f74
0b999fe
73f63f8
a6a3769
73850e0
ee13cc1
3520dc8
262968b
d8952bd
96ceecf
7e3ba24
2abf4e0
20d92d6
2f4a1c1
f77c7ac
4bf1568
4c07b5d
58a2414
6c7fd76
df9f58c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -205,7 +205,7 @@ bin/magento mageforge:hyva:compatibility:check [options] | |||||
| **Options**: | ||||||
|
|
||||||
| - `--show-all` / `-a` - Show all modules including compatible ones | ||||||
| - `--third-party-only` / `-t` - Check only third-party modules (exclude Magento_* modules) | ||||||
| - `--third-party-only` / `-t` - Check only third-party modules (exclude Magento\_\* modules) | ||||||
| - `--include-vendor` - Include Magento core modules in scan (default: third-party only) | ||||||
|
||||||
| - `--include-vendor` - Include Magento core modules in scan (default: third-party only) | |
| - `--include-vendor` - Include modules from the `vendor/` directory in the scan (by default only non-vendor modules are scanned; Magento\_\* core modules are still controlled by `--third-party-only`) |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -56,7 +56,7 @@ protected function configure(): void | |||||||||||||||||
| self::OPTION_INCLUDE_VENDOR, | ||||||||||||||||||
| null, | ||||||||||||||||||
| InputOption::VALUE_NONE, | ||||||||||||||||||
| 'Include vendor modules in scan (default: excluded, but included with --third-party-only)' | ||||||||||||||||||
| 'Include Magento core modules (default: third-party modules only)' | ||||||||||||||||||
| ) | ||||||||||||||||||
| ->addOption( | ||||||||||||||||||
| self::OPTION_DETAILED, | ||||||||||||||||||
|
|
@@ -96,7 +96,8 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp | |||||||||||||||||
| label: 'Select scan options', | ||||||||||||||||||
| options: [ | ||||||||||||||||||
| 'show-all' => 'Show all modules including compatible ones', | ||||||||||||||||||
| 'include-vendor' => 'Include vendor modules (default: excluded)', | ||||||||||||||||||
| 'incompatible-only' => 'Show only incompatible modules (default behavior)', | ||||||||||||||||||
| 'include-vendor' => 'Include Magento core modules (default: third-party only)', | ||||||||||||||||||
| 'detailed' => 'Show detailed file-level issues with line numbers', | ||||||||||||||||||
| ], | ||||||||||||||||||
| default: [], | ||||||||||||||||||
|
|
@@ -110,6 +111,7 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp | |||||||||||||||||
|
|
||||||||||||||||||
| // Apply selected options to input | ||||||||||||||||||
| $showAll = in_array('show-all', $selectedOptions); | ||||||||||||||||||
| $incompatibleOnly = in_array('incompatible-only', $selectedOptions); | ||||||||||||||||||
| $includeVendor = in_array('include-vendor', $selectedOptions); | ||||||||||||||||||
| $detailed = in_array('detailed', $selectedOptions); | ||||||||||||||||||
| $thirdPartyOnly = false; // Not needed in interactive mode | ||||||||||||||||||
|
|
@@ -119,11 +121,13 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp | |||||||||||||||||
| $config = []; | ||||||||||||||||||
| if ($showAll) { | ||||||||||||||||||
| $config[] = 'Show all modules'; | ||||||||||||||||||
| } elseif ($incompatibleOnly) { | ||||||||||||||||||
| $config[] = 'Show incompatible only'; | ||||||||||||||||||
| } else { | ||||||||||||||||||
| $config[] = 'Show modules with issues'; | ||||||||||||||||||
| } | ||||||||||||||||||
| if ($includeVendor) { | ||||||||||||||||||
| $config[] = 'Include vendor modules'; | ||||||||||||||||||
| $config[] = 'Include Magento core'; | ||||||||||||||||||
| } else { | ||||||||||||||||||
| $config[] = 'Third-party modules only'; | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
@@ -133,8 +137,8 @@ private function runInteractiveMode(InputInterface $input, OutputInterface $outp | |||||||||||||||||
| $this->io->comment('Configuration: ' . implode(', ', $config)); | ||||||||||||||||||
| $this->io->newLine(); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Run scan with selected options | ||||||||||||||||||
| return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, false, $output); | ||||||||||||||||||
| // Run scan with selected options (pass incompatibleOnly flag) | ||||||||||||||||||
| return $this->runScan($showAll, $thirdPartyOnly, $includeVendor, $detailed, $incompatibleOnly, $output); | ||||||||||||||||||
| } catch (\Exception $e) { | ||||||||||||||||||
| $this->resetPromptEnvironment(); | ||||||||||||||||||
| $this->io->error('Interactive mode failed: ' . $e->getMessage()); | ||||||||||||||||||
|
|
@@ -171,12 +175,12 @@ private function runScan( | |||||||||||||||||
| OutputInterface $output | ||||||||||||||||||
| ): int { | ||||||||||||||||||
|
|
||||||||||||||||||
| // Determine filter logic for vendor and third-party modules: | ||||||||||||||||||
| // - By default (no flags): scan third-party modules excluding those in vendor/ | ||||||||||||||||||
| // - With --include-vendor: include vendor modules in the scan | ||||||||||||||||||
| // - With --third-party-only: explicitly scan only third-party modules | ||||||||||||||||||
| $scanThirdPartyOnly = $thirdPartyOnly || (!$includeVendor && !$thirdPartyOnly); | ||||||||||||||||||
| $excludeVendor = !$includeVendor; | ||||||||||||||||||
| // Determine filter logic: | ||||||||||||||||||
| // - thirdPartyOnly: Only scan non-Magento_* modules (default behavior) | ||||||||||||||||||
| // - includeVendor: Also scan Magento_* core modules | ||||||||||||||||||
| // - excludeVendor: Whether to exclude vendor/ directory (always false for now) | ||||||||||||||||||
| $scanThirdPartyOnly = !$includeVendor; | ||||||||||||||||||
| $excludeVendor = false; | ||||||||||||||||||
|
|
||||||||||||||||||
| // Run the compatibility check | ||||||||||||||||||
| $results = $this->compatibilityChecker->check( | ||||||||||||||||||
|
|
@@ -187,17 +191,14 @@ private function runScan( | |||||||||||||||||
| $excludeVendor | ||||||||||||||||||
| ); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Determine display mode based on flags | ||||||||||||||||||
| // If incompatibleOnly is set, only show modules with issues | ||||||||||||||||||
| // If showAll is set, show everything | ||||||||||||||||||
| // Otherwise, show default (incompatible only) | ||||||||||||||||||
| $displayShowAll = $showAll; | ||||||||||||||||||
| if ($incompatibleOnly && !$showAll) { | ||||||||||||||||||
| $displayShowAll = false; // Only show incompatible | ||||||||||||||||||
| } | ||||||||||||||||||
| // Determine display mode: | ||||||||||||||||||
| // showAll = show all modules including compatible ones | ||||||||||||||||||
| // incompatibleOnly = show only modules with critical issues | ||||||||||||||||||
| // default = show modules with any issues (critical or warnings) | ||||||||||||||||||
| $displayShowAll = $showAll && !$incompatibleOnly; | ||||||||||||||||||
|
|
||||||||||||||||||
| // Display results | ||||||||||||||||||
| $this->displayResults($results, $displayShowAll || $detailed); | ||||||||||||||||||
| $this->displayResults($results, $displayShowAll); | ||||||||||||||||||
|
|
||||||||||||||||||
| // Display detailed issues if requested | ||||||||||||||||||
| if ($detailed && $results['hasIncompatibilities']) { | ||||||||||||||||||
|
|
@@ -364,25 +365,9 @@ private function isInteractiveTerminal(OutputInterface $output): bool | |||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Additional check: detect if running in a proper TTY using safer methods | ||||||||||||||||||
| if (\function_exists('stream_isatty') && \defined('STDIN')) { | ||||||||||||||||||
| try { | ||||||||||||||||||
| return \stream_isatty(\STDIN); | ||||||||||||||||||
| } catch (\Throwable $e) { | ||||||||||||||||||
| // Fall through to next check | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| if (\function_exists('posix_isatty') && \defined('STDIN')) { | ||||||||||||||||||
| try { | ||||||||||||||||||
| return \posix_isatty(\STDIN); | ||||||||||||||||||
| } catch (\Throwable $e) { | ||||||||||||||||||
| // Fall through to default | ||||||||||||||||||
| } | ||||||||||||||||||
| } | ||||||||||||||||||
|
|
||||||||||||||||||
| // Conservative default if no TTY-detection functions are available | ||||||||||||||||||
| return false; | ||||||||||||||||||
| // Additional check: try to detect if running in a proper TTY | ||||||||||||||||||
| $sttyOutput = shell_exec('stty -g 2>/dev/null'); | ||||||||||||||||||
| return !empty($sttyOutput); | ||||||||||||||||||
|
Comment on lines
+369
to
+370
|
||||||||||||||||||
| $sttyOutput = shell_exec('stty -g 2>/dev/null'); | |
| return !empty($sttyOutput); | |
| if (function_exists('posix_isatty')) { | |
| return posix_isatty(STDIN); | |
| } | |
| // Fallback: we've already passed other interactive checks above | |
| return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling inconsistency: "Magento_*" at line 208 uses an escaped underscore with backslash, which is correct for some Markdown renderers, but the same pattern at line 230 uses "Magento_*" without escaping. For consistency, both instances should use the same escaping pattern. Most modern Markdown renderers don't require escaping underscores when they're part of literal text, so consider removing the backslash escape for consistency.