Context
I'd like to be able to create a Herald rule that enforces the existence of open source license headers on specific file types during arc diff.
My Herald rule thus far
- Repository is any of rMyRepo
- Affected files matches regexp (\.(c|cpp|h)$)
- Added file content does not contain Snippet of license text
The problem: this herald rule leads to false-positives on legitimate source changes. A new function added to a .c file will cause this Herald rule to fail, even if the file is already properly licensed. This makes sense and is a reasonable outcome of the above rules.
What I think might solve my problem
An additional Herald rule for Diffs called Added files with the standard "contains/regexp" options, I would be able to change the Affected files constraint to:
- Added files matches regexp (\.(c|cpp|h)$)
This would allow me to introduce enforcement of the license for all new source without affecting legitimate changes to existing files that don't already have the license.
I plan to address any source that is missing the license in a separate change.
Perhaps not part of this feature request, but related
I can imagine a sibling rule called Removed files being added as well. This would bring the "file" rules in line with the "content" rules with respect to supporting all of Added, Removed, and Changed.