Clang tidy's readability-magic-numbers check is a nightmare.
h_malloc.c:236:28: warning: 4096 is a magic number; consider replacing it with a named constant [readability-magic-numbers]
static_assert(PAGE_SIZE == 4096, "bitmap handling will need adjustment for other page sizes");
Conversation
It's Clang's linter rather than the compiler. I'm explicitly asking it to be opinionated about code style by passing -checks=readability-* but it doesn't make this an acceptable lint pass. The checks in readability should be sensible and avoid spewing out tons of false positives.
I'd appreciate it if they added more ways of enforce code style. For example, I'd like a readability lint for detecting variables scoped more broadly than they could be within blocks (i.e. variable address not taken and only used within inner block scope). This one sucks though.
3
2
I could see it being useful if they add a whole bunch of heuristics like ignoring static_assert, ignoring sequential array initialization patterns, etc. I'm willing to mark exceptional cases with NOLINT comments (clang.llvm.org/extra/clang-ti) but only if the lint pass isn't garbage.

