ArKanjo 0.5.1
A tool for find code duplicated functions in codebases
counter_duplication_code.hpp
Go to the documentation of this file.
1
13#pragma once
14
15#include <arkanjo/base/path.hpp>
18#include <set>
19
21
29class CounterDuplicationCode : public CommandBase<CounterDuplicationCode> {
30 private:
31 std::set<Path> processed_paths;
32 CounterDuplicationCodeTrie counter_duplication_code_trie;
33 Similarity_Table* similarity_table;
34
39 void mark_path_as_processed(Path path);
40
46 bool is_path_processed_path(Path path);
47
53 static int get_number_of_lines_in_path(const Path& path);
54
61 void register_code_duplication(const Path& path1, const Path& path2, int number_of_lines);
62
67 void process_path(const Path& path);
68
72 void process_every_path_in_similarity_table();
73
80 std::vector<std::string> common_folders(const Path& path1, const Path& path2) const;
81
82 public:
84 "Analyze and report duplicated lines across the codebase, grouped by "
85 "folder hierarchy. The command processes all detected duplications and "
86 "displays the total number of duplicated lines per directory.")
87
88
92 explicit CounterDuplicationCode(Similarity_Table* _similarity_table);
93
94 bool validate(const ParsedOptions& options) override;
95
99 bool run(const ParsedOptions& options) override;
100};
const CliOption * options() const final
Trie structure for hierarchical duplication counting.
Code duplication analyzer and reporter.
COMMAND_DESCRIPTION("Analyze and report duplicated lines across the codebase, grouped by " "folder hierarchy. The command processes all detected duplications and " "displays the total number of duplicated lines per directory.") explicit CounterDuplicationCode(Similarity_Table *_similarity_table)
Constructs analyzer with similarity data.
bool validate(const ParsedOptions &options) override
Validate the arguments already analyzed.
bool run(const ParsedOptions &options) override
Handles duplication analysis command.
Represents a logical path to a function in the codebase.
Definition: path.hpp:26
Represents a similarity graph between functions (paths).
Trie-based code duplication counter.
Logical path abstraction for source code elements.
Similarity relationships storage and analysis.