ArKanjo 0.5.1
A tool for find code duplicated functions in codebases
PreprocessorBuild Class Reference

Codebase preprocessing orchestrator. More...

#include <preprocessor_build.hpp>

+ Inheritance diagram for PreprocessorBuild:
+ Collaboration diagram for PreprocessorBuild:

Public Member Functions

 PreprocessorBuild ()=default
 
 PreprocessorBuild (bool force_preprocess, const fs::path &path, double similarity)
 Testing constructor with direct parameter specification. More...
 
bool validate (const ParsedOptions &options) override
 Validate the arguments already analyzed. More...
 
bool run (const ParsedOptions &options) override
 Executes the main logic of the command. More...
 
- Public Member Functions inherited from CommandBase< PreprocessorBuild >
virtual void print_help (const std::string command_name, const OptionsCollector *collector) const
 
const CliOption * options () const final
 
bool do_run (const std::string command_name, const ParsedOptions &options, const OptionsCollector *collector=nullptr) override
 
- Public Member Functions inherited from ICommand
virtual ~ICommand ()=default
 
virtual const CliOption * options () const =0
 
virtual std::string_view description () const =0
 
virtual bool validate (const ParsedOptions &options)=0
 Validate the arguments already analyzed. More...
 
virtual bool run (const ParsedOptions &options)=0
 Executes the main logic of the command. More...
 
virtual bool do_run (const std::string command_name, const ParsedOptions &options, const OptionsCollector *collector=nullptr)=0
 

Static Public Attributes

static constexpr CliOption options_ []
 

Additional Inherited Members

- Static Public Member Functions inherited from Preprocess_State
static void save_current_run_params (const fs::path &path, const fs::path &cache_path)
 Saves preprocessing parameters for future runs. More...
 
static PreprocessRunParams read_current_run_params ()
 read preprocessing parameters runs More...
 
static bool is_cache_compatible (const std::string &cache_version)
 
- Static Protected Attributes inherited from Preprocess_State
static constexpr const char * CONFIG_PATH = "config.json"
 Configuration file path. More...
 

Detailed Description

Codebase preprocessing orchestrator.

Manages the complete preprocessing pipeline including:

  • Code structure analysis
  • Function extraction
  • Duplication detection
  • Results organization

Creates the foundation for fast query responses during the main operation phase.

Definition at line 52 of file preprocessor_build.hpp.

Constructor & Destructor Documentation

◆ PreprocessorBuild() [1/2]

PreprocessorBuild::PreprocessorBuild ( )
default

◆ PreprocessorBuild() [2/2]

PreprocessorBuild::PreprocessorBuild ( bool  force_preprocess,
const fs::path &  path,
double  similarity 
)

Testing constructor with direct parameter specification.

Parameters
force_preprocessWhether to force preprocessing
pathDirect project path specification
similarityDirect similarity threshold specification
Note
Exposed for testing purposes only

Definition at line 160 of file preprocessor_build.cpp.

Member Function Documentation

◆ run()

bool PreprocessorBuild::run ( const ParsedOptions &  options)
overridevirtual

Executes the main logic of the command.

You must use the validated arguments to perform the action desired by the command.

Parameters
optionsThe ParsedOptions structure will be populated with the arguments.
Returns
True if the execution is successful, false if an error occurs.

Implements ICommand.

Definition at line 186 of file preprocessor_build.cpp.

◆ validate()

bool PreprocessorBuild::validate ( const ParsedOptions &  options)
overridevirtual

Validate the arguments already analyzed.

Verify that all required options have been selected and that the values ​​provided are valid.

Parameters
optionsThe ParsedOptions structure will be populated with the arguments.
Returns
True if the arguments are valid, false otherwise.

Implements ICommand.

Definition at line 167 of file preprocessor_build.cpp.

Member Data Documentation

◆ options_

constexpr CliOption PreprocessorBuild::options_[]
staticconstexpr
Initial value:
= {
{"verbose", 0, NoArgument, "Enable verbose output"},
{"path", 0, RequiredArgument, "Project path to preprocess."},
{"minimum-lines", 0, RequiredArgument, "Minimum clone size in original lines."},
{"granularity", 0, RequiredArgument,
"Comparison granularity: 'function' (default) compares individual "
"functions; 'file' keeps each file whole and compares files against "
"each other. Applies to every duplication finder method."},
{"method", 0, RequiredArgument,
"Duplication finder method: 1|tfidf, 2|diff, 3|ast, 4|embedding."},
}
#define OPTION_END
This marks the end of a long array of options.
@ RequiredArgument
@ NoArgument

Definition at line 142 of file preprocessor_build.hpp.


The documentation for this class was generated from the following files: