diff options
| author | tanaka takashi <isazaka@gmail.com> | 2026-06-29 21:43:54 +0900 |
|---|---|---|
| committer | tanaka takashi <isazaka@gmail.com> | 2026-06-30 01:23:51 +0900 |
| commit | 4bc721c3bf7589b519c5730d093f704ce56e3f09 (patch) | |
| tree | 38da055ab15fd70f5c92584560ea73486e5ddce0 /tests/audit.cmake | |
| parent | 4c6a831aa2a57e2bcc20aa3fc2f1b7172f5be285 (diff) | |
refactor: MCP層をmcpc APIベースに刷新
- 独自JSON-RPC処理をmcpcへ置き換え
- 各MCPツールを個別ソースへ分離
- 共通コンテキストと登録処理を整理
- mcpc互換修正と統合テストを更新
Diffstat (limited to 'tests/audit.cmake')
| -rw-r--r-- | tests/audit.cmake | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/audit.cmake b/tests/audit.cmake new file mode 100644 index 0000000..9713f57 --- /dev/null +++ b/tests/audit.cmake @@ -0,0 +1,42 @@ +file(GLOB_RECURSE PROJECT_C_SOURCES + "${SOURCE_DIR}/src/*.c" + "${SOURCE_DIR}/src/*.h" +) + +foreach(source IN LISTS PROJECT_C_SOURCES) + file(READ "${source}" contents) + if(contents MATCHES "(^|[^A-Za-z0-9_])goto([^A-Za-z0-9_]|$)") + message(FATAL_ERROR "goto is forbidden in project source: ${source}") + endif() + if(contents MATCHES "#define[ \t]+static" OR contents MATCHES "#include[ \t]+\"[^\"]+\\.c\"") + message(FATAL_ERROR "test-only source visibility hack found: ${source}") + endif() + string(FIND "${source}" "/src/sys/" sys_position) + if(sys_position EQUAL -1 AND + contents MATCHES "windows\\.h|GetFullPathNameW|CreateFileW|ReadFile|WriteFile|MoveFileExW|BCryptGenRandom") + message(FATAL_ERROR "OS-specific API reference outside src/sys: ${source}") + endif() +endforeach() + +if(NOT CLANG_FORMAT_EXECUTABLE STREQUAL "") + execute_process( + COMMAND "${CLANG_FORMAT_EXECUTABLE}" --dry-run --Werror ${PROJECT_C_SOURCES} + RESULT_VARIABLE format_result + OUTPUT_VARIABLE format_output + ERROR_VARIABLE format_error + ) + if(NOT format_result EQUAL 0) + message(FATAL_ERROR "clang-format check failed:\n${format_output}${format_error}") + endif() +endif() + +execute_process( + COMMAND "${GIT_EXECUTABLE}" diff --check + WORKING_DIRECTORY "${SOURCE_DIR}" + RESULT_VARIABLE diff_result + OUTPUT_VARIABLE diff_output + ERROR_VARIABLE diff_error +) +if(NOT diff_result EQUAL 0) + message(FATAL_ERROR "git diff --check failed:\n${diff_output}${diff_error}") +endif() |
