Skip to content

New linter yamlfmt #1011

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

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

New linter yamlfmt #1011

wants to merge 6 commits into from

Conversation

dex4er
Copy link
Contributor

@dex4er dex4er commented Apr 13, 2025

This is a configuration for https://github.com/google/yamlfmt which is the fast YAML formatter that works with different settings, ie. can format arrays with Kubernetes-style (without indentation).

Copy link

trunk-io bot commented Apr 13, 2025

⏱️ 13m total CI duration on this PR
Job Cumulative Duration Recent Runs
Linter Tests ubuntu-latest 4m 🟩🟩
Linter Tests macOS 3m 🟩🟩
CodeQL-Build 3m 🟩🟩
Trunk Check runner [linux] 2m 🟩🟩
Repo Tests / Plugin Tests 1m 🟩🟩
Detect changed files 15s 🟩🟩
Aggregate Test Results 1s 🟩🟩

settingsfeedbackdocs ⋅ learn more about trunk.io

Copy link
Contributor

@det det left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution! I've left a few notes.

@@ -0,0 +1,9 @@
exclude:
Copy link
Contributor

Choose a reason for hiding this comment

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

Some notes:

  • I'm not sure it makes sense to exclude trunk.yaml by default
  • We already ignore lock files for all formaters
  • We generally accept the defaults for each tool instead of being opinionated about style. The exception would be defaults to help the tool fit into the trunk ecosystem (ie, disable all formatting rules in a linter because we expect a user to run a separate formatter).

I would suggest deleting this file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not ignoring trunk.yaml makes that this file will be reported always after trunk upgrade or other operations. I think it would be more safe to exclude it.

Other settings are more sane than the default which basically massacres YAML files by ie. removing empty lines. It would be better to leave it to improve the user experience.

If it doesn't convince you I can remove the config file. It would be just better to not enable the plugin by default if any YAML file exists.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@det Removed

@dex4er
Copy link
Contributor Author

dex4er commented Apr 29, 2025

@det Do we miss anything else?

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

Successfully merging this pull request may close these issues.

2 participants