Some better handling of error in the configuration file
Open
@sigmavirus24 is already working on this.
Since Jun 3, 2016.
needs patch
- Dominant language
- Python
- Stars
- 5.2k
- Forks
- 754
- PR merge metrics
- No merged PRs in 30d
Description
So, I have left some merge conflict markers in my setup.cfg and this how the pep8 (run through flake8) dealt with it:
ConfigParser.py:546:_read:ParsingError: File contains parsing errors: /home/matej/archiv/knihovna/repos/m2crypto/setup.cfg
[line 2]: '<<<<<<< 642f88cb1b6027e184d9a662b255f7fea4d9eacc\n'
[line 9]: '=======\n'
[line 12]: '>>>>>>> Open trunk for 0.22.\n'
Traceback (most recent call last):
File "/usr/bin/flake8", line 9, in <module>
load_entry_point('flake8==2.0', 'console_scripts', 'flake8')()
File "/usr/lib/python2.7/site-packages/flake8/main.py", line 21, in main
flake8_style = get_style_guide(parse_argv=True, config_file=DEFAULT_CONFIG)
File "/usr/lib/python2.7/site-packages/flake8/engine.py", line 76, in get_style_guide
styleguide = StyleGuide(**kwargs)
File "/home/matej/.local/lib/python2.7/site-packages/pep8.py", line 1788, in __init__
arglist, parse_argv, config_file, parser)
File "/home/matej/.local/lib/python2.7/site-packages/pep8.py", line 2074, in process_options
options = read_config(options, args, arglist, parser)
File "/home/matej/.local/lib/python2.7/site-packages/pep8.py", line 1999, in read_config
if config.read(os.path.join(parent, fn) for fn in PROJECT_CONFIG):
File "/usr/lib64/python2.7/ConfigParser.py", line 305, in read
self._read(fp, filename)
File "/usr/lib64/python2.7/ConfigParser.py", line 546, in _read
raise e
ParsingError: File contains parsing errors: /home/matej/archiv/knihovna/repos/m2crypto/setup.cfg
[line 2]: '<<<<<<< 642f88cb1b6027e184d9a662b255f7fea4d9eacc\n'
[line 9]: '=======\n'
[line 12]: '>>>>>>> Open trunk for 0.22.\n'
Local variables in innermost frame:
sectname: 'flake8'
cursect: OrderedDict([('__name__', 'flake8'), ('ignore', ['E402,N806,N803,N802,E501']), ('tag_build', ['.dev']), ('tag_svn_revision', ['1'])])
e: File contains parsing errors: /home/matej/archiv/knihovna/repos/m2crypto/setup.cfg
[line 2]: '<<<<<<< 642f88cb1b6027e184d9a662b255f7fea4d9eacc\n'
[line 9]: '=======\n'
[line 12]: '>>>>>>> Open trunk for 0.22.\n'
fpname: '/home/matej/archiv/knihovna/repos/m2crypto/setup.cfg'
vi: '='
mo: None
optname: 'tag_svn_revision'
fp: <open file '/home/matej/archiv/knihovna/repos/m2crypto/setup.cfg', mode 'r' at 0x2d07b70>
lineno: 12
line: ''
self: <ConfigParser.RawConfigParser instance at 0x2d522d8>
optval: '1'
Is the traceback really the best solution, couldn't we have some civilized way of dealing with errors?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.