ford icon indicating copy to clipboard operation
ford copied to clipboard

SPDX License Identifiers

Open kc9jud opened this issue 4 years ago • 3 comments

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.

kc9jud avatar Jul 14 '21 19:07 kc9jud

Yes please, that would be lovely!

ZedThree avatar Jul 14 '21 21:07 ZedThree

@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...

kc9jud avatar Jul 15 '21 17:07 kc9jud

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.

ZedThree avatar Jul 16 '21 08:07 ZedThree