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

Backport of cli: fmt -check should return early on diff into release/1.4.x #16191

Conversation

hc-github-team-nomad-core
Copy link
Contributor

Backport

This PR is auto-generated from #16174 to be assessed for backporting due to the inclusion of the label backport/1.4.x.

The below text is copied from the body of the original PR.


Fixes #16170

The nomad fmt -check command incorrectly writes to file because we didn't
return before writing the file on a diff. Fix this bug and update the command
internals to differentiate between the write-to-file and write-to-stdout code
paths, which are activated by different combinations of options and flags.

The docstring for the -list and -write flags is also unclear and can be
easily misread to be the opposite of the actual behavior. Clarify this and fix
up the docs to match.

This changeset also refactors the tests quite a bit so as to make the test
outputs clear when something is incorrect and avoid reusing the UI state.

@hc-github-team-nomad-core hc-github-team-nomad-core force-pushed the backport/cli-nomad-fmt-exit-codes/rightly-suitable-martin branch 2 times, most recently from 4f68dbd to dacccbe Compare February 15, 2023 19:06
@hc-github-team-nomad-core hc-github-team-nomad-core merged commit 55cdce6 into release/1.4.x Feb 15, 2023
@hc-github-team-nomad-core hc-github-team-nomad-core deleted the backport/cli-nomad-fmt-exit-codes/rightly-suitable-martin branch February 15, 2023 19:06
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.

None yet

2 participants