-
Notifications
You must be signed in to change notification settings - Fork 12
[Linting Rule] Software Has License
This document was generated from 'src/documentation/wiki-linter.ts' on 2026-06-16, 07:18:00 UTC presenting an overview of flowR's linter (v2.10.9). Please do not edit this file/wiki page directly.
Software Has License [overview]
This rule is a best-effort rule.
Checks whether the software project provides a license (via a LICENSE file or the DESCRIPTION file License field).
This linting rule is implemented in src/linter/rules/software-has-license.ts.
Linting rules can be configured by passing a configuration object to the linter query as shown in the example below.
The software-has-license rule accepts the following configuration options:
-
checkDescriptionFile
Whether to also inspect the DESCRIPTION file for a License field
cat("a project without a license")The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "software-has-license", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (0 ms)
╰ Software Has License (software-has-license):
╰ certain:
╰ No license found in the project
╰ Metadata: searchTimeMs: 0, processTimeMs: 0
All queries together required ≈0 ms (1ms accuracy, total 1 ms)
Show Detailed Results as Json
The analysis required 0.7 ms (including parsing and normalization and the query) within the generation environment.
In general, the JSON contains the Ids of the nodes in question as they are present in the normalized AST or the dataflow graph of flowR. Please consult the Interface wiki page for more information on how to get those.
{
"linter": {
"results": {
"software-has-license": {
"results": [
{
"certainty": "certain",
"loc": [
-1,
-1,
-1,
-1
],
"message": "No license found in the project"
}
],
".meta": {
"searchTimeMs": 0,
"processTimeMs": 0
}
}
},
".meta": {
"timing": 0
}
},
".meta": {
"timing": 0
}
}These examples are synthesized from the test cases in: test/functionality/linter/lint-software-has-license.test.ts
Given the following input:
cat("hello")We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No license found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{ addFiles: [new FlowrInlineTextFile('/project/LICENSE', 'MIT License')] }We expect the linter to report the following:
* no lintsSee here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{ addFiles: [new FlowrInlineTextFile('/project/LICENSE.md', '## License\nMIT')] }We expect the linter to report the following:
* no lintsSee here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{ addFiles: [new FlowrInlineTextFile('/project/README.md', 'no license here')] }We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No license found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{ addFiles: [new FlowrInlineTextFile('/project/DESCRIPTION', 'Package: Foo\nVersion: 1.0\nLicense: MIT\n')] }We expect the linter to report the following:
* no lintsSee here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{ addFiles: [new FlowrInlineTextFile('/project/DESCRIPTION', 'Package: Foo\nVersion: 1.0\n')] }We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No license found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
cat("hello")And using the following configuration:
{
addFiles: [new FlowrInlineTextFile('/project/DESCRIPTION', 'Package: Foo\nVersion: 1.0\nLicense: MIT\n')],
checkDescriptionFile: false
}We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No license found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Currently maintained by Florian Sihler and Oliver Gerstl at Ulm University
Email | GitHub | Penguins | Portfolio
- 🧑💻 Developer Onboarding
- 💻 Setup
- 👓 Overview
- 🪟 Interfacing with flowR
- 🌋 Core
- 🧹 Testing & Linting (Benchmark Page)
⁉️ FAQ- ℹ️ Extra Information