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

Remove duplicated code from embedded clang-format internals #92

Merged
merged 1 commit into from
Mar 2, 2024

Conversation

lopopolo
Copy link
Member

@lopopolo lopopolo commented Mar 2, 2024

Refactor process spawning and stdout capturing setup to a helper function. This removes noise from format and clangFormatVersion such that these functions are easier to read.

This also DRYs up the code.

This was also an opportunity to clean up the event handlers on the child process. The ordering of error and close events is well-defined, so we can avoid tracking error status and instead just remove event handlers.

Refactor process spawning and stdout capturing setup to a helper
function. This removes noise from `format` and `clangFormatVersion` such
that these functions are easier to read.

This also DRYs up the code.

This was also an opportunity to clean up the event handlers on the child
process. The ordering of `error` and `close` events is well-defined, so
we can avoid tracking error status and instead just remove event
handlers.
@lopopolo lopopolo added C-quality Category: Refactoring, cleanup, and quality improvements. A-clang-format Area: Wrapper around clang-format. labels Mar 2, 2024
@lopopolo lopopolo merged commit d6d7aff into trunk Mar 2, 2024
9 checks passed
@lopopolo lopopolo deleted the lopopolo/clang-format-spawn-refactor branch March 2, 2024 04:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-clang-format Area: Wrapper around clang-format. C-quality Category: Refactoring, cleanup, and quality improvements.
Development

Successfully merging this pull request may close these issues.

1 participant