Giter VIP home page Giter VIP logo

Comments (4)

waylan avatar waylan commented on May 18, 2024 3

First, while I understand how it works, I hate that indentation convention (I know many people use that for Markdown lists, which I also hate), I want to hit the tab key once for each level of indent and that's it. As it is now, I would need to type 2 tabs & 2 spaces for the second level of indent and 4 tabs for the third level of indent. The fact that every other level switches between a half-tab and a full tab is even more annoying.

In fact, the documentation suggests that the options are there for those who don't want that behavior (specifically it says: "when in a mapping, this indentation is not mandatory"). Yet, I can't get anything but that behavior, so something is broken. At the very least whatever should allow my scheme, but even that doesn't work.

To be clear, for multiple-line text fields, I understand it (even if I don't like it). For everything else that should not be how it works, IMO. If others disagree, fine, but please give me the option to do it my way.

from yamllint.

adrienverge avatar adrienverge commented on May 18, 2024 1

Hey @waylan,

I got what you mean. This behavior is intended, so this is not a bug. I think the problem lies in what you said at the end: I realize the documentation acknowledges that "some people perceive the - as part of the indentation".

I can agree the perception of this is quite subjective, but I'll try to explain why most people start counting indentation after the - token. For this, let's replace some of your items by other structures (let's say, long strings, arrays and dictionnaries), and let's use yamllint's way of indenting:

---
items:
    - Item 1: item-1
    - Item 2:
          - - Item 2.1.1
            - Item 2.1.2
            - Item 2.1.3
          - - Item 2.2.1
            - Item 2.2.2
            - Item 2.2.3
    - Item 3:
          - this
            is a
            multiline string
          - key-a: A
            key-b: B
            key-c: C

If we took your way of indenting, it would have given this:

---
items:
    - Item 1: item-1
    - Item 2:
        - - Item 2.1.1
            - Item 2.1.2
            - Item 2.1.3
        - - Item 2.2.1
            - Item 2.2.2
            - Item 2.2.3
    - Item 3:
        - this
        is a
        multiline string
        - key-a: A
        key-b: B
        key-c: C

... which is not the same structure (it is actually not even valid YAML).

I hope this helps, let me know if I wasn't clear!

from yamllint.

wilhelmer avatar wilhelmer commented on May 18, 2024 1

First, while I understand how it works, I hate that indentation convention (I know many people use that for Markdown lists, which I also hate), I want to hit the tab key once for each level of indent and that's it. As it is now, I would need to type 2 tabs & 2 spaces for the second level of indent and 4 tabs for the third level of indent. The fact that every other level switches between a half-tab and a full tab is even more annoying.

In fact, the documentation suggests that the options are there for those who don't want that behavior (specifically it says: "when in a mapping, this indentation is not mandatory"). Yet, I can't get anything but that behavior, so something is broken. At the very least whatever should allow my scheme, but even that doesn't work.

100% agree.

Almost 4 years later, this still keeps me from using yamllint. Every YML checker in the worlds says this is perfectly valid YML, except for yamllint:

foo:
    - bar:
        - baz

from yamllint.

waylan avatar waylan commented on May 18, 2024

As a compromise I would be okay with this

item 1:  
    - A block of text
      with multiple lines
      which is indented
      by 6 spaces.
    - item 1-2:
        - item 1-2-1: indented 8 spaces

Here, the secondary lines of a text block are indented the extra two spaces to account for the - on the first line. However, nested, non-text block items get the full 8 spaces of indent. Yes, this is what "consistent" means to me. This is also what I assumed was meant by "when in a mapping, this indentation is not mandatory" in the documentation. If that means something else, then I suggest an update to the docs.

from yamllint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.