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

comments-indentation: comment not indented like content should issue an error #375

Open
pmalek-sumo opened this issue Apr 12, 2021 · 3 comments

Comments

@pmalek-sumo
Copy link
Contributor

pmalek-sumo commented Apr 12, 2021

I believe the following yaml:

## Random stuff

stuff:
  ## uncomment for the debug mode
  # debug: true

shouldn't cause an error like this:

  4:3       error    comment not indented like content  (comments-indentation)

Config used:

extends: relaxed

rules:
    comments: enable
    comments-indentation: enable

    line-length:
        max: 140
        level: warning

    indentation:
        level: warning
        indent-sequences: consistent
@adrienverge
Copy link
Owner

adrienverge commented May 25, 2021

I guess you meant "should not cause an error like this"?

This is probably a very subjective topic, depending on how you "see" and "feel" YAML.

I kind of agree with what you say. However, some others users would dislike such a change, because it would mean this wrongly-indented comment wouldn't be reported:

todo list:
  item 1:
  item 2: 
  item 3:
    # item 4: ✓
  item 5:
  item 6: 

@pmalek-sumo
Copy link
Contributor Author

I guess you meant "should not cause an error like this"?

Yup, corrected.

This kinda makes sense. Maybe this is specific for our use case where we comment our yaml files extensively to make users aware what are they configuring.

Specifically we use ## to indicate comments about below commented code (which is optional) to describe what it would configure in case it wasn't uncommented.

Maybe there's a way to separate this with what you described? OTOH they are both comments and yamllint's config mentions specifically about comments-indentation nothing else.

@Vanav
Copy link

Vanav commented Jun 3, 2023

Related: #141, #384.

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

No branches or pull requests

3 participants