adrienverge / yamllint

A linter for YAML files.
GNU General Public License v3.0
2.87k stars 275 forks source link

`comments-indentation` false positive #574

Closed Vanav closed 1 year ago

Vanav commented 1 year ago

Error example:

- block:
  - name: Command 1
    command: test 1
  #- name: Command 2
  #  command: test 2

Output:

yaml[comments-indentation]: Comment not indented like content
roles/base/tasks/RedHat-test.yml:4

.yamllint:

rules:
  indentation:
    indent-sequences: consistent
  comments:
    require-starting-space: false
  comments-indentation: {}

No error:

- block:
  #- name: Command 2
  #  command: test 2
  - name: Command 1
    command: test 1

I'm using ansible-lint latest version 6.17.0. Seems parser doesn't like comment block at the end of file..

adrienverge commented 1 year ago

Hello,

Could this be a duplicate of https://github.com/adrienverge/yamllint/issues/384 (and https://github.com/adrienverge/yamllint/issues/141)?

Vanav commented 1 year ago

Yes, I've not found it, I'm sorry.