smanza

smanza

ExLicense - License header injector

Hello.

I have just published a new package named ex_license to manage license headers injection in the Elixir code source files.

While repositories can have a LICENSE file, nothing prevent someone to take a file and use it without restriction.
In other programming languages C, Go, … there are often tooling to inject headers of license but not in Elixir.

So this library embeds a mix task, to inject or to verify (usable in CI), to ensure an Elixir project maintains license headers.

To avoid the burden and uglify code file, it uses the SPDX convention which points a license with its ID

Thanks!

First 7 of 7 Posts! Switch mode

jarlah

jarlah

thanks I’m actually using it now. Even though im not sure if it’s needed to tag every source file with a license header for legal reasons. But it’s easier to see at least that its covered in the same license the repo is licensed under

Kin

Kin

ELI5 anybody? What does this suppose to do? What is a license header? I hear about this for the first time.

jarlah

jarlah

if you have a LICENSE, its normally enough to have the LICENSE file at the root of the repo. There is no legal reasons to have the license embedded in code comments at top of each file. However, what ex_license solves is “indicating” instead the license at the top of each file. If you as a dev is looking into a source file and wonder about the license, just look at the header in the file and you will know. Fine for me, and generally I dont care too much about whats correct or not, as long as I make it easy for devs to know what license any part of the code is licensed under.

Kin

Kin

What about just using a VS Code extension that would show the current license of each of the file you are working on in the status bar or somewhere in the code - based on the license terms from the file in the root of the project (readme.md or license.md or whatever)?

I mean it is just another dependency in your Elixir codebase.

And a VS code extension is global - for all projects, meaning, it’s easier to maintain in one place as 1 VSCode plugin instead of 20 plugins for each of your Elixir projects.

smanza

smanza

The initial goal of this lib was to be compliant with SPDX licence specification.
For instance in many code bases there is license header in top of each files as multi lines comments.
This helps to identify the license for this code if you don’t have the whole repo by checking the LICENSE file.

The SPDX spec tends to unify and standardize it while being simplier to apply into codebase. (Single line comment)

To get more info please check out the spec: https://spdx.dev/learn/handling-license-info/

Kin

Kin

Hmm, interesting, so it just adds one comment line like:

# SPDX-License-Identifier: MIT

on top of each file, right?

jarlah

jarlah

Yes. Thats why I bothered with it for my new project. If it was adding the license on top of each file, meh ..

Where Next?

Trending in Announcing Top

bluzky
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
385 14863 120
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
shahryarjb
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly. One of i...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New
zachdaniel
Introducing AshStorage! Attachment and file management that slots directly into your resources :smiling_face_with_sunglasses: I had hope...
New

Other Trending Topics Top

type1fool
I just stumbled on a newly redesigned elixir-lang.org. :tada: It looks like @Software_Mansion did the work, and I think it is generally a...
New
akoutmos
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New
bjorng
We want to introduce a new native datatype to Erlang: native records. Although replacing all tuple records with native records is not our...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
yureehuh
Introduction Founded in 2017 by landscape ecologist and fire mitigation expert Harry Statter, Frontline developed the first fully integra...
New

We're in Beta

About us Mission Statement