Skip to content

codespell exits brutally on ill-formed config file #3212

@DimitriPapadopoulos

Description

@DimitriPapadopoulos
$ cat CONFIG 
check-hidden =
$ 
$ codespell --config CONFIG
Traceback (most recent call last):
  File "/home/username/.local/bin/codespell", line 8, in <module>
    sys.exit(_script_main())
             ^^^^^^^^^^^^^^
  File "/path/to/codespell/codespell_lib/_codespell.py", line 1019, in _script_main
    return main(*sys.argv[1:])
           ^^^^^^^^^^^^^^^^^^^
  File "/path/to/codespell/codespell_lib/_codespell.py", line 1024, in main
    options, parser, used_cfg_files = parse_options(args)
                                      ^^^^^^^^^^^^^^^^^^^
  File "/path/to/codespell/codespell_lib/_codespell.py", line 584, in parse_options
    _cfg.read(cfg_file)
  File "/usr/lib/python3.11/configparser.py", line 713, in read
    self._read(fp, filename)
  File "/usr/lib/python3.11/configparser.py", line 1101, in _read
    raise MissingSectionHeaderError(fpname, lineno, line)
configparser.MissingSectionHeaderError: File contains no section headers.
file: 'CONFIG', line: 1
'check-hidden =\n'
$ 

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions