Skip to content

Commit 35146f0

Browse files
committed
clang-tidy fixes
1 parent 15cd152 commit 35146f0

File tree

12 files changed

+30
-29
lines changed

12 files changed

+30
-29
lines changed

.clang-tidy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Checks: |
3939
-modernize-return-braced-init-list,
4040
-modernize-make-unique,
4141
-modernize-type-traits,
42+
-modernize-macro-to-enum,
4243
*performance*,
4344
-performance-unnecessary-value-param,
4445
-performance-inefficient-string-concatenation,

examples/config_app.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ int main(int argc, char **argv) {
4040
}
4141

4242
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
43-
<< ", opt count: " << opt->count() << std::endl;
43+
<< ", opt count: " << opt->count() << '\n';
4444
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
45-
<< ", opt count: " << copt->count() << std::endl;
45+
<< ", opt count: " << copt->count() << '\n';
4646
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
47-
std::cout << "Some value: " << value << std::endl;
47+
std::cout << "Some value: " << value << '\n';
4848

4949
return 0;
5050
}

examples/groups.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ int main(int argc, char **argv) {
3030
}
3131

3232
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
33-
<< ", opt count: " << opt->count() << std::endl;
33+
<< ", opt count: " << opt->count() << '\n';
3434
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
35-
<< ", opt count: " << copt->count() << std::endl;
36-
std::cout << "Some value: " << value << std::endl;
35+
<< ", opt count: " << copt->count() << '\n';
36+
std::cout << "Some value: " << value << '\n';
3737

3838
return 0;
3939
}

examples/option_groups.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ int main(int argc, char **argv) {
3333
CLI11_PARSE(app, argc, argv);
3434

3535
std::string format_type = (csv) ? std::string("CSV") : ((human) ? "human readable" : "binary");
36-
std::cout << "Selected " << format_type << " format" << std::endl;
36+
std::cout << "Selected " << format_type << " format\n";
3737
if(!fileLoc.empty()) {
38-
std::cout << " sent to file " << fileLoc << std::endl;
38+
std::cout << " sent to file " << fileLoc << '\n';
3939
} else if(!networkAddress.empty()) {
40-
std::cout << " sent over network to " << networkAddress << std::endl;
40+
std::cout << " sent over network to " << networkAddress << '\n';
4141
} else {
42-
std::cout << " sent to std::cout" << std::endl;
42+
std::cout << " sent to std::cout\n";
4343
}
4444

4545
return 0;

examples/shapes.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ int main(int argc, char **argv) {
1818
int circle_counter{0};
1919
circle->callback([&radius, &circle_counter] {
2020
++circle_counter;
21-
std::cout << "circle" << circle_counter << " with radius " << radius << std::endl;
21+
std::cout << "circle" << circle_counter << " with radius " << radius << '\n';
2222
});
2323

2424
circle->add_option("radius", radius, "the radius of the circle")->required();
@@ -32,7 +32,7 @@ int main(int argc, char **argv) {
3232
if(edge2 == 0) {
3333
edge2 = edge1;
3434
}
35-
std::cout << "rectangle" << rect_counter << " with edges [" << edge1 << ',' << edge2 << "]" << std::endl;
35+
std::cout << "rectangle" << rect_counter << " with edges [" << edge1 << ',' << edge2 << "]\n";
3636
edge2 = 0;
3737
});
3838

@@ -45,7 +45,7 @@ int main(int argc, char **argv) {
4545
tri->callback([&sides, &tri_counter] {
4646
++tri_counter;
4747

48-
std::cout << "triangle" << tri_counter << " with sides [" << CLI::detail::join(sides) << "]" << std::endl;
48+
std::cout << "triangle" << tri_counter << " with sides [" << CLI::detail::join(sides) << "]\n";
4949
});
5050

5151
tri->add_option("sides", sides, "the side lengths of the triangle");

examples/simple.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ int main(int argc, char **argv) {
2828
CLI11_PARSE(app, argc, argv);
2929

3030
std::cout << "Working on file: " << file << ", direct count: " << app.count("--file")
31-
<< ", opt count: " << opt->count() << std::endl;
31+
<< ", opt count: " << opt->count() << '\n';
3232
std::cout << "Working on count: " << count << ", direct count: " << app.count("--count")
33-
<< ", opt count: " << copt->count() << std::endl;
33+
<< ", opt count: " << copt->count() << '\n';
3434
std::cout << "Received flag: " << v << " (" << flag->count() << ") times\n";
35-
std::cout << "Some value: " << value << std::endl;
35+
std::cout << "Some value: " << value << '\n';
3636

3737
return 0;
3838
}

examples/subcom_partitioned.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ int main(int argc, char **argv) {
3737
}
3838

3939
std::cout << "Working on file: " << file << ", direct count: " << impOpt->count("--file")
40-
<< ", opt count: " << opt->count() << std::endl;
40+
<< ", opt count: " << opt->count() << '\n';
4141
std::cout << "Working on count: " << count << ", direct count: " << impOpt->count("--count")
42-
<< ", opt count: " << copt->count() << std::endl;
43-
std::cout << "Some value: " << value << std::endl;
42+
<< ", opt count: " << copt->count() << '\n';
43+
std::cout << "Some value: " << value << '\n';
4444

4545
return 0;
4646
}

examples/subcommands.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ int main(int argc, char **argv) {
2424

2525
CLI11_PARSE(app, argc, argv);
2626

27-
std::cout << "Working on --file from start: " << file << std::endl;
27+
std::cout << "Working on --file from start: " << file << '\n';
2828
std::cout << "Working on --count from stop: " << s->count() << ", direct count: " << stop->count("--count")
29-
<< std::endl;
30-
std::cout << "Count of --random flag: " << app.count("--random") << std::endl;
29+
<< '\n';
30+
std::cout << "Count of --random flag: " << app.count("--random") << '\n';
3131
for(auto *subcom : app.get_subcommands())
32-
std::cout << "Subcommand: " << subcom->get_name() << std::endl;
32+
std::cout << "Subcommand: " << subcom->get_name() << '\n';
3333

3434
return 0;
3535
}

include/CLI/Timer.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class AutoTimer : public Timer {
126126
// GCC 4.7 does not support using inheriting constructors.
127127

128128
/// This destructor prints the string
129-
~AutoTimer() { std::cout << to_string() << std::endl; }
129+
~AutoTimer() { std::cout << to_string() << '\n'; }
130130
};
131131

132132
} // namespace CLI

include/CLI/impl/App_inl.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -658,7 +658,7 @@ CLI11_INLINE int App::exit(const Error &e, std::ostream &out, std::ostream &err)
658658
}
659659

660660
if(e.get_name() == "CallForVersion") {
661-
out << e.what() << std::endl;
661+
out << e.what() << '\n';
662662
return e.get_exit_code();
663663
}
664664

0 commit comments

Comments
 (0)