MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / check

Method check

tools/ci/cpp_check.py:50–86  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

48 self.file_list = file_list
49
50 def check(self):
51 file_list_filtered = [file for file in self.file_list if file.endswith(('.c', '.cpp', '.cc', '.cxx'))]
52 logging.info("Start to static code analysis.")
53 check_result = True
54 for file in file_list_filtered:
55 macros = []
56 if os.path.basename(file) == 'lwp.c':
57 macros.append('-DRT_USING_DFS')
58
59 result = subprocess.run(
60 [
61 'cppcheck',
62 '-DRT_ASSERT(x)=',
63 '-DRTM_EXPORT(x)=',
64 '-Drt_list_for_each_entry(a,b,c)=a=(void*)b;',
65 '-I include',
66 '-I thread/components/finsh',
67 # it's okay because CI will do the real compilation to check this
68 '--suppress=syntaxError',
69 '--check-level=exhaustive',
70 '--enable=warning',
71 'performance',
72 'portability',
73 '--inline-suppr',
74 '--error-exitcode=1',
75 '--force',
76 file
77 ] + macros,
78 stdout = subprocess.PIPE, stderr = subprocess.PIPE)
79 logging.info(result.stdout.decode())
80 logging.info(result.stderr.decode())
81 if result.stderr:
82 add_summary("The following errors are for reference only. If they are not actual issues, please ignore them and do not make unnecessary modifications.")
83 add_summary("以下错误仅供参考,如果发现没有问题,请直接忽略,不需要强行修改")
84 add_summary(f"- :rotating_light: {result.stderr.decode()}")
85 check_result = False
86 return check_result
87
88@click.group()
89@click.pass_context

Callers 2

checkFunction · 0.95

Calls 2

add_summaryFunction · 0.70
runMethod · 0.45

Tested by

no test coverage detected