Skip to content

Commit 75b401a

Browse files
authored
Merge 5f84ed8 into b5d01b5
2 parents b5d01b5 + 5f84ed8 commit 75b401a

37 files changed

+445
-280
lines changed

.github/workflows/ccpp.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ jobs:
1515
- name: Run Duplo Analyser
1616
uses: dlidstrom/[email protected]
1717
with:
18-
include-pattern: src
18+
directory: src
19+
include-pattern: \.cpp$
1920
bump-tag-dry:
2021
runs-on: ubuntu-latest
2122
needs: [duplicates]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
src/.cache
12
ipch
23
*.user
34
Debug

.theia/settings.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ FetchContent_MakeAvailable(nlohmann_json)
1717
add_executable(duplo ${SOURCES})
1818

1919
set_target_properties(duplo PROPERTIES
20-
CXX_STANDARD 17
20+
CXX_STANDARD 20
2121
CXX_STANDARD_REQUIRED ON
2222
)
2323

src/ConsoleExporter.cpp

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
#include "ConsoleExporter.h"
2+
#include "FileExporter.h"
3+
4+
#include <iostream>
5+
6+
ConsoleExporter::ConsoleExporter(const Options& options)
7+
: FileExporter(options, true) {
8+
}
9+
10+
void ConsoleExporter::LogMessage(const std::string& message) {
11+
Log() << message << std::flush;
12+
}
13+
14+
void ConsoleExporter::WriteHeader() {}
15+
void ConsoleExporter::WriteFooter(
16+
const Options& options,
17+
int files,
18+
long locsTotal,
19+
const ProcessResult& processResult) {
20+
Out()
21+
<< "Configuration:"
22+
<< std::endl
23+
<< " Number of files: "
24+
<< files
25+
<< std::endl
26+
<< " Minimal block size: "
27+
<< options.GetMinBlockSize()
28+
<< std::endl
29+
<< " Minimal characters in line: "
30+
<< options.GetMinChars()
31+
<< std::endl
32+
<< " Ignore preprocessor directives: "
33+
<< options.GetIgnorePrepStuff()
34+
<< std::endl
35+
<< " Ignore same filenames: "
36+
<< options.GetIgnoreSameFilename()
37+
<< std::endl
38+
<< std::endl
39+
<< "Results:"
40+
<< std::endl
41+
<< " Lines of code: "
42+
<< locsTotal
43+
<< std::endl
44+
<< " Duplicate lines of code: "
45+
<< processResult.DuplicateLines()
46+
<< std::endl
47+
<< " Total "
48+
<< processResult.Blocks()
49+
<< " duplicate block(s) found."
50+
<< std::endl
51+
<< std::endl;
52+
}
53+
54+
void ConsoleExporter::ReportSeq(
55+
int line1,
56+
int line2,
57+
int count,
58+
const SourceFile& source1,
59+
const SourceFile& source2) {
60+
Out()
61+
<< source1.GetFilename()
62+
<< "(" << source1.GetLine(line1).GetLineNumber() << ")"
63+
<< std::endl;
64+
Out()
65+
<< source2.GetFilename()
66+
<< "(" << source2.GetLine(line2).GetLineNumber() << ")"
67+
<< std::endl;
68+
for (int j = 0; j < count; j++) {
69+
Out() << source1.GetLine(j + line1).GetLine() << std::endl;
70+
}
71+
72+
Out() << std::endl;
73+
}

0 commit comments

Comments
 (0)