reuse-tool icon indicating copy to clipboard operation
reuse-tool copied to clipboard

Handle missing fields in DEP5 more gracefully than issuing syntax errors

Open uiopaubo opened this issue 5 years ago • 0 comments

It might be nice if missing metadata fields were handled more gracefully than issuing a syntax error like this:

reuse.project - ERROR - .reuse/dep5 has syntax errors
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/reuse/project.py", line 231, in _copyright
    self._copyright_val = Copyright(fp)
  File "/usr/lib/python3.7/site-packages/debian/copyright.py", line 155, in __init__
    pf = FilesParagraph(p, strict)
  File "/usr/lib/python3.7/site-packages/debian/copyright.py", line 512, in __init__
    _complain('Files paragraph missing License field', strict)
  File "/usr/lib/python3.7/site-packages/debian/copyright.py", line 84, in _complain
    raise MachineReadableFormatError(msg)
debian.copyright.MachineReadableFormatError: Files paragraph missing License field

Here, a "License" field has been forgotten, but the DEP5 parser terminates at that point in the file and ignores any following metadata, producing reports of files without metadata even though such metadata is present in the file.

uiopaubo avatar Jul 30 '20 13:07 uiopaubo