Checking source code name styling with Clang-Tidy
Now that we’ve successfully configured Clang-Tidy’s rules and integrated the tool into our CMake build system, it’s time for a real-world test. For this purpose, we’ll use a snippet of C++ code that deliberately violates the naming conventions we’ve established:
#include <string>
#include <vector>
namespace Filesystem { // CamelCase instead of lower_case
enum class Permissions : uint8_t { READ, WRITE, execute };
struct User {
std::string name_; // redundant suffix _ for public member
int Id = 0; // CamelCase instead of lower_case
Permissions permissions;
};
class file { // lower_case instead of CamelCase
public:
file(int id, const std::string &file_name,
const std::vector<User> access_list...