Skip to content

Commit

Permalink
Adds --bail flag
Browse files Browse the repository at this point in the history
  • Loading branch information
nunomaduro committed Mar 20, 2024
1 parent fb4e240 commit 7cf6830
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
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 @@ -35,6 +35,7 @@ protected function configure()
->setDefinition(
[
new InputArgument('path', InputArgument::IS_ARRAY, 'The path to fix', [(string) getcwd()]),
new InputOption('bail', '', InputOption::VALUE_NONE, 'Test for code style errors without fixing them and stop on first error'),
new InputOption('config', '', InputOption::VALUE_REQUIRED, 'The configuration that should be used'),
new InputOption('no-config', '', InputOption::VALUE_NONE, 'Disable loading any configuration file'),
new InputOption('preset', '', InputOption::VALUE_REQUIRED, 'The preset that should be used'),
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

0 comments on commit 7cf6830

Please sign in to comment.