ocaml.lang.portability.slash-tmp.not-portable-tmp-string

profile photo of semgrepsemgrep
Author
169
Download Count*

You should probably use Filename.get_temp_dirname().

Run Locally

Run in CI

Defintion

rules:
  - id: not-portable-tmp-string
    pattern: |
      "=~/\/tmp/"
    message: You should probably use Filename.get_temp_dirname().
    languages:
      - ocaml
    severity: WARNING
    metadata:
      category: portability
      technology:
        - ocaml
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

slash-tmp.ml

let test a =
  (* ruleid:not-portable-tmp-string *)
  let path = Filename.concat "/tmp" a in
  print_string path