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

feat(cli)!: In case of errors, exit with code 1 #41

Merged
merged 1 commit into from
Mar 22, 2024
Merged

Conversation

RandomByte
Copy link
Member

@RandomByte RandomByte commented Mar 20, 2024

This change alignes UI5 linter with ESLint (see 1):

  • No errors, maybe warnings: Use exit code 0
  • At least one error: Use exit code 1
  • Unexpected error (typically caused by an exception): Use exit code 2

BREAKING CHANGE: Depending on how UI5 linter is being used, this change
might change the behavior of that particular scenario. For example a
build script might abort further processing, if any linting errors
are detected.

To ignore exit code 1, for example in a bash script, you may use a
construct like this:

ui5lint && RC=$? || RC=$?
if [[ "$RC" = 2 ]]; then
    exit 1
fi

JIRA: CPOUI5FOUNDATION-823

@RandomByte RandomByte requested a review from a team March 20, 2024 15:51
matz3
matz3 previously requested changes Mar 20, 2024
Copy link
Member

@matz3 matz3 left a comment

Choose a reason for hiding this comment

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

Isn't this a breaking change?

@RandomByte
Copy link
Member Author

Isn't this a breaking change?

True, done

@RandomByte RandomByte changed the title feat(cli): In case of errors, exit with code 1 feat(cli)!: In case of errors, exit with code 1 Mar 21, 2024
@flovogt
Copy link
Member

flovogt commented Mar 21, 2024

Please add also the jira item id CPOUI5FOUNDATION-823 to the commit message

This change alignes UI5 linter with ESLint (see [1]):
* No errors, maybe warnings: Use exit code 0
* At least one error: Use exit code 1
* Unexpected error (typically caused by an exception): Use exit code 2

BREAKING CHANGE: Depending on how UI5 linter is being used, this change
might change the behavior of that particular scenario. For example a
build script might abort further processing, if any linting errors
are detected.

To ignore exit code 1, for example in a bash script, you may use a
construct like this:
```sh
ui5lint && RC=$? || RC=$?
if [[ "$RC" = 2 ]]; then
    exit 1
fi
```

JIRA: CPOUI5FOUNDATION-823

[1]: https://eslint.org/docs/latest/use/command-line-interface#exit-codes
@RandomByte
Copy link
Member Author

Please add also the jira item id CPOUI5FOUNDATION-823 to the commit message

Done 👍

@flovogt flovogt requested a review from matz3 March 22, 2024 08:34
@RandomByte RandomByte merged commit 96331fc into main Mar 22, 2024
7 checks passed
@RandomByte RandomByte deleted the align-exit-code branch March 22, 2024 09:24
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.

3 participants