-
Notifications
You must be signed in to change notification settings - Fork 69
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
Replace yamllint with yamlfmt #1245
base: main
Are you sure you want to change the base?
Conversation
--- | ||
# MegaLinter GitHub Action configuration file | ||
# More info at https://oxsecurity.github.io/megalinter | ||
name: mega-linter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: mega-linter | |
name: yamlfmt |
contents: read | ||
jobs: | ||
build: | ||
name: mega-linter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
name: mega-linter | |
name: yamlfmt |
- name: 'run yamlfmt' | ||
run: |- | ||
make yamlfmt | ||
git diff --exit-code\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the trailing slash expected?
- name: {{ .svc.rg }} | ||
subscription: {{ .svc.subscription }} | ||
aksCluster: {{ .aksName }} | ||
- name: {? {.svc.rg: ''} : ''} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these changes with go templates conditional/ternary operators expected as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also changes the behavior where instead of the template failing if the variable is not set, it'll set defaults to empty strings which may not produce desired outcome. Seems like its better to let it fail than to use empty strings and hope for the best?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the templates fail and should fail if a variable can't be resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The yaml formatter changed this for us. I think we have to convert things to strings as a result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh wow TIL https://yaml.org/spec/1.2.2/#rule-e-node
I didn't think this was valid YAML... To essentially this not only add some yaml ternary blocks but breaks our templating?
Is there a rule we can exclude from the formatter to avoid it messing with our templating?
+1 from me |
- name: 'run yamlfmt' | ||
run: |- | ||
make yamlfmt | ||
git diff --exit-code\ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
small UX suggestion :)
git diff --exit-code\ | |
git diff --exit-code | |
[ $? -ne 0 ] && echo "YAML formatting needed. Please run `make yamlfmt` to resolve automatically" |
Please rebase pull request. |
What this PR does
Replaces the megalinter yamllint with yamlfmt so that instead of us doing manual work to format yaml files correctly, we can just let the computers do it for us.