Skip to content

[Linting Rule] Unclosed Connection

github-actions[bot] edited this page Nov 8, 2026 · 1 revision

Generated from 'wiki-linter.ts' on 2026-11-08, 14:25:27 UTC (v2.17.4), do not edit directly.

Unclosed Connection [overview]

smell quickfix robustness

This rule is a best-effort rule.

Finds connections that are opened but not closed on every path opening them.
This linting rule is implemented in src/linter/rules/unclosed-connection.ts.

Configuration

Linting rules can be configured by passing a configuration object to the linter query as shown in the example below. The unclosed-connection rule accepts the following configuration options:

  • closeFns
    functions closing the connection they are handed, besides the ones flowR states SemanticCallTag.Closes for
  • openFns
    functions opening a connection, besides the ones flowR states SemanticCallTag.Opens for

Examples

con <- file("data.csv")
readLines(con)

The linting query can be used to run this rule on the above example:

[ { "type": "linter",   "rules": [ { "name": "unclosed-connection",     "config": {} } ] } ]

Results (prettified and summarized):

Query: linter (41 ms)
   ╰ Unclosed Connection (unclosed-connection):
       ╰ certain:
           ╰ Unclosed connection at 1.8-23 (1 quick fix(es) available)

More examples are the test cases in test/functionality/linter/lint-unclosed-connection.test.ts.

Clone this wiki locally

⌂ 换网址