Pekko and its projects uses sbt-header in order to check that all source content has the correct headers. In order to check the headers for a project you can run the following
sbt headerCheckAll
A success will provide a result that looks like this
<@incubator-pekko>-<⎇ main>-<*>-> sbt headerCheckAll [info] welcome to sbt 1.9.2 (Homebrew Java 11.0.19) [info] loading global plugins from /Users/mdedetrich/.sbt/1.0/plugins [info] loading settings for project incubator-pekko-build-build-build from metals.sbt ... [info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project/project [info] loading settings for project incubator-pekko-build-build from metals.sbt ... [info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project/project [success] Generated .bloop/incubator-pekko-build-build.json [success] Total time: 0 s, completed 19 Jul 2023, 16:41:57 [info] loading settings for project incubator-pekko-build from metals.sbt,plugins.sbt ... [info] loading project definition from /Users/mdedetrich/github/incubator-pekko/project [success] Generated .bloop/incubator-pekko-build.json [success] Total time: 2 s, completed 19 Jul 2023, 16:41:59 [info] loading settings for project pekko from build.sbt ... [info] resolving key references (65176 settings) ... [info] [info] ________ ______ ______ [info] ___ __ \_______ /____ /_______ [info] __ /_/ / _ \_ //_/_ //_/ __ \ [info] _ ____// __/ ,< _ ,< / /_/ / [info] /_/ \___//_/|_| /_/|_| \____/ 1.0.1-RC1+1-24050622-SNAPSHOT [info] [info] Useful sbt tasks: [info] > compile - Compile the current project [info] > test - Run all the tests [info] > testQuick - Runs all the tests. When run multiple times will only run previously failing tests (shell mode only) [info] > testOnly *.AnySpec - Only run a selected test [info] > testQuick *.AnySpec - Only run a selected test. When run multiple times will only run previously failing tests (shell mode only) [info] > testQuickUntilPassed - Runs all tests in a continuous loop until all tests pass [info] > publishLocal - Publish current snapshot version to local ~/.ivy2 repo [info] > verifyCodeStyle - Verify code style [info] > applyCodeStyle - Apply code style [info] > sortImports - Sort the imports [info] > mimaReportBinaryIssues - Check binary issues [info] > validatePullRequest - Validate pull request [info] > docs/paradox - Build documentation [info] > docs/paradoxBrowse - Browse the generated documentation [info] > tips: - prefix commands with `+` to run against cross Scala versions. [info] > Contributing guide: - https://github.com/apache/incubator-pekko/blob/main/CONTRIBUTING.md [success] Total time: 4 s, completed 19 Jul 2023, 16:42:11
Where as a failure would look like this
You can also create headers for source files that don't currently contain one by running
sbt headerCreateAll
All of Pekko projects run the header check on every PR which in addition to protected branches helps alleviate regressions in license headers, i.e. using core Pekko project as an example
- https://github.com/apache/incubator-pekko/blob/main/.github/workflows/headers.yml
- https://github.com/apache/incubator-pekko/blob/main/.asf.yaml#L44
Do note that while its possible to use other tools to check for headers (such as rat) its not recommend because all of the header requirements that resulted from legal discussions such as - LEGAL-626Getting issue details... STATUS are encoded into sbt-header and certain kinds of rules for checking header files aren't even possible in rat because they are programmatic in nature (see https://github.com/apache/incubator-pekko/blob/main/project/CopyrightHeader.scala as an example).