ford
ford copied to clipboard
SPDX License Identifiers
FORD currently has its own metadata field for specifying the license on a file. However, it should also be able to parse the standard SPDX-License-Identifier and provide a link to the appropriate license if found. It looks like this should be reasonably simple with nexB/license-expression for parsing. I can submit a PR if there is interest.
Yes please, that would be lovely!
@ZedThree I don't think the SPDX standard requires that identifiers be put on a special comment line, nor at the top of the file. (In fact, they seem to encourage placing them in addition to standard license boilerplate.) Does that mean I should modify both ford/reader.py (so that I can inspect regular comments) as well as ford/sourceform.py where I extract the metadata? I'm just trying to get a feel for the architecture here...
Yes, I think you'll need to modify both.
FortranReader throws away non-docstring comments and normalises predocmark/altdocmark comments to docmark ones. So one thing you could do is to convert an SPDX comment to a docmark one there, rather than keeping non-docstring comments.
I'm not sure where's best to store the licence metadata in sourceform.py -- maybe in FortranBase so that the licence can be on each page that it applies to? That is, we'd be able to put a licence logo/string on the source file page, the program/module page, and individual procedure pages.