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

Add auto-format yaml pre-commit hook #71

Merged
merged 6 commits into from
Sep 24, 2024

Conversation

DanielYang59
Copy link
Contributor

@DanielYang59 DanielYang59 commented Sep 24, 2024

@janosh janosh added the linting Quality assurance and style fixes label Sep 24, 2024
Copy link
Owner

@janosh janosh left a comment

Choose a reason for hiding this comment

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

lgtm. 👍 anything you'd like to add?

rev: v0.13.0
hooks:
- id: yamlfmt
args: [-formatter, retain_line_breaks=true]
Copy link
Contributor Author

@DanielYang59 DanielYang59 Sep 24, 2024

Choose a reason for hiding this comment

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

lgtm. 👍 anything you'd like to add?

I guess not, I was trying to find an arg to retain the line breaks, glad you foundknew it!

Let me try to push a "bad" commit and see if it works.

Copy link
Owner

Choose a reason for hiding this comment

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

you don't need to push. after pre-commit install it will prevent the commit locally already

Copy link
Contributor Author

Choose a reason for hiding this comment

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

in case someone don't have pre-commit installed :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah great, I just found the retain_line_breaks arg here, I was looking at the wrong docs

@DanielYang59 DanielYang59 marked this pull request as ready for review September 24, 2024 11:30
@janosh janosh merged commit 97732d7 into janosh:main Sep 24, 2024
3 checks passed
@DanielYang59 DanielYang59 deleted the auto-yaml-format branch September 24, 2024 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
linting Quality assurance and style fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants