It is. you can parse something given how it's indented. Doesn't mean that the resulting code is actually correct (from the logic point of view). And you cannot properly format it because the logic is ambiguous.
Both of these are valid code. One (or both of them) are incorrect
if x > 0:
function1()
function2()
function3()
if x > 0:
function1()
function2()
function3()
No formatter will be able to guess which one is correct. It will do a best effort approximation. But good luck figuring out how to format a YAML file: db:
mysqldatabase:
hostname: localhost
port: 3012
username: root
password: root
Oh oops. Valid file. Can be parsed. Invalid indentation> IDEA (by now) does very stupid things while trying hard to be smart.
This is beside the point.