ocaml.lang.best-practice.bool.ocamllint-bool-true

Author
4,866
Download Count*
License
Comparison to boolean. Just use $X
Run Locally
Run in CI
Defintion
rules:
- id: ocamllint-bool-true
pattern-either:
- pattern: $X = true
- pattern: $X == true
- pattern: $X != false
message: Comparison to boolean. Just use `$X`
languages:
- ocaml
severity: WARNING
metadata:
category: best-practice
technology:
- ocaml
license: Commons Clause License Condition v1.0[LGPL-2.1-only]
Examples
bool.ml
let test a =
(* ruleid:ocamllint-bool-true *)
let x = a = true in
(* ruleid:ocamllint-bool-true *)
let x = a == true in
(* ruleid:ocamllint-bool-false *)
let x = a = false in
(* ruleid:ocamllint-bool-false *)
let x = a == false in
(* ruleid:ocamllint-bool-true *)
let x = a != false in
(* ruleid:ocamllint-bool-false *)
let x = a <> true in
()
Short Link: https://sg.run/1ZE1