feat(tidy): add fairmq-bugprone-ondata-with-conditionalrun

- Report devices that register a data callback with OnData() and also
  override ConditionalRun(). With data callbacks, Device::RunWrapper()
  runs only the callbacks, so ConditionalRun() is dead code.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Claude
2026-11-09 23:14:01 +00:00
parent b113f0a7d8
commit 42952bfa42
6 changed files with 150 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ The `fairmq-*` checks are a clang-tidy module ([Module.cxx](/source/fairmq/tidy/
| Check | Finds | Fix |
| --- | --- | --- |
| `fairmq-bugprone-ondata-with-conditionalrun` | Devices that register a data callback with `OnData()` and also override `ConditionalRun()` | No fix |
| `fairmq-bugprone-unchecked-transfer-result` | Calls of `Receive()` whose result is not used. With the option `CheckSend`, also calls of `Send()`. | No fix |
| `fairmq-bugprone-use-after-send` | Uses of a `MessagePtr` after a `Send()` whose result is not used | No fix |
| `fairmq-modernize-channels-access` | Uses of the deprecated member `fair::mq::Device::fChannels` | `fChannels.at(name).at(index)` becomes `GetChannel(name, index)`. Other uses become `GetChannels()`. |
@@ -178,6 +179,10 @@ The check looks only at a `Send()` whose result the code does not use. If the co
The check looks only at `==` and `!=`. See [Transfer codes](/reference/transfer-codes/).
### fairmq-bugprone-ondata-with-conditionalrun
A device with a data callback runs only its callbacks in the state Running. It never calls `ConditionalRun()` and `Run()`. The check reports the override of `ConditionalRun()`, with a note at the call of `OnData()`. See [Data callbacks](/concepts/devices/#data-callbacks).
## Build fairmq-tidy
Set the CMake option `BUILD_TIDY_TOOL` (default `OFF`) when you configure FairMQ: