- persist TU-owned graphs and guarded configuration evidence - add closed-world production reachability classification - calibrate detector precision and reviewed self-scan policy - terminate poisoned workers instead of longjmp recovery
56 lines
1.7 KiB
C++
56 lines
1.7 KiB
C++
#include <unistd.h>
|
|
|
|
#include <csignal>
|
|
#include <filesystem>
|
|
#include <iostream>
|
|
#include <string>
|
|
|
|
#include "fold/report/finding.hpp"
|
|
#include "fold/report/finding_json.hpp"
|
|
|
|
namespace {
|
|
|
|
void emitFinding(const std::string& path) {
|
|
fold::Finding finding;
|
|
finding.id = "fanout-test:" + std::filesystem::path(path).filename().string();
|
|
finding.kind = fold::FindingKind::HighComplexity;
|
|
finding.confidence = fold::Confidence::Syntactic;
|
|
finding.locations.push_back(fold::Location{path, 1, 1, "fixture"});
|
|
finding.message = "fanout recovery fixture";
|
|
finding.evidence.detector_name = "complexity";
|
|
finding.evidence.backend = "source";
|
|
std::cout << fold::json{{"kind", "finding"}, {"data", fold::findingToJson(finding)}}.dump()
|
|
<< '\n';
|
|
}
|
|
|
|
void emitFinished(const std::string& path) {
|
|
std::cout << fold::json{{"kind", "file_finished"}, {"data", {{"path", path}}}}.dump() << '\n';
|
|
std::cout.flush();
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
std::cout << fold::json{{"kind", "worker_ready"}, {"data", fold::json::object()}}.dump()
|
|
<< '\n';
|
|
std::cout.flush();
|
|
std::string path;
|
|
while (std::getline(std::cin, path)) {
|
|
const auto filename = std::filesystem::path(path).filename().string();
|
|
if (filename == "missing_header.cpp") {
|
|
std::cerr << path << ":1:1: fatal error: 'generated.pb.h' file not found\n";
|
|
return 3;
|
|
}
|
|
if (filename == "crash.cpp") {
|
|
std::raise(SIGSEGV);
|
|
return 4;
|
|
}
|
|
if (filename == "hang.cpp") {
|
|
while (true)
|
|
::pause();
|
|
}
|
|
emitFinding(path);
|
|
emitFinished(path);
|
|
}
|
|
return 0;
|
|
}
|