From b101c9d1fa99286bab53bcbc3e7be73b9597db82 Mon Sep 17 00:00:00 2001 From: Colin Clark Date: Thu, 29 Feb 2024 11:23:38 +0000 Subject: [PATCH] Run Code Correctness checks on all source files In tests, run Code Correctness checks on all source files rather than just modified files. Files in the third-party directory are not checked. --- meson.build | 15 +++++---------- src/jpeg-parser.cc | 4 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/meson.build b/meson.build index e888e074..294f9d5b 100644 --- a/meson.build +++ b/meson.build @@ -706,18 +706,13 @@ if running_from_git clang_tidy_exe = find_program('clang-tidy', required : false) if clang_tidy_exe.found() git_exe = find_program('git', required : true) - modified_file_list = run_command(git_exe, 'diff', 'origin/master', '--name-only', '--diff-filter=d', './src/*.cc', './src/pan-view/*.cc', './src/view-file/*.cc', check: true) - modified_files = modified_file_list.stdout().strip().split('\n') - - foreach modified_file : modified_files - if modified_file.endswith('.cc') - modified_file_path = '@0@'.format(modified_file) - path_array = modified_file_path.split('/') - modified_file_name = path_array[path_array.length() - 1] - modified_file_full_path = join_paths(meson.project_source_root(), modified_file) + + foreach source_file : main_sources + pan_view_sources + view_file_sources + if fs.name(source_file).endswith('.cc') + source_file_name = fs.name(source_file) config_file = join_paths(meson.project_source_root(), '.clang-tidy') - test('Code Correctness_ ' + modified_file_name, clang_tidy_exe, args : ['-p', './build', '-quiet', '--config-file', config_file, modified_file_full_path], timeout : 100) + test('Code Correctness_ ' + source_file_name, clang_tidy_exe, args : ['-p', './build', '-quiet', '--config-file', config_file, source_file], timeout : 100) endif endforeach diff --git a/src/jpeg-parser.cc b/src/jpeg-parser.cc index ebde0f0c..295a251b 100644 --- a/src/jpeg-parser.cc +++ b/src/jpeg-parser.cc @@ -99,7 +99,7 @@ guint32 tiff_byte_get_int32(const guchar *f, TiffByteOrder bo) if (bo == TIFF_BYTE_ORDER_INTEL) return GUINT32_FROM_LE(align_buf); - return GUINT32_FROM_BE(align_buf); + return GUINT32_FROM_BE(align_buf); // NOLINT } #pragma GCC diagnostic push @@ -130,7 +130,7 @@ void tiff_byte_put_int32_unused(guchar *f, guint32 n, TiffByteOrder bo) } else { - align_buf = GUINT32_TO_BE(n); + align_buf = GUINT32_TO_BE(n); // NOLINT } memcpy(f, &align_buf, sizeof(guint32)); -- 2.20.1