Skip to content

Instantly share code, notes, and snippets.

@27Cobalter
Created January 18, 2024 12:57
Show Gist options
  • Save 27Cobalter/46ae4d07c66aff52343d7c975593e910 to your computer and use it in GitHub Desktop.
Save 27Cobalter/46ae4d07c66aff52343d7c975593e910 to your computer and use it in GitHub Desktop.
clang_tidy_sample.cc
#include <iostream>
#include <cstdint>
// https://clang.llvm.org/extra/clang-tidy/checks/readability/identidifer-naming.html
/* .clang-tidy
*
* Checks: 'readability-identifier-naming'
* CheckOptions:
* - key: readability-identifier-naming.ClassCase
* value: CamelCase
* - key: readability-identifier-naming.EnumCase
* value: Camel_Snake_Case
* - key: readability-identifier-naming.EnumConstantCase
* value: Camel_Snake_Case
* - key: readability-identifier-naming.FunctionCase
* value: CamelCase
* - key: readability-identifier-naming.MemberCase
* value: lower_case
* - key: readability-identifier-naming.PrivateMemberSuffix
* value: _
* - key: readability-identifier-naming.PublicMemberSuffix
* value: ''
* - key: readability-identifier-naming.VariableCase
* value: lower_case
* - key: readability-identifier-naming.NamespaceCase
* value: CamelCase
* - key: readability-identifier-naming.TypedefCase
* value: Camel_Snake_Case
* - key: readability-identifier-naming.ParameterCase
* value: lower_case
* - key: readability-identifier-naming.ConstantCase
* value: UPPER_CASE
*/
namespace TrueNameSpace {
constexpr bool TRUE_CONSTEXPR = true;
const bool TRUE_CONST = true;
typedef bool TrueTypedef;
typedef bool TrueTypedef_Long;
enum TrueEnum { TrueElem };
enum class TrueEnumClass { TrueElement };
enum class TrueEnumClass_Long {TrueEnumClass_Long_Element};
class TrueClass { // true
private:
bool true_private_member_ = true;
void TruePrivateMethod(){};
public:
int32_t true_public_member;
void TruePublicMethod() {
auto true_local_value = true;
};
};
struct TrueStruct {
bool true_struct_elem;
};
void TrueFunction(){};
} // namespace TrueNameSpace
namespace false_name_space {
constexpr bool FalseConstexpr = false;
constexpr bool false_constexpr = false;
const bool FalesConst = false;
const bool false_const = false;
typedef bool false_type;
enum false_enum { false_enum };
enum class false_enum_class { false_element };
class false_class { // true
private:
bool FalsePrivateMember = false;
bool false_private_member = false;
void false_private_method(){};
public:
int32_t false_public_member_;
void false_public_method() {
auto FalseValue = false;
};
};
struct false_struct {
bool FalseStructElem;
};
void false_function(){};
} // namespace false_name_space
auto main() -> int {
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment