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

.pre-commit-config.yaml is not valid yaml #2402

Open
konstruktoid opened this issue Dec 21, 2023 · 3 comments
Open

.pre-commit-config.yaml is not valid yaml #2402

konstruktoid opened this issue Dec 21, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@konstruktoid
Copy link

https://github.com/konstruktoid/ansible-role-hardening/pull/456/files#diff-63a9c44a44acf85fea213a857769990937107cf072831e1a26808cfde9d096b9

$ yamllint .pre-commit-config.yaml
.pre-commit-config.yaml
  1:1       warning  missing document start "---"  (document-start)
  2:1       error    wrong indentation: expected at least 1  (indentation)
  5:3       error    wrong indentation: expected at least 3  (indentation)
  9:3       error    wrong indentation: expected at least 3  (indentation)
  13:3      error    wrong indentation: expected at least 3  (indentation)
@konstruktoid
Copy link
Author

Related #2232

@varunsh-coder
Copy link
Member

Thanks @konstruktoid for creating the issue!

I tried to validate the YAML online and it shows it as valid YAML.

I believe this is failing yamllint checks for indentation and I am wondering if different repos/ users might have different config for yamllint or is this a standard check which is failing?

@varunsh-coder varunsh-coder added the bug Something isn't working label Jan 1, 2024
@konstruktoid
Copy link
Author

Yeah, as all linters it's a bit opinionated and this issue should probably be low priority.

But using eg https://www.yamllint.com, will turn the file from

repos:
- repo: https://github.com/gitleaks/gitleaks
  rev: v8.16.3
  hooks:
  - id: gitleaks
- repo: https://github.com/jumanjihouse/pre-commit-hooks
  rev: 3.0.0
  hooks:
  - id: shellcheck
- repo: https://github.com/pre-commit/pre-commit-hooks
  rev: v4.4.0
  hooks:
  - id: end-of-file-fixer
  - id: trailing-whitespace

and into

---
repos:
  - repo: https://github.com/gitleaks/gitleaks
    rev: v8.16.3
    hooks:
      - id: gitleaks
  - repo: https://github.com/jumanjihouse/pre-commit-hooks
    rev: 3.0.0
    hooks:
      - id: shellcheck
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v4.4.0
    hooks:
      - id: end-of-file-fixer
      - id: trailing-whitespace

yamllint indentation rules: https://yamllint.readthedocs.io/en/stable/rules.html#module-yamllint.rules.indentation
The --- isn't required.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants