Skip to content

ALL-CALL0001 · unchecked_result_call

Count calls whose result reports failure and is discarded anyway.

This is a deterministic rule for all languages. Read its implementation.

Report a resolved call to a configured callable, or to any callable under a configured prefix, whose returned value is discarded. These are the calls that report failure through their result rather than by raising, so discarding the result discards the only failure signal there is. The project names the callables because the contract lives in the library rather than in the syntax. A CUDA runtime entry point, a Go function returning an error, a Rust #[must_use] result, and a status-returning C API all have this shape.

Each finding records the call range and the qualified name. The value is the number of discarded results.

A call whose value is assigned, returned, or passed onward is not counted, even when the receiving code ignores it later, because that is a separate question about the receiver. With no configured names the rule reports nothing, since guessing which results matter would produce findings a project never asked for. checked_callables names the exact callables whose result reports failure and checked_prefixes names the families of them, so a project states its own contract rather than inheriting a guess.

With cuda* configured, a bare cudaMalloc(&pointer, bytes); returns 1 while status = cudaMalloc(&pointer, bytes); returns 0.

  • Cites “CUDA C++ Best Practices Guide”, error handling. Open reference
  • Generalizes clang-tidy bugprone-unused-return-value. Open reference
  • Cites “The Rust Reference”, #[must_use] attribute. Open reference