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

[clang-format] Add ability for clang-format-diff to exit with non-0 status #70883

Merged

Conversation

conrad-donahue
Copy link
Contributor

This patch adds the ability for the clang-format-diff script to exit with a non-zero status if it detects that formatting changes are necessary. This makes it easier to use clang-format-diff as part of a DevOps pipeline, since you could add a stage to run clang-format-diff and fail if the formatting needs to be fixed.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang-format labels Nov 1, 2023
Copy link

github-actions bot commented Nov 1, 2023

✅ With the latest revision this PR passed the Python code formatter.

@owenca owenca removed the clang Clang issues not falling into any other category label Nov 1, 2023
Copy link
Contributor

@mydeveloperday mydeveloperday left a comment

Choose a reason for hiding this comment

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

Let go without the option for now

clang/docs/ClangFormat.rst Outdated Show resolved Hide resolved
@owenca owenca changed the title Add ability for clang-format-diff to exit with non-0 status [clang-format] Add ability for clang-format-diff to exit with non-0 status Nov 8, 2023
@owenca owenca merged commit 68d618f into llvm:main Nov 9, 2023
3 checks passed
@cbi42
Copy link

cbi42 commented Mar 26, 2024

Hi - would it make sense to call exit after all the diff_string is written to stdout? This allows a preview of all lines that need to change. Right now, it exits after printing out the changes needed for the first file.

@owenca
Copy link
Contributor

owenca commented Mar 27, 2024

See #86776.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants