-
Notifications
You must be signed in to change notification settings - Fork 12
[Linting Rule] Software Has Tests
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 Tests [overview]
This rule is a best-effort rule.
Checks whether the software project has tests (test files in a test directory or test function calls in R code).
This linting rule is implemented in src/linter/rules/software-has-tests.ts.
Linting rules can be configured by passing a configuration object to the linter query as shown in the example below.
The software-has-tests rule accepts the following configuration options:
-
additionalTestFunctions
Additional test function patterns beyond the defaults
cat("hello")The linting query can be used to run this rule on the above example:
[ { "type": "linter", "rules": [ { "name": "software-has-tests", "config": {} } ] } ]Results (prettified and summarized):
Query: linter (0 ms)
╰ Software Has Tests (software-has-tests):
╰ certain:
╰ No tests found in the project
╰ Metadata: testFilesFound: 0, testCallsFound: 0, searchTimeMs: 0, processTimeMs: 0
All queries together required ≈0 ms (1ms accuracy, total 1 ms)
Show Detailed Results as Json
The analysis required 0.6 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-tests": {
"results": [
{
"certainty": "certain",
"loc": [
-1,
-1,
-1,
-1
],
"message": "No tests found in the project"
}
],
".meta": {
"testFilesFound": 0,
"testCallsFound": 0,
"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-tests.test.ts
Given the following input:
cat("hello")We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No tests found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
test_that("basic", { expect_true(TRUE) })We expect the linter to report the following:
* no lintsSee here for the test-case implementation.
Given the following input:
expect_true(1 == 1)We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No tests 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/tests/test_main.R', '')] }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/test/helper.R', '')] }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/R/main.R', '')] }We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No tests found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
expect_equal(1 + 1, 2)We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No tests found in the project', loc: [-1, -1, -1, -1] }]See here for the test-case implementation.
Given the following input:
run_test_dir("inst/tinytest")We expect the linter to report the following:
* no lintsSee here for the test-case implementation.
Given the following input:
checkEquals(1 + 1, 2)We expect the linter to report the following:
[{ certainty: LintingResultCertainty.Certain, message: 'No tests 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