-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[FrameworkBundle][TranslationDebug] Return non-zero exit code on failure #29139
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
[FrameworkBundle][TranslationDebug] Return non-zero exit code on failure #29139
Conversation
7965ed3
to
0e4e925
Compare
Hi everyone! First time symfony contributor here. It’d be super swell to get this merged in. What do I need to do to get some code review for this? |
@nicolas-grekas @fabpot what should I do to expedite the process of merging this in? |
We're in feature freeze finalizing version 4.2. we'll start merging new features again in two to three weeks (after/during SymfonyCon Lisbon I'd say.) |
@@ -81,6 +84,7 @@ protected function configure() | |||
new InputOption('only-missing', null, InputOption::VALUE_NONE, 'Displays only missing messages'), | |||
new InputOption('only-unused', null, InputOption::VALUE_NONE, 'Displays only unused messages'), | |||
new InputOption('all', null, InputOption::VALUE_NONE, 'Load messages from all registered bundles'), | |||
new InputOption('strict', null, InputOption::VALUE_OPTIONAL, 'Returns a non-zero exit code upon failure', false), |
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.
at first, the description made me think this was a boolean option.
what about --fail-on-missing
etc (would be more flexible also)?
Not a big fan of adding a new flag for that. I think not returning a non-zero exit code was a mistake and should be done without a flag. |
0e4e925
to
ed56b0d
Compare
Hello @fabpot and @nicolas-grekas! Apologies for the delay. Originally I thought it was silly to not return a non-zero exit code by default as well, but then I realized that this command could be used for fallback messages. Because of this, knowing when to return a non-zero status code could be difficult (e.g. should the command return a non-zero exit code due to missing a localized translation or should it return a successful zero exit code because a fallback could be used instead). When initially writing the this PR, I pulled inspiration from composer's outdated command and the ability to increase verbosity levels in numerous commands ( |
e1b45e9
to
990dbc0
Compare
I still think that this should not be configurable via an option. The return code could be different based on the kind of errors though. |
990dbc0
to
3a9f7c3
Compare
@fabpot I have changed this PR to return a non-zero exit code on failure. Can you please re-review this? Thank you both for your feedback 🙂 |
src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
Outdated
Show resolved
Hide resolved
@DAcodedBEAT Still interested in finishing this PR? |
3a9f7c3
to
3dfcc8e
Compare
Hello @fabpot! Sorry for the delay. Yes, I am still interested in finishing this Pull Request! I have pushed up the changes requested. Thank you for the reminder! 🙂 |
3dfcc8e
to
e50ecfb
Compare
Thank you @DAcodedBEAT. |
e50ecfb
to
0baafd8
Compare
This PR introduces non-zero exit codes upon failure for the
debug:translations
command. The addition can be useful for projects which wish to determine results easily in CI.The exit code returned can be interpreted as a bit array and to determine what failed, one could Bitwise AND the returned exit code to determine what failed.
Exit Codes:
1000000
1000001
1000010
1000100
Example: Given there are missing and unused translations, the expected status code would be
TranslationDebugCommand::EXIT_CODE_MISSING | TranslationDebugCommand::EXIT_CODE_UNUSED
, which would be evaluated to67
.