I'm trying to use clang-tidy (10.0.0) to check the formatting on my file:
#include "blabla.h"
static const int status = 1000;
static const int STATUS_REPLY_TIMEOUT_MS = 100;
namespace foo {
The .clang-tidy file I'm using is:
Checks: '-*,readability-identifier-naming'
CheckOptions:
- { key: readability-identifier-naming.VariableCase, value: camelBack }
- { key: readability-identifier-naming.StaticConstantCase , value: UPPER_CASE }
I get an error:
warning: invalid case style for variable 'STATUS_REPLY_TIMEOUT_MS' [readability-identifier-naming]
static const int STATUS_REPLY_TIMEOUT_MS = 100;
It seems like STATUS_REPLY_TIMEOUT_MS
is recognized as a variable instead of a static constant... I tried removing the VariableCase
line, to check if that superseded the StaticConstantCase
, but then I get no errors (where I would expect one on static const int status = 1000;
). Any ideas what I'm doing wrong?
StaticConstantCase
only applies to static local variables.
Use GlobalConstantCase
for namespace-scope static variables.