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

Exit on error when something was wrong executing the command #304

Merged
merged 2 commits into from
Jun 3, 2024

Conversation

stronk7
Copy link
Member

@stronk7 stronk7 commented Jun 3, 2024

When something abnormal happens (wrong configuration, missing stuff, connectivity problems, etc., the phpcs execution can end with error.

But, if max-warnings is enabled (>=0), then the count of errors and warnings (that is always 0 on error) gets precedence, hiding the real exit status. Hence it passes, when really it was not executed.

Now we detect those abnormal situations and exit with error when something in the execution goes wrong.

Covered with tests, checking all the possible max-warnings combinations.

When something abnormal happens (wrong configuration, missing stuff,
connectivity problems, etc., the phpcs execution can end with error.

But, if max-warnings is enabled (>=0), then the count of errors and
warnings (that is always 0 on error) gets precedence, hiding the
real exit status. Hence it passes, when really it was not executed.

Now we detect those abnormal situations and exit with error when
something in the execution goes wrong.

Covered with tests, checking all the possible max-warnings combinations.
Copy link

codecov bot commented Jun 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.23%. Comparing base (783ec09) to head (84bcf2c).

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #304      +/-   ##
============================================
+ Coverage     88.22%   88.23%   +0.01%     
- Complexity      734      735       +1     
============================================
  Files            76       76              
  Lines          2267     2269       +2     
============================================
+ Hits           2000     2002       +2     
  Misses          267      267              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

To avoid some NodeJS 16 warnings.
@stronk7
Copy link
Member Author

stronk7 commented Jun 3, 2024

PS: Also, added a tiny 2nd commit that updates one GH Action to newer version that doesn't emit NodeJS 16 deprecation warnings.

Copy link
Member

@kabalin kabalin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Eloy, this looks good to me.

@stronk7
Copy link
Member Author

stronk7 commented Jun 3, 2024

tata, RK!

@stronk7 stronk7 merged commit 35a982b into moodlehq:main Jun 3, 2024
25 checks passed
@stronk7 stronk7 deleted the better_detect_exit_codes branch June 3, 2024 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants