Arkanjo 0.2
A tool for find code duplicated functions in codebases
Loading...
Searching...
No Matches
preprocessor_build.hpp
Go to the documentation of this file.
1
13#pragma once
14
17#include "function_breaker.hpp"
18#include "parser.hpp"
22#include <string>
23#include <tuple>
24#include <filesystem>
25using namespace std;
26namespace fs = std::filesystem;
27
39class PreprocessorBuild : public Preprocessor, public CommandBase<PreprocessorBuild> {
40 private:
41 static constexpr const char* TEMPLATE_COUNT =
42 "The total number of functions that are "
43 "similar to the found one is {count}. "
44 "More info about them are listed below.";
45 // User interaction messages
46 string PROJECT_PATH_MESSAGE = "Enter your project path:";
47 string MINIMUM_SIMILARITY_MESSAGE = "Enter minimum similarity desired on using the tool:";
48
49 // Processing stage messages
50 string INITIAL_MESSAGE = "Initiating Preprocessing";
51 string BREAKER_MESSAGE = "Reading codebase... (this may take a while)";
52 string DUPLICATION_MESSAGE = "Finding duplication in the codebase... (this may take a while)";
53 string SAVING_MESSAGE = "Saving results...";
54 string END_MESSAGE = "Finished preprocessing";
55
56 // Duplication finder selection messages
57 string MESSAGE_DUPLICATION_FINDER_TYPE_1 = "Enter the number of the duplication finder technique you want to use:";
58 string MESSAGE_DUPLICATION_FINDER_TYPE_2 = "1) NLP text similarity using gensim";
59 string MESSAGE_DUPLICATION_FINDER_TYPE_3 = "2) Count proportion of equal lines using diff command";
60 string INVALID_CODE_DUPLICATION_FINDER = "Valid options are '1' or '2' only. Stopping Program...";
61
69 tuple<string, double, bool> read_parameters();
70
77 void preprocess(const fs::path& path, double similarity, bool use_duplication_finder_by_tool);
78
79 public:
81
86 PreprocessorBuild(bool force_preprocess);
87
95 PreprocessorBuild(bool force_preprocess, const fs::path& path, double similarity);
96
97 COMMAND_DESCRIPTION("Creates the foundation for fast query responses during the main operation phase.")
98
99 bool validate(const ParsedOptions& options) override;
100
101 bool run(const ParsedOptions& options) override;
102};
const CliOption * options() const final
Codebase preprocessing orchestrator.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
bool run(const ParsedOptions &options) override
Executes the main logic of the command.
#define COMMAND_DESCRIPTION(str)
Configuration management interface.
Code duplication preprocessing system.
Main duplication detection tool interface.
Main function extraction interface.
Code duplication results parser.