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

yamllint: fix various yamllint warning #53449

Merged
merged 8 commits into from
Jan 3, 2023

Conversation

fabiobaltieri
Copy link
Member

@fabiobaltieri fabiobaltieri commented Jan 3, 2023

Fix most yamllint warnings from the config proposed in #53398 (with a few tweaks).

Fixes all: brackets, colons, commas, comments, empty-lines, hyphens, truthy

Left:

  • 1755 indentation (separate PR, this one is big enough)
  • 9 key-duplicates (separate PR, may actually change something)
  • 33 line-length (workflow command lines, won't touch them, compliance script will skip them)

Config used:

extends: default

rules:
  line-length:
    max: 100
  comments:
    min-spaces-from-content: 1
  indentation:
    spaces: 2
    indent-sequences: consistent
  document-start:
    present: false
  truthy:
    check-keys: false

Changed from #53398: added min-spaces-from-content and decided to apply truthy also in the CI files, going to updated that PR as well.

Let me know what you think, happy to tweak the config but this seems reasonable to me.

@fabiobaltieri
Copy link
Member Author

fabiobaltieri commented Jan 3, 2023

Added an extra commit to drop few required: false from the base binding since that fails the CI now.

gmarull
gmarull previously approved these changes Jan 3, 2023
Fix all thruthy errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(truthy)'

This only accepts true/false for boolean properties. Seems like python
takes all sort of formats:

https://github.com/yaml/pyyaml/blob/master/lib/yaml/constructor.py#L224-L235

But the current specs only mention "true" or "false"

https://yaml.org/spec/1.2.2/#10212-boolean

Which is the standard yamllint config.

Excluding codeconv and workflow files, as some are using yes/no instead
in the respective documentation.

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all brackets errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(brackets)'

Default config is to have no spaces inside brackets, changed few
documentation strings as well that refered to lists even though the
linter does not care about those.

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all colons and commas errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(brackets)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(commas)'

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(empty-lines)'

Default config is no space before, one space after, max 2 empty lines.

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all hyphens errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(hyphens)'

Default config is only one space after the hyphen.

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all hyphens errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(comments)'

Default config would be to require two spaces after the start of the
comment, proposing to keep it on 1, inline with the Linux binding
config, that is:

```
-  comments:
-    min-spaces-from-content: 1
```

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all comments-indentation errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(comments-indentation)'

This checks that the comment is aligned with the content.

Signed-off-by: Fabio Baltieri <[email protected]>
Fix all line-length errors detected by yamllint:

yamllint -f parsable -c .yamllint $( find -regex '.*\.y[a]*ml' ) | \
  grep '(line-length)'

Using a limit is set to 100 columns, not touching the commandlines in
GitHub workflows (at least for now).

Signed-off-by: Fabio Baltieri <[email protected]>
It's redundant and it's failing the compliance CI check.

Signed-off-by: Fabio Baltieri <[email protected]>
@fabiobaltieri
Copy link
Member Author

Updated:

  • reverted comment_mode changes in .github files
  • reverted back to on/off for codecov.yml

@stephanosio stephanosio requested a review from gmarull January 3, 2023 16:12
@stephanosio stephanosio merged commit f03f7fd into zephyrproject-rtos:main Jan 3, 2023
@fabiobaltieri fabiobaltieri deleted the compliance-fixes branch January 3, 2023 16:28
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.

4 participants