Comments (4)
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.
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.
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.
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)
- azure pipeline expression ${{ else }} false positive key-duplicates HOT 2
- `test_run_with_user_global_config_file` fails if `XDG_CONFIG_HOME` is set HOT 2
- flake8 → ruff? HOT 9
- New-line problem on Windows HOT 2
- Enable ruff format? HOT 7
- problemfixer.py", line 256, in fix_wrong_indentation HOT 2
- Feature Request: Support for Configuration in `pyproject.toml` HOT 2
- Optional extended detection in key-duplicates HOT 3
- Create GitHub releases with changelogs HOT 6
- EditorConfig support HOT 1
- Weird lint error on github action yaml HOT 1
- 1.35.0 broke the "ignore" feature HOT 8
- Is there a quick way of enabling all rules?
- Check values for empty strings if quotas
- Expected <document start> but found <scalar> syntax error wrt comment line between scalars HOT 1
- Snap release HOT 2
- "string value is redundantly quoted with single quotes" when string contains line break and backslash HOT 8
- yamllint should provide meaningful output if no results found HOT 6
- "string value is redundantly quoted with single quotes" when string is a timestamp HOT 1
- False positive with github actions yaml HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yamllint.