handle indented starting lines
RonnyPfannschmidt opened this issue · comments
as per pytest-dev/pytest#8923 the following is legal in setup.cfg
[options.extras_require]
tests =
pytest
a mode to handle completely indented sections should be considered
It's more tricky than it may seem at frist glance.
One approach could be to dedent all sections before processing in _parse
as usual, e.g. using textwrap.dedent such that:
[section2]
name1=
line1
name2=line2
will become
[section2]
name1=
line1
name2=line2
Then repeat the the same for all "contents" of sections, such following would be parsed just as the dedented version above.
[section2]
name1=
line1
name2=line2
However, this following config file would still be invalid (and maybe it just should be invalid? -- but this should be specified somewhere):
[section2]
name1=line1
name2=line2
thanks for elaboration
indeed, the last example should be invalid,
there will not be a dedent, but initial indent should trigger a warning
i decided to not support this at all, as its too simple to get into weird error modes