Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titlesbt-header success
collapsetrue
<@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

...

Code Block
sbt headerCreateAll


This will for example add the standard Apache header to the top of the source files but it will also handle other cases such as adding the Apache SPDX header to configuration files.

All of Pekko projects run the header check on every PR which in addition to protected branches + strict status check helps alleviate regressions in license headers, i.e. using core Pekko project as an example

...

Info

Do note that while its possible to use other tools to check for headers (such as rat Apache Rat) its not recommend because all of the header requirements that resulted from legal discussions such as

Jira
serverASF JIRA
serverId5aa69414-a9e9-3523-82ec-879b028fb15b
keyLEGAL-626
which are specific/bespoke to Pekko and Pekko only 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 . This style of programmatic checking of headers (such as https://github.com/apache/incubator-pekko/blob/main/project/CopyrightHeader.scala as an example) isn't possible in Rat.

On top of this, since Pekko projects use sbt as a build tool, sbt-header (which is an sbt plugin) is aware of the difference between generated sources (i.e. from templates/macros) which are NOT part of the source distribution and actual sources. Rat cannot tell the difference which means it may incorrectly mark files as needing headers if you didn't clean the project after building it.

In short, Rat can provide both a lot of false positives and false negatives and although it can be configured to remediate some of these problems it won't solve all of them.