Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Wrong indentation for Arrays #167

Open
pawelhertman opened this issue Feb 2, 2018 · 0 comments
Open

Wrong indentation for Arrays #167

pawelhertman opened this issue Feb 2, 2018 · 0 comments

Comments

@pawelhertman
Copy link

"check_indentation" rule enforces wrong indentations for arrays.

When it's turned on this code is correct:

variable = [
'sdfsdfg',
'sdfgsdfg',
]

while this is not:

variable = [
  'sdfsdfg',
  'sdfgsdfg',
]

In (not only) my opinion the second notation should be accepted.
For associative arrays the rule works correct.

I'm not familiar with Python, so I'm not able to contribute, but I guess the problem occurs because in lexer/regexs.py signs [ and ] are matched with "NO_INDENTATION"

[r"\[", const.OPEN_SQUARE_BRACKET, const.OPEN_SQUARE_BRACKET, const.NO_INDENTATION],
    [r"\]", const.CLOSE_SQUARE_BRACKET, const.CLOSE_SQUARE_BRACKET, const.NO_INDENTATION],

what in fact is correct because these signs can be used as Array Operator to access array's value.
So the solution probably is to create another regexes to recognize brackets as array initialization when they appear after = sign.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant