[ { "type": "issue", "check_name": "clang-diagnostic-error", "description": "'gtest/test.h' file not found", "content": { "body": "```\n#include \n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 3 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "critical", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n Month month() const; // do\n\n ^\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 9 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n int month(); // don't\n\n ~~~ ^\n\n auto -> int\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 10 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter 'v', make it const or use a pointer", "content": { "body": "```\nvoid do_something(vector& v)\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 14 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-unused-parameters", "description": "parameter 'v' is unused", "content": { "body": "```\nvoid do_something(vector& v)\n\n ^\n\n /*v*/\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 14 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-init-variables", "description": "variable 'val' is not initialized", "content": { "body": "```\n string val;\n\n ^\n\n = 0\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 16 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-special-member-functions", "description": "class 'X' defines a copy constructor and a copy assignment operator but does not define a destructor, a move constructor or a move assignment operator", "content": { "body": "```\nstruct X {\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 28 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-special-member-functions", "description": "class 'X' defines a copy constructor and a copy assignment operator but does not define a destructor, a move constructor or a move assignment operator", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 28 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 'ch' has public visibility", "content": { "body": "```\n char ch;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 29 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 'i' has public visibility", "content": { "body": "```\n int i;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 30 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 's' has public visibility", "content": { "body": "```\n string s;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 31 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 'ch2' has public visibility", "content": { "body": "```\n char ch2;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 32 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n X& operator=(const X& a); // NOLINT(clang-analyzer-valist.Uninitialized)\n\n ~~ ^\n\n auto -> X&\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 34 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\nX waste(const char* p)\n\n~ ^\n\nauto -> X\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 38 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-init-variables", "description": "variable 'n' is not initialized", "content": { "body": "```\n int n = strlen(p);\n\n ^\n\n = 0\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 41 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-owning-memory", "description": "initializing non-owner 'char *' with a newly created 'gsl::owner<>'", "content": { "body": "```\n auto buf = new char[n];\n\n ^\n\n../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp:42:5: type deduction did not result in an owner\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 42 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [ { "lines": { "begin": 42 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" } ] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "llvm-qualified-auto", "description": "'auto buf' can be declared as 'auto *buf'", "content": { "body": "```\n auto buf = new char[n];\n\n ^\n\nnote: this fix will not be applied because it overlaps with another fix\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 42 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-qualified-auto", "description": "'auto buf' can be declared as 'auto *buf'", "content": { "body": "```\nnote: this fix will not be applied because it overlaps with another fix\n\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 42 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-braces-around-statements", "description": "statement should be inside braces", "content": { "body": "```\n for (int i = 0; i < n; ++i) buf[i] = p[i];\n\n ^\n\n {\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 44 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-braces-around-statements", "description": "statement should be inside braces", "content": { "body": "```\n for (int i = 0; i < n; ++i) buf[i] = p[i];\n\n ^\n\n {\n\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 44 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-pro-bounds-pointer-arithmetic", "description": "do not use pointer arithmetic", "content": { "body": "```\n for (int i = 0; i < n; ++i) buf[i] = p[i];\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 44 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-pro-bounds-pointer-arithmetic", "description": "do not use pointer arithmetic", "content": { "body": "```\n for (int i = 0; i < n; ++i) buf[i] = p[i];\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 44 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-owning-memory", "description": "deleting a pointer through a type that is not marked 'gsl::owner<>'; consider using a smart pointer instead", "content": { "body": "```\n delete buf;\n\n ^\n\n../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp:42:5: variable declared here\n auto buf = new char[n];\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 50 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [ { "lines": { "begin": 42 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" } ] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-magic-numbers", "description": "666 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n int i {666};\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 71 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-magic-numbers", "description": "666 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 71 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-explicit-constructor", "description": "single-argument constructors must be marked explicit to avoid unintentional implicit conversions", "content": { "body": "```\n X2(int ii) :i{ii} {} // s and j initialized to their defaults\n\n ^\n\n explicit \n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 76 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-explicit-conversions", "description": "single-argument constructors must be marked explicit to avoid unintentional implicit conversions", "content": { "body": "```\n X2(int ii) :i{ii} {} // s and j initialized to their defaults\n\n ^\n\n explicit \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 76 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-default-member-init", "description": "use default member initializer for 'i'", "content": { "body": "```\n int i;\n\n ^\n\n {ii}\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 81 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-default-member-init", "description": "use default member initializer for 'j'", "content": { "body": "```\n int j;\n\n ^\n\n {jj}\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 83 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-pro-type-member-init", "description": "constructor does not initialize these fields: s", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-explicit-constructor", "description": "constructors that are callable with a single argument must be marked explicit to avoid unintentional implicit conversions", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^\n\n explicit \n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-explicit-conversions", "description": "constructors that are callable with a single argument must be marked explicit to avoid unintentional implicit conversions", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^\n\n explicit \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-member-init", "description": "constructor does not initialize these fields: s", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "fuchsia-default-arguments-declarations", "description": "declaring a parameter with a default argument is disallowed", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^ ~~~~~~\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-magic-numbers", "description": "666 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-magic-numbers", "description": "666 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-unused-parameters", "description": "parameter 'ss' is unused", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^~\n\n /*ss*/\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "fuchsia-default-arguments-declarations", "description": "declaring a parameter with a default argument is disallowed", "content": { "body": "```\n X3(int ii = 666, const string& ss = \"qqq\", int jj = 0)\n\n ^ ~~~~\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 85 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-special-member-functions", "description": "class 'Foo' defines a move assignment operator but does not define a destructor, a copy constructor, a copy assignment operator or a move constructor", "content": { "body": "```\nclass Foo {\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 91 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-special-member-functions", "description": "class 'Foo' defines a move assignment operator but does not define a destructor, a copy constructor, a copy assignment operator or a move constructor", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 91 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-noexcept-move", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\n Foo& operator=(Foo&& a);\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 95 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n Foo& operator=(Foo&& a);\n\n ~~~~ ^\n\n auto -> Foo&\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 95 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "performance-noexcept-move-constructor", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\n Foo& operator=(Foo&& a);\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Performance" ], "location": { "lines": { "begin": 95 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-noexcept-move", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\nFoo& Foo::operator=(Foo&& a) // OK, but there is a cost\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 99 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\nFoo& Foo::operator=(Foo&& a) // OK, but there is a cost\n\n~~~~ ^\n\nauto -> Foo&\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 99 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "performance-noexcept-move-constructor", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\nFoo& Foo::operator=(Foo&& a) // OK, but there is a cost\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Performance" ], "location": { "lines": { "begin": 99 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-braces-around-statements", "description": "statement should be inside braces", "content": { "body": "```\n if (this == &a) return *this; // this line is redundant\n\n ^\n\n {\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 101 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-braces-around-statements", "description": "statement should be inside braces", "content": { "body": "```\n if (this == &a) return *this; // this line is redundant\n\n ^\n\n {\n\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 101 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-special-member-functions", "description": "class 'Vector2' defines a move constructor and a move assignment operator but does not define a destructor, a copy constructor or a copy assignment operator", "content": { "body": "```\nclass Vector2 {\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 108 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-special-member-functions", "description": "class 'Vector2' defines a move constructor and a move assignment operator but does not define a destructor, a copy constructor or a copy assignment operator", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 108 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-pro-type-member-init", "description": "constructor does not initialize these fields: sz", "content": { "body": "```\n Vector2(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 110 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-member-init", "description": "constructor does not initialize these fields: sz", "content": { "body": "```\n Vector2(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 110 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-noexcept-move", "description": "move constructors should be marked noexcept", "content": { "body": "```\n Vector2(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 110 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "performance-noexcept-move-constructor", "description": "move constructors should be marked noexcept", "content": { "body": "```\n Vector2(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Performance" ], "location": { "lines": { "begin": 110 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-noexcept-move", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\n Vector2& operator=(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 111 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n Vector2& operator=(Vector2&& a) { *this = a; } // just use the copy\n\n ~~~~~~~~ ^\n\n auto -> Vector2&\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 111 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "performance-noexcept-move-constructor", "description": "move assignment operators should be marked noexcept", "content": { "body": "```\n Vector2& operator=(Vector2&& a) { *this = a; } // just use the copy\n\n ^\n\n noexcept \n\n```" }, "categories": [ "Performance" ], "location": { "lines": { "begin": 111 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 'elem' has public visibility", "content": { "body": "```\n T* elem;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 114 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-non-private-member-variables-in-classes", "description": "member variable 'sz' has public visibility", "content": { "body": "```\n int sz;\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 115 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter 'a', make it const or use a pointer", "content": { "body": "```\nvoid f2(N::X& a, N::X& b)\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 118 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter 'b', make it const or use a pointer", "content": { "body": "```\nvoid f2(N::X& a, N::X& b)\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 118 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter 'a', make it const or use a pointer", "content": { "body": "```\nvoid f3(N::X& a, N::X& b)\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 123 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-unused-parameters", "description": "parameter 'a' is unused", "content": { "body": "```\nvoid f3(N::X& a, N::X& b)\n\n ^\n\n /*a*/\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 123 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter 'b', make it const or use a pointer", "content": { "body": "```\nvoid f3(N::X& a, N::X& b)\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 123 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "misc-unused-parameters", "description": "parameter 'b' is unused", "content": { "body": "```\nvoid f3(N::X& a, N::X& b)\n\n ^\n\n /*b*/\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 123 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'RED' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define RED 0xFF0000\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 131 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'GREEN' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define GREEN 0x00FF00\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 132 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'BLUE' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define BLUE 0x0000FF\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 133 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'RED' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define RED 0\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 137 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'PURPLE' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define PURPLE 1\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 138 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-macro-usage", "description": "macro 'BLUE' used to declare a constant; consider using a 'constexpr' constant", "content": { "body": "```\n#define BLUE 2\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 139 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-runtime-references", "description": "non-const reference parameter at index 0, make it const or use a pointer", "content": { "body": "```\nvoid reseat(unique_ptr&); // \"will\" or \"might\" reseat pointer\n\n ^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 168 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\nint buf[max]; // OK, but suspicious: uninitialized\n\n^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 171 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 171 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 171 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\nint buf[max] = {0}; // better in some situations\n\n^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 175 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 175 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-avoid-c-arrays", "description": "do not declare C-style arrays, use std::array<> instead", "content": { "body": "```\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 175 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-multiway-paths-covered", "description": "potential uncovered code path; add a default label", "content": { "body": "```\n switch (n) { // good\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 218 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-magic-numbers", "description": "7 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n case 7: // ...\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 220 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-magic-numbers", "description": "7 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 220 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-special-member-functions", "description": "class 'base' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator", "content": { "body": "```\nclass base { public: virtual ~base() = 0; };\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 230 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "hicpp-special-member-functions", "description": "class 'base' defines a non-default destructor but does not define a copy constructor, a copy assignment operator, a move constructor or a move assignment operator", "content": { "body": "```\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 230 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "modernize-use-trailing-return-type", "description": "use a trailing return type for this function", "content": { "body": "```\n std::string get_s() { return s; }\n\n ^\n\n```" }, "categories": [ "Compatibility" ], "location": { "lines": { "begin": 237 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "fuchsia-statically-constructed-objects", "description": "static objects are disallowed; if possible, use a constexpr constructor instead", "content": { "body": "```\nderived1 d1;\n\n^\n\n```" }, "categories": [ "Bug Risk" ], "location": { "lines": { "begin": 240 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-pro-type-cstyle-cast", "description": "do not use C-style cast to convert between unrelated types", "content": { "body": "```\nderived2* p2 = (derived2*)(p); // BAD, tries to treat d1 as a derived2, which it is not\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 243 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-readability-casting", "description": "C-style casts are discouraged; use reinterpret_cast", "content": { "body": "```\nderived2* p2 = (derived2*)(p); // BAD, tries to treat d1 as a derived2, which it is not\n\n ^~~~~~~~~~~\n\n reinterpret_cast\n\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 243 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "google-readability-casting", "description": "C-style casts are discouraged; use const_cast", "content": { "body": "```\n (int&)(i) = 42; // BAD\n\n ^~~~~~\n\n const_cast\n\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 247 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "cppcoreguidelines-avoid-magic-numbers", "description": "42 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n (int&)(i) = 42; // BAD\n\n ^\n\n```" }, "categories": [ "Style" ], "location": { "lines": { "begin": 247 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" }, { "type": "issue", "check_name": "readability-magic-numbers", "description": "42 is a magic number; consider replacing it with a named constant", "content": { "body": "```\n```" }, "categories": [ "Clarity" ], "location": { "lines": { "begin": 247 }, "path": "../home/zjche/Desktop/JOJ3/examples/clang_tidy/sillycode.cpp" }, "trace": { "locations": [] }, "severity": "major", "fingerprint": "" } ]