blob: a376d0b898a8978e6f375ebbaf0ab744e72c3228 [file] [log] [blame]
Anthony Barbier6ff3b192017-09-04 18:44:23 +01001#!/usr/bin/env python3
2
3import sys
4
5if __name__ == "__main__":
6 if len(sys.argv) != 2:
7 print("usage: {} CLANG-TIDY_OUTPUT_FILE".format(sys.argv[0]))
8 sys.exit(1)
9
10 failed = False
11
12 with open(sys.argv[1], mode="r") as clang_tidy_file:
13 lines = clang_tidy_file.readlines()
14
15 for i in range(0, len(lines)):
16 line = lines[i]
17
18 if "error:" in line:
19 if (("Utils.cpp" in line and "'arm_compute_version.embed' file not found" in line) or
20 ("cl2.hpp" in line and "cast from pointer to smaller type 'cl_context_properties' (aka 'int') loses information" in line) or
Pablo Tello383deec2017-06-23 10:40:05 +010021 ("arm_fp16.h" in line) or
Anthony Barbier6ff3b192017-09-04 18:44:23 +010022 ("memory" in line and "cast from pointer to smaller type 'uintptr_t' (aka 'unsigned int') loses information" in line) or
23 "3rdparty" in line):
24 continue
25
26 failed = True
27 print(line)
28 elif "warning:" in line:
29 if ("uninitialized record type: '__ret'" in line or
30 "local variable '__bound_functor' is still referred to by the global variable '__once_callable'" in line or
31 ("Error.cpp" in line and "thrown exception type is not nothrow copy constructible" in line) or
32 ("Error.cpp" in line and "uninitialized record type: 'args'" in line) or
33 ("Error.cpp" in line and "do not call c-style vararg functions" in line) or
34 ("Error.cpp" in line and "do not define a C-style variadic function" in line) or
35 ("NEMinMaxLocationKernel.cpp" in line and "move constructors should be marked noexcept" in line) or
36 ("NEMinMaxLocationKernel.cpp" in line and "move assignment operators should be marked noexcept" in line) or
37 ("PMUCounter.cpp" in line and "consider replacing 'long long' with 'int64'" in line) or
Pablo Tello383deec2017-06-23 10:40:05 +010038 ("Validation.cpp" in line and "parameter 'classified_labels' is unused" in line) or
39 ("Validation.cpp" in line and "parameter 'expected_labels' is unused" in line) or
Georgios Pinitas7b7858d2017-06-21 16:44:24 +010040 ("Reference.cpp" in line and "parameter 'rois' is unused" in line) or
41 ("ReferenceCPP.cpp" in line and "parameter 'rois' is unused" in line) or
Anthony Barbier6ff3b192017-09-04 18:44:23 +010042 "3rdparty" in line):
43 continue
44
45 if "do not use C-style cast to convert between unrelated types" in line:
46 if i + 1 < len(lines) and "vgetq_lane_f16" in lines[i + 1]:
47 continue
48
49 if "use 'using' instead of 'typedef'" in line:
50 if i + 1 < len(lines) and "BOOST_FIXTURE_TEST_SUITE" in lines[i + 1]:
51 continue
52
53 if "do not call c-style vararg functions" in line:
54 if (i + 1 < len(lines) and
55 ("BOOST_TEST" in lines[i + 1] or
56 "BOOST_FAIL" in lines[i + 1] or
57 "BOOST_CHECK_THROW" in lines[i + 1] or
58 "syscall" in lines[i + 1])):
59 continue
60
Moritz Pflanzer94450f12017-06-30 12:48:43 +010061 if "use '= default' to define a trivial default constructor" in line:
62 if i + 1 < len(lines) and "BENCHMARK" in lines[i + 1]:
63 continue
64
Anthony Barbier6ff3b192017-09-04 18:44:23 +010065 failed = True
66 print(line)
67
68 sys.exit(0 if not failed else 1)