license_checker
Overview
license_checker allow you to automatically check licenses inside specified code files.
How to use
Running
Note: Pyhton 3.9 and above required
(otherwise TypeError: 'type' object is not subscriptable)
-
Linux
python3 license_checker.py -
Windows
python license_checker.py
How to configure
The checker settings are specified in the config.json.
The path to the license template is indicated there.
How to specify a license template
The license template is a plain text file where the license text is indicated as you would like to see the license at the beginning of the file.
How to configure config.json
Сonfig parameters
-
basePathspecifies which folder the paths will be relative to. For example:"basePath": "../../../" -
reportFolderspecifies in which folder to save text files with reports. For example:"reportFolder": "build_tools/scripts/license_checker/reports" -
printCheckingspecifies whether to output information about which file is being checked to the console. For example:"printChecking": false -
printReportsspecifies whether to output reports to the console. For example:"printReports": false -
fixspecifies which categories of reports should be repaired automatically. Possible array values:"OUTDATED","NO_LICENSE","INVALID_LICENSE","LEN_MISMATCH". For example:"fix": ["OUTDATED", "NO_LICENSE"],Automatically repair files where the license is outdated or not found.
-
configslicense check and repair configurations.-
dirfolder to check. For example:"dir": "sdkjs" -
fileExtensionsfile extensions to check. For example:"fileExtensions": [".js"] -
licensePathspecifies the path to the license template. For example:"licensePath": "header.license" -
ignoreListDirfolder paths to ignore. For example:"ignoreListDir": [ "sdkjs/deploy", "sdkjs/develop", "sdkjs/configs", "sdkjs/common/AllFonts.js", "sdkjs/slide/themes/themes.js" ] -
ignoreListDirNamefolder names to ignore. For example:"ignoreListDirName": [ "node_modules", "vendor" ] -
ignoreListFilefile paths to ignore. For example:"ignoreListFile": [ "sdkjs/develop/awesomeFileToIgnore.js", ] -
allowListFilefile paths to allow. It is needed if you ignore the directory, but there is a file in it that needs to be checked. For example:"ignoreListDir": [ "sdkjs/develop" ], "allowListFile": [ "sdkjs/develop/awesomeFileToAllow.js", ]
Any number of configurations can be specified, they can overlap if we need to check files in the same folder in different ways.
-