question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tabs indentation is not considered as invalid

See original GitHub issue

Tab indentation will basically result as a non-char when parsing YAML.

For instance:

a:
        b:
                c: yo mamma

As tab indented comes out as:

js-yaml test.yaml 

{ a: null, b: null, c: 'yo mamma' }

It would be safer and easier to debug if the file would not be parseable on tab indent.

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Reactions:2
  • Comments:26 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
puzrincommented, Jul 17, 2018

Everyone who wish to invent “spec improvements” instead of following standard, can continue in fork. That’s out of this project scope.

4reactions
ingydotnetcommented, Nov 21, 2015

Greetings. I am one of the creators of YAML. Tabs are not allowed in indentation and an error should happen when they are detected in a place where indentation might occur.

IMHO libyaml is the most perfect implementation of the YAML 1.1 spec (which is very close to YAML 1.2).

Here is the result of the OP test in Perl’s libyaml binding: https://gist.github.com/ac5821875eb30979f7a8 Here is the same program in Python: https://gist.github.com/582ea40dbdcd473249a4

They both throw the same error. I believe it is a wise choice to test arguable behaviors against a libyaml binding. Possibly even moreso than the spec.

FWIW, we spent every day for 3 months (circa 2003) trying to sanely allow tabs into YAML indentation. We came to the conclusion that it was an insane endeavor. (It ends up being much harder than, say, Python indentation based scoping).

Read more comments on GitHub >

github_iconTop Results From Across the Web

A YAML file cannot contain tabs as indentation - Stack Overflow
A YAML file use spaces as indentation, you can use 2 or 4 spaces for indentation, but no tab. In other words, tab...
Read more >
Why is using tabs for indentation invalid in YAML? - Quora
Using tab could lead to inconsistency depends on the environment. In order to be consistent across different environment, spaces is more desirable.
Read more >
Tabs and indents settings does not work
Hello,. I have a problem with tab and indents settings. In settings->codestyle->php->tabs&indents I have set tab character for indent.
Read more >
TabError inconsistent use of tabs and spaces in indentation
In Python, You can indent using tabs and spaces in Python. Both of these are considered to be whitespaces when you code. So,...
Read more >
Invalid indentation, you can use tabs or spaces but not both
I just solve this. As it says, you can't use both tabs and space for indentation. You can change space for indentation in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Hashnode Post

No results found