12 base_path = base_path_;
13 similarity = similarity_;
18 if (!feature_name.empty())
19 fs::path output_parsed = base_path / (
"output_parsed" + feature_name +
".txt");
21 fs::path cwd = fs::current_path();
22 fs::current_path(folder_path);
24 std::string command_tool =
"python3 -W ignore ";
26 command_tool +=
"/tfidf/duplicate_code_detection.py";
27 command_tool +=
" --project-root-dir ";
28 command_tool += folder_path.string();
29 command_tool +=
" -d ";
30 command_tool += folder_path.string();
34 FILE* pipe = popen(command_tool.c_str(),
"r");
36 std::cerr <<
"Error executing the tool.\n";
40 Parser parser(output_parsed, similarity);
43 fs::current_path(cwd);
54 fs::path relative(fd.
path);
55 std::string filename = fd.
function_name + relative.extension().string();
56 fs::path path = base / relative / filename;
static Config & config()
Gets the singleton configuration instance.
std::string function_name
Name of the function.
std::shared_ptr< T > get_feature() const
fs::path build_similarity_path() const
Builds similarity file path.
Parses and transforms duplication detection tool output.
void exec_from_stream(FILE *pipe)
Main parsing execution method using stream.
void on_function(const FunctionData &fd) override
TfidfMethod(const fs::path &base_path_, double similarity_)
Constructs the duplication finder tool.
void execute_by_feature(const fs::path &path, const std::string feature_name="")
Executes the full duplication analysis pipeline.
Configuration management interface.
Provides access to function storage locations.
void write_file(const fs::path &path, const std::string &content)
Writes content to a file at specified path.
fs::path source_feature_path
std::filesystem::path third_party_dir
Directory containing third-party dependencies.
Main duplication detection tool interface.