Run Code Correctness checks on all source files
authorColin Clark <colin.clark@cclark.uk>
Thu, 29 Feb 2024 11:23:38 +0000 (11:23 +0000)
committerColin Clark <colin.clark@cclark.uk>
Thu, 29 Feb 2024 11:23:38 +0000 (11:23 +0000)
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
src/jpeg-parser.cc

index e888e07..294f9d5 100644 (file)
@@ -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
 
index ebde0f0..295a251 100644 (file)
@@ -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));