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 yamllint to linters #7818

Merged
merged 1 commit into from
Aug 22, 2023
Merged

Add yamllint to linters #7818

merged 1 commit into from
Aug 22, 2023

Conversation

jeffwidman
Copy link
Member

@jeffwidman jeffwidman commented Aug 16, 2023

We've got a lot of YAML in this repo... as this repo gets more popular, we'll benefit from having some consistency / linter in place.

Fix #5572

@Nishnha
Copy link
Member

Nishnha commented Aug 18, 2023

We might also want to ignore the --- document start rule?

[document-start] missing document start "---"

- 'common/**'
- 'updater/**'
- 'npm_and_yarn/**'
- uses: actions/checkout@v3
Copy link
Member Author

Choose a reason for hiding this comment

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

I configured yamllint to not try to enforce a particular style for indentation, as long as the file was internally consistent.

So here for example, the problem is that the indentation varied depending on the section of the file.

- "composer/helpers/v2/vendor/*"
- "github_actions/spec/fixtures/*"
- go_modules/spec/fixtures/projects/nested_vendor/nested/vendor/github.com/pkg/errors/appveyor.yml
- go_modules/spec/fixtures/projects/vendor/vendor/github.com/pkg/errors/appveyor.yml
Copy link
Member Author

Choose a reason for hiding this comment

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

Where possible, I'd rather disable within the yaml file itself by adding: # yamllint disable-file to the top of the file. However, for both of these files, since they were vendored from upstream, I thought better to explicitly ignore here... that way we can easily rebuild the fixture w/o worrying about comment diffs.

@@ -1,5 +1,5 @@
name: Specs
on:
on: # yamllint disable-line rule:truthy
Copy link
Member Author

Choose a reason for hiding this comment

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

# yamllint disable-line rule:truthy

This was annoying to disable on a case-by-case basis, but the rule looks actually helpful, so I left it enabled and just added inline comments.

We've got a lot of YAML in this repo... as this repo gets more popular,
we'll benefit from having some consistency / linter in place.

I loosened up the default rule set a bit to allow flexibility for a
variety of styles, as long as things were internally consistent to the
file.
@jeffwidman jeffwidman merged commit db8c66a into main Aug 22, 2023
90 checks passed
@jeffwidman jeffwidman deleted the add-yamllint branch August 22, 2023 22:18
brettfo pushed a commit to brettfo/dependabot-core that referenced this pull request Oct 11, 2023
We've got a lot of YAML in this repo... as this repo gets more popular,
we'll benefit from having some consistency / linter in place.

I loosened up the default rule set a bit to allow flexibility for a
variety of styles, as long as things were internally consistent to the
file.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dart:pub Dart packages via pub L: docker Docker containers L: javascript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Run yamllint on PR's
3 participants