Closed PrajwalM2212 closed 3 years ago
@RaiVaibhav @Nosferatul @ksdme @margobra8
It looks good to me, what will happen if the .coafile have bad syntax/ is not written properly?
@Nosferatul Is this with respect to Tool to convert .coafile to TOML config file
?
Suppose the required config is
[Default]
files = *.py, coalib/**/*.py, ./coala, tests/**/*.py, docs/conf.py
max_line_length = 80
Case 1: The user gives
[Default]
files = *.py, coalib/**/*.py, ./coala, tests/**/*.py, docs/conf.py
max_line_length =
coala will generate
<Setting object(key='max_line_length', value='', origin='/Users/prajwalm/Documents/coala/coala/.coafile', from_cli=False, to_append=False) at 0x111cd27f0>
Case 2: The user gives
[Default]
files = *.py, coalib/**/*.py, ./coala, tests/**/*.py, docs/conf.py
max_line_length
coala will generate
<Setting object(key='files', value='*.py, coalib/**/*.py, ./coala, tests/**/*.py, docs/conf.py\nmax_line_length'
when both of them should have errored during the parsing phase as they are syntactical errors. Instead, coala will error during execution
Since the tool just converts .coafile to toml config file and the existing parser manages to parse even wrong syntax to something valid, the tool will not break down and will generate a valid toml file.
As far as the problem of bad syntax/ is not written properly is concerned, I feel that wrong syntax must error during parsing and wrong values/settings must error during execution like how toml and yaml parsers do. In case 2, there is ambiguity as to whether it is a syntax error or value/setting error as coafile does not define as to what the start and end of a list/array are. I will add a future work/post-GSoC section in the cEP listing the problems in current coafile syntax and the need to develop improved syntax and parsers.
Ok, it's cool, just to keep it in mind, maybe after GSoC we can handle this. I'm not sure why we need @RJ722 and @li-boxuan approval for this pr. Also @RaiVaibhav should review it too.
The codebase automatically requests review from @RJ722 and @li-boxuan whenever a PR is opened it seems.
This is now merged as a part of https://github.com/coala/cEPs/pull/197 :)
This add cEP for Support TOML as a configuration format project
Closes https://github.com/coala/cEPs/issues/179