During the review of the pull request to the Beman standard resulting from the earlier discussion of the formatting of the license file, there was a discussion about the wording of a new rule that the type of license must be specified in the README.md.
The original wording I proposed was the following:
REQUIREMENT: The
README.md
must contain a section called “License” which specifies the license or licenses used by the library. A non-exhaustive list of examples follows.## License beman.exemplar is licensed under the Apache License v2.0 with LLVM Exceptions.
/* further examples… */
After code review, this was modified to:
REQUIREMENT: Following the library status line and a new line, the
README.md
must have aLICENSE
section.Use exactly the following format:
## License beman.exemplar is licensed under the Apache License v2.0 with LLVM Exceptions. <!-- Other optional mentions go on this line ... >
My reasoning for the less restrictive rule is this:
I find this situation analogous to the strategy I use to unit test log messages. Say I have this function:
// Returns a string containing the file contents, or if the file cannot be accessed,
// logs the error and return std::nullopt
std::optional<std::string> slurp(std::filesystem::path const&, logger&)
I can unit test the error logging in one of two ways: either,
EXPECT_EQ(logger.messages[0], "failed to slurp file with: No such file or directory");
or:
EXPECT_EQ(logger.messages[0], "No such file or directory");
The second approach is better because the only thing we specifically care about is that the log message propagates the strerror
message from the operating system, not the phrasing of the text around it. If someone reimplements the function such that the error message is “file slurp failed” instead of “failed to slurp file,” they shouldn’t need to update the unit test.
I think this README rule should be treated similarly. I don’t think we should be failing beman-tidy if someone’s README file says, “The license of beman.foo is the Apache License v2.0 with LLVM Exceptions,” instead of, “beman.foo is licensed under the Apache License v2.0 with LLVM Exceptions.” The important thing is just that the “License” section exists and the string “Apache License v2.0 with LLVM Exceptions” is present-- that’s what beman-tidy should check for here.
I think a couple of the other rules like README.IMPLEMENTS and README.LIBRARY_STATUS could possibly be similarly relaxed-- and I think determining what principle we should use here might become more important as we develop our documentation system further, so I wanted to open a discussion here.