Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ jobs:
- name: Run Duplo Analyser
uses: dlidstrom/[email protected]
with:
include-pattern: src
directory: src
include-pattern: \.cpp$
bump-tag-dry:
runs-on: ubuntu-latest
needs: [duplicates]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
src/.cache
ipch
*.user
Debug
Expand Down
4 changes: 0 additions & 4 deletions .theia/settings.json

This file was deleted.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ FetchContent_MakeAvailable(nlohmann_json)
add_executable(duplo ${SOURCES})

set_target_properties(duplo PROPERTIES
CXX_STANDARD 17
CXX_STANDARD 20
CXX_STANDARD_REQUIRED ON
)

Expand Down
73 changes: 73 additions & 0 deletions src/ConsoleExporter.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include "ConsoleExporter.h"
#include "FileExporter.h"

#include <iostream>

ConsoleExporter::ConsoleExporter(const Options& options)
: FileExporter(options, true) {
}

void ConsoleExporter::LogMessage(const std::string& message) {
Log() << message << std::flush;
}

void ConsoleExporter::WriteHeader() {}
void ConsoleExporter::WriteFooter(
const Options& options,
int files,
long locsTotal,
const ProcessResult& processResult) {
Out()
<< "Configuration:"
<< std::endl
<< " Number of files: "
<< files
<< std::endl
<< " Minimal block size: "
<< options.GetMinBlockSize()
<< std::endl
<< " Minimal characters in line: "
<< options.GetMinChars()
<< std::endl
<< " Ignore preprocessor directives: "
<< options.GetIgnorePrepStuff()
<< std::endl
<< " Ignore same filenames: "
<< options.GetIgnoreSameFilename()
<< std::endl
<< std::endl
<< "Results:"
<< std::endl
<< " Lines of code: "
<< locsTotal
<< std::endl
<< " Duplicate lines of code: "
<< processResult.DuplicateLines()
<< std::endl
<< " Total "
<< processResult.Blocks()
<< " duplicate block(s) found."
<< std::endl
<< std::endl;
}

void ConsoleExporter::ReportSeq(
int line1,
int line2,
int count,
const SourceFile& source1,
const SourceFile& source2) {
Out()
<< source1.GetFilename()
<< "(" << source1.GetLine(line1).GetLineNumber() << ")"
<< std::endl;
Out()
<< source2.GetFilename()
<< "(" << source2.GetLine(line2).GetLineNumber() << ")"
<< std::endl;
for (int j = 0; j < count; j++) {
Out() << source1.GetLine(j + line1).GetLine() << std::endl;
}

Out() << std::endl;
}
Loading
Loading