kt3k / license-checker

:page_facing_up: CLI tool for checking license headers in files
https://jsr.io/@kt3k/license-checker
MIT License
29 stars 7 forks source link

Allow Regex in licenses #28

Closed Pandapip1 closed 2 years ago

Pandapip1 commented 2 years ago

For another use case, I need to allow either of the following:

// Code
// SPDX-License-Identifier: CC0-1.0

// Code

But disallow other licenses, such as:

// SPDX-License-Identifier: MIT

// Code

Is it possible to allow regex?

/(^\/+\ *SPDX-License-Identifier: CC0-1\.0.*$|^[^\/].*$)/gm
kt3k commented 2 years ago

Writing (and reading) regex in json is painful in my view. So I want to avoid allowing regex in the config.

In the above example, why some file has license header and some are not? Doesn't ignore parameter work for that case?

Pandapip1 commented 2 years ago

ignore doesn't work since that takes in a list of files, and the repo in question mostly deals with new files.