DEV Community

Clay Risser
Clay Risser

Posted on

Manage License Headers with Ease

I found this awesome vscode extension called psioniq File Header that automatically injects and updates comment headers in my code files. This is a MUST if you are using the Apache 2.0 license, which requires the code to be licensed on a file by file basis.

You can find it at the link below.

https://marketplace.visualstudio.com/items?itemName=psioniq.psi-header

I am also going to start using it for proprietary code as well as MIT licensed code because I can provide useful information about who was working on the file, when it was last updated, etc . . .

I love how it lets me customize how the comment is built as well as fine grained control on what files it puts the header in. This makes it work in virtually all programming languages and setups. It also intelligently will not override existing headers. You can customize exactly when to update the header and what parts to update as well.

Here is an example configuration I am using that injects the Apache 2.0 license as well as useful metadata in GoLang and Makefiles.

https://github.com/silicon-hills/integration-operator/blob/8e7701fad164ebb6f857a13b1a1312724c266c55/.vscode/settings.json#L45-L134

Below you can see an example GoLang file and Makefile where the comments were added.

https://github.com/silicon-hills/integration-operator/blob/8e7701fad164ebb6f857a13b1a1312724c266c55/main.go#L1-L23
https://github.com/silicon-hills/integration-operator/blob/8e7701fad164ebb6f857a13b1a1312724c266c55/Makefile#L1-L21

Until next time, and have a great day!

Top comments (0)