diff options
| author | Shell <[email protected]> | 2024-03-28 23:42:56 +0800 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-28 23:42:56 +0800 |
| commit | 83e95bdff4c48c661b50e1eec56d5fd293b28fbb (patch) | |
| tree | 9e0c2065950f0804e5009da71c8e0f590224cade /tools/ci | |
| parent | 40e26f4909fa61ada775ba86b44d8300aaf5d250 (diff) | |
sync smart & dfs (#8672)
Signed-off-by: xqyjlj <[email protected]>
Signed-off-by: Shell <[email protected]>
Co-authored-by: xqyjlj <[email protected]>
Diffstat (limited to 'tools/ci')
| -rw-r--r-- | tools/ci/cpp_check.py | 18 | ||||
| -rw-r--r-- | tools/ci/file_check.py | 10 |
2 files changed, 23 insertions, 5 deletions
diff --git a/tools/ci/cpp_check.py b/tools/ci/cpp_check.py index 018f86fda4..dc9f6610b9 100644 --- a/tools/ci/cpp_check.py +++ b/tools/ci/cpp_check.py @@ -23,7 +23,23 @@ class CPPCheck: logging.info("Start to static code analysis.") check_result = True for file in file_list_filtered: - result = subprocess.run(['cppcheck', '-DRTM_EXPORT', '-DMSH_CMD_EXPORT(a,b)=', '--enable=warning', 'performance', 'portability', '--inline-suppr', '--error-exitcode=1', '--force', file], stdout = subprocess.PIPE, stderr = subprocess.PIPE) + result = subprocess.run( + [ + 'cppcheck', + '-DRT_ASSERT(x)=', + '-Drt_list_for_each_entry(a,b,c)=a=(void*)b', + '-I include', + '-I thread/components/finsh', + '--suppress=syntaxError', + '--enable=warning', + 'performance', + 'portability', + '--inline-suppr', + '--error-exitcode=1', + '--force', + file + ], + stdout = subprocess.PIPE, stderr = subprocess.PIPE) logging.info(result.stdout.decode()) logging.info(result.stderr.decode()) if result.stderr: diff --git a/tools/ci/file_check.py b/tools/ci/file_check.py index ea9052d240..597c8c33b0 100644 --- a/tools/ci/file_check.py +++ b/tools/ci/file_check.py @@ -121,7 +121,7 @@ class FormatCheck: self.file_list = file_list def __check_rt_errorcode(self, line): - pattern = re.compile(r'return\s+(RT_ERROR|RT_ETIMEOUT|RT_EFULL|RT_EEMPTY|RT_ENOMEM|RT_ENOSYS|RT_EBUSY|RT_EIO|RT_EINTR|RT_EINVAL|RT_ENOENT|RT_ENOSPC|RT_EPERM|RT_ETRAP|RT_EFAULT)') + pattern = re.compile(r'return\s+(RT_ERROR|RT_ETIMEOUT|RT_EFULL|RT_EEMPTY|RT_ENOMEM|RT_ENOSYS|RT_EBUSY|RT_EIO|RT_EINTR|RT_EINVAL|RT_ENOENT|RT_ENOSPC|RT_EPERM|RT_ETRAP|RT_EFAULT)') match = pattern.search(line) if match: return False @@ -163,14 +163,16 @@ class FormatCheck: with open(file_path, 'rb') as f: file = f.read() # get file encoding - code = chardet.detect(file)['encoding'] + chardet_report = chardet.detect(file) + code = chardet_report['encoding'] + confidence = chardet_report['confidence'] except Exception as e: logging.error(e) else: continue - if code != 'utf-8' and code != 'ascii': - logging.error("[{0}]: encoding not utf-8, please format it.".format(file_path)) + if code != 'utf-8' and code != 'ascii' and confidence > 0.8: + logging.error("[{0}]: encoding {1} not utf-8, please format it.".format(file_path, code)) encoding_check_result = False else: logging.info('[{0}]: encoding check success.'.format(file_path)) |
