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

Megalinter: Validation failed - "truthy" acts on "on"-keyword (swagger-editor-validator.yaml) #211

Closed
maxl2287 opened this issue Sep 4, 2023 · 2 comments · Fixed by #212

Comments

@maxl2287
Copy link
Collaborator

maxl2287 commented Sep 4, 2023

Describe the bug

I discovered a bug during a PR creation.

YAMLLINT failure
❌ Linted [YAML] files with [yamllint]: Found 1 error(s) - (1.34s) (expand for details)

  • Using [yamllint v1.32.0] https://megalinter.io/7.3.0/descriptors/yaml_yamllint
  • MegaLinter key: [YAML_YAMLLINT]
  • Rules config: [/github/workspace/.yamllint.yaml]
  • Number of files analyzed: [6]
    --Error detail:
    .github/workflows/swagger-editor-validator.yml
    Error: 2:1 [truthy] truthy value should be one of [false, true]

✅ Linted [REPOSITORY] files with [git_diff] successfully - (0.06s) (expand for details)
✅ Linted [OPENAPI] files with [spectral] successfully - (3.54s) (expand for details)

+----SUMMARY----+------------+---------------+-------+-------+--------+--------------+
| Descriptor | Linter | Mode | Files | Fixed | Errors | Elapsed time |
+---------------+------------+---------------+-------+-------+--------+--------------+
| ✅ ACTION | actionlint | list_of_files | 2 | | 0 | 0.0s |
| ✅ OPENAPI | spectral | file | 1 | | 0 | 3.54s |
| ✅ REPOSITORY | git_diff | project | n/a | | 0 | 0.06s |
| ✅ REPOSITORY | grype | project | n/a | | 0 | 12.98s |
| ✅ REPOSITORY | secretlint | project | n/a | | 0 | 1.33s |
| ✅ REPOSITORY | trivy-sbom | project | n/a | | 0 | 1.59s |
| ✅ REPOSITORY | trufflehog | project | n/a | | 0 | 5.29s |
| ✅ XML | xmllint | list_of_files | 2 | 0 | 0 | 0.06s |
| ✅ YAML | v8r | list_of_files | 6 | | 0 | 5.08s |
| ❌ YAML | yamllint | list_of_files | 6 | | 1 | 1.34s |
+---------------+------------+---------------+-------+-------+--------+--------------+

Why is there an error

  • Megalinter acts on truthy-values for "on"-keywords

Expected behavior
Disable truthy "on" rule-validation.

on:  # yamllint disable-line rule:truthy
  pull_request:
    branches:
      - main
@maxl2287
Copy link
Collaborator Author

maxl2287 commented Sep 4, 2023

Related issues on "yamllint":
adrienverge/yamllint#430

@maxl2287
Copy link
Collaborator Author

maxl2287 commented Sep 4, 2023

allowed-values defines the list of truthy values which will be ignored during linting. The default is ['true', 'false'], but can be changed to any list containing: 'TRUE', 'True', 'true', 'FALSE', 'False', 'false', 'YES', 'Yes', 'yes', 'NO', 'No', 'no', 'ON', 'On', 'on', 'OFF', 'Off', 'off'.

Maybe also "on" could be put on the list of "truthy"-ignored values for keywords.
source: https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.truthy

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 a pull request may close this issue.

1 participant