Skip to content
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

[1.x] Adds --bail flag #261

Merged
merged 2 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Actions/ElaborateSummary.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function execute($totalFiles, $changes)
0,
0,
$this->output->getVerbosity() >= OutputInterface::VERBOSITY_VERBOSE,
$this->input->getOption('test'),
$this->input->getOption('test') || $this->input->getOption('bail'),
$this->output->isDecorated()
);

Expand Down
1 change: 1 addition & 0 deletions app/Commands/DefaultCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ protected function configure()
new InputOption('no-config', '', InputOption::VALUE_NONE, 'Disable loading any configuration file'),
new InputOption('preset', '', InputOption::VALUE_REQUIRED, 'The preset that should be used'),
new InputOption('test', '', InputOption::VALUE_NONE, 'Test for code style errors without fixing them'),
new InputOption('bail', '', InputOption::VALUE_NONE, 'Test for code style errors without fixing them and stop on first error'),
new InputOption('dirty', '', InputOption::VALUE_NONE, 'Only fix files that have uncommitted changes'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'The output format that should be used'),
new InputOption('cache-file', '', InputArgument::OPTIONAL, 'The path to the cache file'),
Expand Down
4 changes: 2 additions & 2 deletions app/Factories/ConfigurationResolverFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static function fromIO($input, $output)
sprintf('%s.php', $preset),
]),
'diff' => $output->isVerbose(),
'dry-run' => $input->getOption('test'),
'dry-run' => $input->getOption('test') || $input->getOption('bail'),
'path' => $path,
'path-mode' => ConfigurationResolver::PATH_MODE_OVERRIDE,
'cache-file' => $input->getOption('cache-file') ?? $localConfiguration->cacheFile() ?? implode(DIRECTORY_SEPARATOR, [
Expand All @@ -65,7 +65,7 @@ public static function fromIO($input, $output)
: (string) microtime()
),
]),
'stop-on-violation' => false,
'stop-on-violation' => $input->getOption('bail'),
'verbosity' => $output->getVerbosity(),
'show-progress' => 'true',
],
Expand Down
2 changes: 1 addition & 1 deletion app/Output/Concerns/InteractsWithSymbols.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getSymbol($status)
$statusSymbol = $this->statuses[$status];

if (! isset($statusSymbol['symbol'])) {
$statusSymbol = $this->input->getOption('test')
$statusSymbol = ($this->input->getOption('test') || $this->input->getOption('bail'))
? $statusSymbol[0]
: $statusSymbol[1];
}
Expand Down