Elektrine lite

← Feed

@pjf@cloudisland.nz

Post #3849684

2026-07-16 03:42 UTC

Hello C++ friends, is there an equivalent of perlcritic or phpstan for C++? Plenty of compilers and linters will give me warnings when I'm doing things wrong, but I want something that says "what you're doing is fine, but best practices would be to…" Thank you in advance!

Replies (2)

  • @xan@xantronix.social 2026-07-16 03:43

    @pjf@cloudisland.nz clang-check --analyze

    Open ##3849681

  • @jamesh@aus.social 2026-07-16 04:02

    @pjf@cloudisland.nz clang-tidy or clang-check is probably what you are after. It also helps if you've got a build system that generates a compile_commands.json file: without this, it won't know how to how to preprocess the file and you'll likely have broken include directives. If you're using meson, it'll generate this for you automatically. If you're using CMake, you can turn it on via CMAKE_EXPORT_COMPILE_COMMANDS.

    Open ##3853244