-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clang tidy pr #3
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 3 out of 22 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 7b29975..328c9f9 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : m_a{ s_counter++ }
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -33 +33 @@ public:
-class bank
+class Bank
@@ -36 +36 @@ public:
- bank()
+ Bank()
@@ -40 +40 @@ public:
- ~bank()
+ ~Bank()
@@ -57 +57 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -80 +80 @@ public:
- std::vector<obj> m_org_data;
+ std::vector<Obj> m_org_data;
@@ -84 +84 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -90 +90,2 @@ public:
- if (found != m_funcs.end()) return found->second(param);
+ if (found != m_funcs.end()) { return found->second(param);
+}
@@ -105 +106 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -121 +122 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -135 +136 @@ int main()
- auto b = new bank();
+ auto *b = new Bank();
@@ -138 +139 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -156 +157 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -164 +165 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -167 +168 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -171 +172 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->get_opt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -181 +182 @@ int main()
- auto fs = new func_store();
+ auto *fs = new FuncStore();
Have any feedback or feature suggestions? Share it here.
@@ -20,7 +20,7 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
@@ -54,7 +54,7 @@ class bank | |||
m_data = a; /// 這裡會複製 | |||
} | |||
|
|||
const std::any& get() | |||
const std::any& get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- method 'get' can be made const [readability-make-member-function-const]
const std::any& get() | |
const std::any& get() const |
@@ -77,6 +77,7 @@ class bank | |||
return std::ref(m_data); | |||
} | |||
std::any m_data; | |||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
std::vector<obj> m_org_data; | |
std::vector<Obj> m_org_data; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:79:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:80:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 6 out of 24 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 50ab65e..5a9b671 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : m_a{ s_counter++ }
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -35 +35 @@ private:
-class bank
+class Bank
@@ -38 +38 @@ public:
- bank()
+ Bank()
@@ -42 +42 @@ public:
- ~bank()
+ ~Bank()
@@ -59 +59 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -82 +82 @@ public:
- std::vector<obj> m_org_data;
+ std::vector<Obj> m_org_data;
@@ -86 +86 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -92 +92,2 @@ public:
- if (found != m_funcs.end()) return found->second(param);
+ if (found != m_funcs.end()) { return found->second(param);
+}
@@ -107 +108 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -123 +124 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -137 +138 @@ int main()
- auto b = new bank();
+ auto *b = new Bank();
@@ -140 +141 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -158 +159 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -166 +167 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -169 +170 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -173 +174 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->get_opt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -183 +184 @@ int main()
- auto fs = new func_store();
+ auto *fs = new FuncStore();
Have any feedback or feature suggestions? Share it here.
@@ -20,12 +20,14 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
@@ -54,7 +56,7 @@ class bank | |||
m_data = a; /// 這裡會複製 | |||
} | |||
|
|||
const std::any& get() | |||
const std::any& get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- method 'get' can be made const [readability-make-member-function-const]
const std::any& get() | |
const std::any& get() const |
@@ -77,6 +79,7 @@ class bank | |||
return std::ref(m_data); | |||
} | |||
std::any m_data; | |||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
std::vector<obj> m_org_data; | |
std::vector<Obj> m_org_data; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:81:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:82:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
@@ -103,7 +106,7 @@ void func(const std::any& a) | |||
//auto ob = std::any_cast<std::vector<obj>>(std::cref(a)); /// 這樣不能轉 | |||
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 | |
auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉 |
@@ -153,7 +156,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |
auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改 |
@@ -153,7 +156,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |||
ov2[8].m_a = -23; | |||
ov2[8].a() = -23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:159:13: warning: [readability-magic-numbers]
8 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:159:23: warning: [readability-magic-numbers]
23 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 6 out of 24 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 50ab65e..5a9b671 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : m_a{ s_counter++ }
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -35 +35 @@ private:
-class bank
+class Bank
@@ -38 +38 @@ public:
- bank()
+ Bank()
@@ -42 +42 @@ public:
- ~bank()
+ ~Bank()
@@ -59 +59 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -82 +82 @@ public:
- std::vector<obj> m_org_data;
+ std::vector<Obj> m_org_data;
@@ -86 +86 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -92 +92,2 @@ public:
- if (found != m_funcs.end()) return found->second(param);
+ if (found != m_funcs.end()) { return found->second(param);
+}
@@ -107 +108 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -123 +124 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -137 +138 @@ int main()
- auto b = new bank();
+ auto *b = new Bank();
@@ -140 +141 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -158 +159 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -166 +167 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -169 +170 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -173 +174 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->get_opt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -183 +184 @@ int main()
- auto fs = new func_store();
+ auto *fs = new FuncStore();
Have any feedback or feature suggestions? Share it here.
@@ -20,12 +20,14 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
@@ -54,7 +56,7 @@ class bank | |||
m_data = a; /// 這裡會複製 | |||
} | |||
|
|||
const std::any& get() | |||
const std::any& get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- method 'get' can be made const [readability-make-member-function-const]
const std::any& get() | |
const std::any& get() const |
@@ -77,6 +79,7 @@ class bank | |||
return std::ref(m_data); | |||
} | |||
std::any m_data; | |||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
std::vector<obj> m_org_data; | |
std::vector<Obj> m_org_data; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:81:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:82:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
@@ -103,7 +106,7 @@ void func(const std::any& a) | |||
//auto ob = std::any_cast<std::vector<obj>>(std::cref(a)); /// 這樣不能轉 | |||
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 | |
auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉 |
@@ -153,7 +156,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |
auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改 |
@@ -153,7 +156,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |||
ov2[8].m_a = -23; | |||
ov2[8].a() = -23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:159:13: warning: [readability-magic-numbers]
8 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:159:23: warning: [readability-magic-numbers]
23 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 14 out of 36 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 7236388..99381d4 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : p_mA{ s_counter++ }
@@ -16 +16 @@ public:
- std::cout << " obj " << m_a << " construct. \n";
+ std::cout << " obj " << p_mA << " construct. \n";
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -20,2 +20,2 @@ public:
- m_a = o.m_a;
- std::cout << "obj " << m_a << " copied. \n";
+ p_mA = o.p_mA;
+ std::cout << "obj " << p_mA << " copied. \n";
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -26 +26 @@ public:
- std::cout << " obj " << m_a << " destruct. \n";
+ std::cout << " obj " << p_mA << " destruct. \n";
@@ -29 +29 @@ public:
- int& a() { return m_a; }
+ int& a() { return p_mA; }
@@ -31,2 +31,2 @@ private:
- int m_a;
- static int m_b;
+ int p_mA;
+ static int s_mB;
@@ -36 +36 @@ private:
-class bank
+class Bank
@@ -39 +39 @@ public:
- bank()
+ Bank()
@@ -43 +43 @@ public:
- ~bank()
+ ~Bank()
@@ -50 +50 @@ public:
- m_data = a;
+ p_mData = a;
@@ -57 +57 @@ public:
- m_data = a; /// 這裡會複製
+ p_mData = a; /// 這裡會複製
@@ -60 +60 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -63 +63 @@ public:
- return m_data;
+ return p_mData;
@@ -68 +68 @@ public:
- return std::any_cast<T>(m_data);
+ return std::any_cast<T>(p_mData);
@@ -73 +73 @@ public:
- return std::any_cast<T>(m_data);
+ return std::any_cast<T>(p_mData);
@@ -80 +80 @@ public:
- return std::ref(m_data);
+ return std::ref(p_mData);
@@ -82,2 +82,2 @@ public:
- std::any m_data;
- std::vector<obj> m_org_data;
+ std::any p_mData;
+ std::vector<Obj> p_mOrgData;
@@ -87 +87 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -92,2 +92,3 @@ public:
- auto found = m_funcs.find(name);
- if (found != m_funcs.end()) return found->second(param);
+ auto found = p_mFuncs.find(name);
+ if (found != p_mFuncs.end()) { return found->second(param);
+}
@@ -97 +98 @@ public:
- std::unordered_map<std::string, func_any> m_funcs;
+ std::unordered_map<std::string, func_any> p_mFuncs;
@@ -108 +109 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -124 +125 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -138 +139 @@ int main()
-������������ new bank();
+ auto *b = new Bank();
@@ -141 +142 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -159 +160 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -167 +168 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -170 +171 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -174 +175 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->get_opt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -184,2 +185,2 @@ int main()
- auto fs = new func_store();
- fs->m_funcs.emplace("any_invoker", any_invoker);
+ auto *fs = new FuncStore();
+ fs->p_mFuncs.emplace("any_invoker", any_invoker);
Have any feedback or feature suggestions? Share it here.
m_a = o.m_a; | ||
std::cout << "obj " << m_a << " copied. \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
m_a = o.m_a; | |
std::cout << "obj " << m_a << " copied. \n"; | |
p_mA = o.p_mA; | |
std::cout << "obj " << p_mA << " copied. \n"; |
@@ -20,13 +20,16 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
@@ -20,13 +20,16 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() | |||
{ | |||
std::cout << " obj " << m_a << " destruct. \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
std::cout << " obj " << m_a << " destruct. \n"; | |
std::cout << " obj " << p_mA << " destruct. \n"; |
~obj() | ||
{ | ||
std::cout << " obj " << m_a << " destruct. \n"; | ||
} | ||
|
||
int& a() { return m_a; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
int& a() { return m_a; } | |
int& a() { return p_mA; } |
int m_a; | ||
static int m_b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
- invalid case style for class member 'm_b' [readability-identifier-naming]
int m_a; | |
static int m_b; | |
int p_mA; | |
static int s_mB; |
@@ -77,6 +80,7 @@ class bank | |||
return std::ref(m_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_data' [readability-identifier-naming]
return std::ref(m_data); | |
return std::ref(p_mData); |
std::any m_data; | ||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
- invalid case style for member 'm_data' [readability-identifier-naming]
- invalid case style for member 'm_org_data' [readability-identifier-naming]
std::any m_data; | |
std::vector<obj> m_org_data; | |
std::any p_mData; | |
std::vector<Obj> p_mOrgData; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:82:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:83:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
@@ -103,7 +107,7 @@ void func(const std::any& a) | |||
//auto ob = std::any_cast<std::vector<obj>>(std::cref(a)); /// 這樣不能轉 | |||
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 | |
auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |
auto& ov2 = b->get_org<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |||
ov2[8].m_a = -23; | |||
ov2[8].a() = -23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:13: warning: [readability-magic-numbers]
8 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:23: warning: [readability-magic-numbers]
23 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 15 out of 42 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 76ae59b..2500e70 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : p_mA{ s_counter++ }
@@ -16 +16 @@ public:
- std::cout << " obj " << m_a << " construct. \n";
+ std::cout << " obj " << p_mA << " construct. \n";
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -20,2 +20,2 @@ public:
- m_a = o.m_a;
- std::cout << "obj " << m_a << " copied. \n";
+ p_mA = o.p_mA;
+ std::cout << "obj " << p_mA << " copied. \n";
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -26 +26 @@ public:
- std::cout << " obj " << m_a << " destruct. \n";
+ std::cout << " obj " << p_mA << " destruct. \n";
@@ -29 +29 @@ public:
- int& a() { return m_a; }
+ int& a() { return p_mA; }
@@ -31,2 +31,2 @@ private:
- int m_a;
- static int m_b;
+ int p_mA;
+ static int s_mB;
@@ -36 +36 @@ private:
-class bank
+class Bank
@@ -39 +39 @@ public:
- bank()
+ Bank()
@@ -43 +43 @@ public:
- ~bank()
+ ~Bank()
@@ -47 +47 @@ public:
- void set(const std::any& aB)
+ void set(const std::any& a_b)
@@ -50 +50 @@ public:
- m_data = aB;
+ p_mData = a_b;
@@ -54 +54 @@ public:
- template <class T> void set_org(const T& a) /// 這樣是物件參考,參數不會複製
+ template <class T> void setOrg(const T& a) /// 這樣是物件參考,參數不會複製
@@ -57 +57 @@ public:
- m_data = a; /// 這裡會複製
+ p_mData = a; /// 這裡會複製
@@ -60 +60 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -63 +63 @@ public:
- return m_data;
+ return p_mData;
@@ -65 +65 @@ public:
- template <class T> T get_org()
+ template <class T> T getOrg()
@@ -68 +68 @@ public:
- return std::any_cast<T>(m_data);
+ return std::any_cast<T>(p_mData);
@@ -70 +70 @@ public:
- template <class T> std::optional<T> get_opt()
+ template <class T> std::optional<T> getOpt()
@@ -73 +73 @@ public:
- return std::any_cast<T>(m_data);
+ return std::any_cast<T>(p_mData);
@@ -75 +75 @@ public:
- template <class T> std::optional<std::reference_wrapper<T>> get_opt_ref()
+ template <class T> std::optional<std::reference_wrapper<T>> getOptRef()
@@ -80 +80 @@ public:
- return std::ref(m_data);
+ return std::ref(p_mData);
@@ -82,2 +82,2 @@ public:
- std::any m_data;
- std::vector<obj> m_org_data;
+ std::any p_mData;
+ std::vector<Obj> p_mOrgData;
@@ -87 +87 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -92,2 +92,3 @@ public:
- auto found = m_funcs.find(name);
- if (found != m_funcs.end()) return found->second(param);
+ auto found = p_mFuncs.find(name);
+ if (found != p_mFuncs.end()) { return found->second(param);
+}
@@ -97 +98 @@ public:
- std::unordered_map<std::string, func_any> m_funcs;
+ std::unordered_map<std::string, func_any> p_mFuncs;
@@ -108 +109 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -124 +125 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -138 +139 @@ int main()
- auto b = new bank();
+ auto *b = new Bank();
@@ -141,2 +142,2 @@ int main()
- std::vector<obj> obj_vec{ 10 };
- b->set_org(obj_vec);
+ std::vector<Obj> obj_vec{ 10 };
+ b->setOrg(obj_vec);
@@ -159 +160 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->getOrg<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -167 +168 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -170,2 +171,2 @@ int main()
- std::vector<obj> obj_vec{ 10 };
- b1->set_org(obj_vec);
+ std::vector<Obj> obj_vec{ 10 };
+ b1->setOrg(obj_vec);
@@ -174 +175 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->getOpt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -176 +177 @@ int main()
- auto ov2 = b1->get_opt_ref<std::any>(); /// 只能取 std::any
+ auto ov2 = b1->getOptRef<std::any>(); /// 只能取 std::any
@@ -184,2 +185,2 @@ int main()
- auto fs = new func_store();
- fs->m_funcs.emplace("any_invoker", any_invoker);
+ auto *fs = new FuncStore();
+ fs->p_mFuncs.emplace("any_invoker", any_invoker);
Have any feedback or feature suggestions? Share it here.
m_a = o.m_a; | ||
std::cout << "obj " << m_a << " copied. \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
m_a = o.m_a; | |
std::cout << "obj " << m_a << " copied. \n"; | |
p_mA = o.p_mA; | |
std::cout << "obj " << p_mA << " copied. \n"; |
@@ -20,13 +20,16 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
@@ -20,13 +20,16 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() | |||
{ | |||
std::cout << " obj " << m_a << " destruct. \n"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
std::cout << " obj " << m_a << " destruct. \n"; | |
std::cout << " obj " << p_mA << " destruct. \n"; |
~obj() | ||
{ | ||
std::cout << " obj " << m_a << " destruct. \n"; | ||
} | ||
|
||
int& a() { return m_a; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
int& a() { return m_a; } | |
int& a() { return p_mA; } |
int m_a; | ||
static int m_b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_a' [readability-identifier-naming]
- invalid case style for class member 'm_b' [readability-identifier-naming]
int m_a; | |
static int m_b; | |
int p_mA; | |
static int s_mB; |
@@ -77,6 +80,7 @@ class bank | |||
return std::ref(m_data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for member 'm_data' [readability-identifier-naming]
return std::ref(m_data); | |
return std::ref(p_mData); |
std::any m_data; | ||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
- invalid case style for member 'm_data' [readability-identifier-naming]
- invalid case style for member 'm_org_data' [readability-identifier-naming]
std::any m_data; | |
std::vector<obj> m_org_data; | |
std::any p_mData; | |
std::vector<Obj> p_mOrgData; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:82:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:83:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
@@ -103,7 +107,7 @@ void func(const std::any& a) | |||
//auto ob = std::any_cast<std::vector<obj>>(std::cref(a)); /// 這樣不能轉 | |||
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 | |
auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
- invalid case style for method 'get_org' [readability-identifier-naming]
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |
auto& ov2 = b->getOrg<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |||
ov2[8].m_a = -23; | |||
ov2[8].a() = -23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:13: warning: [readability-magic-numbers]
8 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:23: warning: [readability-magic-numbers]
23 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cpp-linter Review
Used clang-tidy v12.0.1
Only 10 out of 35 clang-tidy concerns fit within this pull request's diff.
Click here for the full clang-tidy patch
diff --git a/StdAny/StdAny/MeshPrimitive.cpp b/StdAny/StdAny/MeshPrimitive.cpp
index cae0254..de9e675 100644
--- a/StdAny/StdAny/MeshPrimitive.cpp
+++ b/StdAny/StdAny/MeshPrimitive.cpp
@@ -22 +22 @@ using namespace Enigma::Graphics;
-DEFINE_RTTI(Renderables, MeshPrimitive, Primitive);
+defineRtti(Renderables, MeshPrimitive, Primitive);
diff --git a/StdAny/StdAny/StdAny.cpp b/StdAny/StdAny/StdAny.cpp
index 76ae59b..75853b0 100644
--- a/StdAny/StdAny/StdAny.cpp
+++ b/StdAny/StdAny/StdAny.cpp
@@ -11 +11 @@ static int s_counter = 0;
-class obj
+class Obj
@@ -14 +14 @@ public:
- obj() : m_a{ s_counter++ }
+ Obj() : m_a{ s_counter++ }
@@ -18 +18 @@ public:
- obj(const obj& o)
+ Obj(const Obj& o)
@@ -24 +24 @@ public:
- ~obj()
+ ~Obj()
@@ -32 +32 @@ private:
- static int m_b;
+ static int s_mB;
@@ -36 +36 @@ private:
-class bank
+class Bank
@@ -39 +39 @@ public:
- bank()
+ Bank()
@@ -43 +43 @@ public:
- ~bank()
+ ~Bank()
@@ -47 +47 @@ public:
- void set(const std::any& aB)
+ void set(const std::any& a_b)
@@ -50 +50 @@ public:
- m_data = aB;
+ m_data = a_b;
@@ -54 +54 @@ public:
- template <class T> void set_org(const T& a) /// 這樣是物件參考,參數不會複製
+ template <class T> void setOrg(const T& a) /// 這樣是物件參考,參數不會複製
@@ -60 +60 @@ public:
- const std::any& get()
+ const std::any& get() const
@@ -65 +65 @@ public:
- template <class T> T get_org()
+ template <class T> T getOrg()
@@ -70 +70 @@ public:
- template <class T> std::optional<T> get_opt()
+ template <class T> std::optional<T> getOpt()
@@ -75 +75 @@ public:
- template <class T> std::optional<std::reference_wrapper<T>> get_opt_ref()
+ template <class T> std::optional<std::reference_wrapper<T>> getOptRef()
@@ -83 +83 @@ public:
- std::vector<obj> m_org_data;
+ std::vector<Obj> m_mOrgData;
@@ -87 +87 @@ using func_any = std::function<std::any(const std::string&)>;
-class func_store
+class FuncStore
@@ -93 +93,2 @@ public:
- if (found != m_funcs.end()) return found->second(param);
+ if (found != m_funcs.end()) { return found->second(param);
+}
@@ -108 +109 @@ void func(const std::any& a)
- auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉
+ auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉
@@ -114 +115 @@ void func(const std::any& a)
-std::any any_invoker(const std::string& param)
+std::any anyInvoker(const std::string& param)
@@ -124 +125 @@ int main()
- std::vector<obj> obj_vec{ 10 };
+ std::vector<Obj> obj_vec{ 10 };
@@ -138 +139 @@ int main()
- auto b = new bank();
+ auto *b = new Bank();
@@ -141,2 +142,2 @@ int main()
- std::vector<obj> obj_vec{ 10 };
- b->set_org(obj_vec);
+ std::vector<Obj> obj_vec{ 10 };
+ b->setOrg(obj_vec);
@@ -159 +160 @@ int main()
- auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改
+ auto& ov2 = b->getOrg<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改
@@ -167 +168 @@ int main()
- auto b1 = new bank();
+ auto *b1 = new Bank();
@@ -170,2 +171,2 @@ int main()
- std::vector<obj> obj_vec{ 10 };
- b1->set_org(obj_vec);
+ std::vector<Obj> obj_vec{ 10 };
+ b1->setOrg(obj_vec);
@@ -174 +175 @@ int main()
- auto ov1 = b1->get_opt<std::vector<obj>>(); /// optional 給 value, 所以會複製
+ auto ov1 = b1->getOpt<std::vector<Obj>>(); /// optional 給 value, 所以會複製
@@ -176 +177 @@ int main()
- auto ov2 = b1->get_opt_ref<std::any>(); /// 只能取 std::any
+ auto ov2 = b1->getOptRef<std::any>(); /// 只能取 std::any
@@ -184,2 +185,2 @@ int main()
- auto fs = new func_store();
- fs->m_funcs.emplace("any_invoker", any_invoker);
+ auto *fs = new FuncStore();
+ fs->m_funcs.emplace("any_invoker", anyInvoker);
Have any feedback or feature suggestions? Share it here.
using namespace Enigma::Engine; | ||
using namespace Enigma::Graphics; | ||
|
||
DEFINE_RTTI(Renderables, MeshPrimitive, Primitive); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for function 'DEFINE_RTTI' [readability-identifier-naming]
DEFINE_RTTI(Renderables, MeshPrimitive, Primitive); | |
defineRtti(Renderables, MeshPrimitive, Primitive); |
clang-tidy diagnostic
StdAny/StdAny/MeshPrimitive.cpp:1:13: error: [clang-diagnostic-error]
'MeshPrimitive.h' file not found
<U+FEFF>#include "MeshPrimitive.h"
^
@@ -20,13 +20,16 @@ class obj | |||
m_a = o.m_a; | |||
std::cout << "obj " << m_a << " copied. \n"; | |||
} | |||
|
|||
~obj() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
~obj() | |
~Obj() |
int m_a; | ||
static int m_b; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class member 'm_b' [readability-identifier-naming]
static int m_b; | |
static int s_mB; |
@@ -41,10 +44,10 @@ class bank | |||
{ | |||
std::cout << "bank destruct. \n"; | |||
} | |||
void set(const std::any& a) | |||
void set(const std::any& aB) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for parameter 'aB' [readability-identifier-naming]
void set(const std::any& aB) | |
void set(const std::any& a_b) |
{ | ||
std::cout << "set bank data. \n"; | ||
m_data = a; | ||
m_data = aB; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for parameter 'aB' [readability-identifier-naming]
m_data = aB; | |
m_data = a_b; |
@@ -54,7 +57,7 @@ class bank | |||
m_data = a; /// 這裡會複製 | |||
} | |||
|
|||
const std::any& get() | |||
const std::any& get() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- method 'get' can be made const [readability-make-member-function-const]
const std::any& get() | |
const std::any& get() const |
@@ -77,6 +80,7 @@ class bank | |||
return std::ref(m_data); | |||
} | |||
std::any m_data; | |||
std::vector<obj> m_org_data; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
- invalid case style for member 'm_org_data' [readability-identifier-naming]
std::vector<obj> m_org_data; | |
std::vector<Obj> m_mOrgData; |
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:82:14: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_data' has public visibility
std::any m_data;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:83:22: warning: [misc-non-private-member-variables-in-classes]
member variable 'm_org_data' has public visibility
std::vector<obj> m_org_data;
^
@@ -103,7 +107,7 @@ void func(const std::any& a) | |||
//auto ob = std::any_cast<std::vector<obj>>(std::cref(a)); /// 這樣不能轉 | |||
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
auto ob = std::any_cast<std::reference_wrapper<std::vector<obj>>>(a1); /// by reference 要這樣轉 | |
auto ob = std::any_cast<std::reference_wrapper<std::vector<Obj>>>(a1); /// by reference 要這樣轉 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostics
- invalid case style for class 'obj' [readability-identifier-naming]
- invalid case style for method 'get_org' [readability-identifier-naming]
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |
auto& ov2 = b->getOrg<std::vector<Obj>&>(); /// 沒有複製, 可以取出來改 |
@@ -153,7 +157,7 @@ int main() | |||
//auto ov2 = b->get_org<const std::vector<obj>&>(); /// 有複製, auto 不是引用 | |||
//auto& ov2 = b->get_org<const std::vector<obj>&>(); /// 沒有複製 | |||
auto& ov2 = b->get_org<std::vector<obj>&>(); /// 沒有複製, 可以取出來改 | |||
ov2[8].m_a = -23; | |||
ov2[8].a() = -23; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:13: warning: [readability-magic-numbers]
8 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
clang-tidy diagnostic
StdAny/StdAny/StdAny.cpp:160:23: warning: [readability-magic-numbers]
23 is a magic number; consider replacing it with a named constant
ov2[8].a() = -23;
^
No description provided.