Skip to content

[Linting Rule] Software Has License

github-actions[bot] edited this page Jun 16, 2026 · 1 revision

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]

documentation usability

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.

Configuration

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:

Examples

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
  }
}

Additional Examples

These examples are synthesized from the test cases in: test/functionality/linter/lint-software-has-license.test.ts

Test Case: no license in plain script

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.

Test Case: license file present

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 lints

See here for the test-case implementation.

Test Case: license.md present

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 lints

See here for the test-case implementation.

Test Case: unrelated file does not count

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.

Test Case: description file with license

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 lints

See here for the test-case implementation.

Test Case: description file without license field

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.

Test Case: description check disabled

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.

Clone this wiki locally