Commit 2244ecc3f314cc9718dd1c2e4257af64ebcb6adf

Authored by Henry Fredrick Schreiner
Committed by Henry Schreiner
1 parent 5f696596

Adding and fixing Weffc++

CMakeLists.txt
@@ -55,6 +55,13 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) @@ -55,6 +55,13 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
55 endif() 55 endif()
56 else() 56 else()
57 target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow) 57 target_compile_options(CLI11_warnings INTERFACE -Wall -Wextra -pedantic -Wshadow)
  58 + if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
  59 + if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.9)
  60 + # GCC 4.8 has a false positive
  61 + # Other compilers ignore this flag
  62 + target_compile_options(CLI11_warnings INTERFACE -Weffc++)
  63 + endif()
  64 + endif()
58 if(CLI11_WARNINGS_AS_ERRORS) 65 if(CLI11_WARNINGS_AS_ERRORS)
59 target_compile_options(CLI11_warnings INTERFACE -Werror) 66 target_compile_options(CLI11_warnings INTERFACE -Werror)
60 endif() 67 endif()
include/CLI/App.hpp
@@ -65,10 +65,10 @@ class App { @@ -65,10 +65,10 @@ class App {
65 ///@{ 65 ///@{
66 66
67 /// Subcommand name or program name (from parser if name is empty) 67 /// Subcommand name or program name (from parser if name is empty)
68 - std::string name_; 68 + std::string name_{};
69 69
70 /// Description of the current program/subcommand 70 /// Description of the current program/subcommand
71 - std::string description_; 71 + std::string description_{};
72 72
73 /// If true, allow extra arguments (ie, don't throw an error). INHERITABLE 73 /// If true, allow extra arguments (ie, don't throw an error). INHERITABLE
74 bool allow_extras_{false}; 74 bool allow_extras_{false};
@@ -96,32 +96,32 @@ class App { @@ -96,32 +96,32 @@ class App {
96 bool immediate_callback_{false}; 96 bool immediate_callback_{false};
97 97
98 /// This is a function that runs prior to the start of parsing 98 /// This is a function that runs prior to the start of parsing
99 - std::function<void(size_t)> pre_parse_callback_; 99 + std::function<void(size_t)> pre_parse_callback_{};
100 100
101 /// This is a function that runs when parsing has finished. 101 /// This is a function that runs when parsing has finished.
102 - std::function<void()> parse_complete_callback_; 102 + std::function<void()> parse_complete_callback_{};
103 /// This is a function that runs when all processing has completed 103 /// This is a function that runs when all processing has completed
104 - std::function<void()> final_callback_; 104 + std::function<void()> final_callback_{};
105 105
106 ///@} 106 ///@}
107 /// @name Options 107 /// @name Options
108 ///@{ 108 ///@{
109 109
110 /// The default values for options, customizable and changeable INHERITABLE 110 /// The default values for options, customizable and changeable INHERITABLE
111 - OptionDefaults option_defaults_; 111 + OptionDefaults option_defaults_{};
112 112
113 /// The list of options, stored locally 113 /// The list of options, stored locally
114 - std::vector<Option_p> options_; 114 + std::vector<Option_p> options_{};
115 115
116 ///@} 116 ///@}
117 /// @name Help 117 /// @name Help
118 ///@{ 118 ///@{
119 119
120 /// Footer to put after all options in the help output INHERITABLE 120 /// Footer to put after all options in the help output INHERITABLE
121 - std::string footer_; 121 + std::string footer_{};
122 122
123 /// This is a function that generates a footer to put after all other options in help output 123 /// This is a function that generates a footer to put after all other options in help output
124 - std::function<std::string()> footer_callback_; 124 + std::function<std::string()> footer_callback_{};
125 125
126 /// A pointer to the help flag if there is one INHERITABLE 126 /// A pointer to the help flag if there is one INHERITABLE
127 Option *help_ptr_{nullptr}; 127 Option *help_ptr_{nullptr};
@@ -133,7 +133,7 @@ class App { @@ -133,7 +133,7 @@ class App {
133 std::shared_ptr<FormatterBase> formatter_{new Formatter()}; 133 std::shared_ptr<FormatterBase> formatter_{new Formatter()};
134 134
135 /// The error message printing function INHERITABLE 135 /// The error message printing function INHERITABLE
136 - std::function<std::string(const App *, const Error &e)> failure_message_ = FailureMessage::simple; 136 + std::function<std::string(const App *, const Error &e)> failure_message_{FailureMessage::simple};
137 137
138 ///@} 138 ///@}
139 /// @name Parsing 139 /// @name Parsing
@@ -144,35 +144,35 @@ class App { @@ -144,35 +144,35 @@ class App {
144 /// Pair of classifier, string for missing options. (extra detail is removed on returning from parse) 144 /// Pair of classifier, string for missing options. (extra detail is removed on returning from parse)
145 /// 145 ///
146 /// This is faster and cleaner than storing just a list of strings and reparsing. This may contain the -- separator. 146 /// This is faster and cleaner than storing just a list of strings and reparsing. This may contain the -- separator.
147 - missing_t missing_; 147 + missing_t missing_{};
148 148
149 /// This is a list of pointers to options with the original parse order 149 /// This is a list of pointers to options with the original parse order
150 - std::vector<Option *> parse_order_; 150 + std::vector<Option *> parse_order_{};
151 151
152 /// This is a list of the subcommands collected, in order 152 /// This is a list of the subcommands collected, in order
153 - std::vector<App *> parsed_subcommands_; 153 + std::vector<App *> parsed_subcommands_{};
154 154
155 /// this is a list of subcommands that are exclusionary to this one 155 /// this is a list of subcommands that are exclusionary to this one
156 - std::set<App *> exclude_subcommands_; 156 + std::set<App *> exclude_subcommands_{};
157 157
158 /// This is a list of options which are exclusionary to this App, if the options were used this subcommand should 158 /// This is a list of options which are exclusionary to this App, if the options were used this subcommand should
159 /// not be 159 /// not be
160 - std::set<Option *> exclude_options_; 160 + std::set<Option *> exclude_options_{};
161 161
162 /// this is a list of subcommands or option groups that are required by this one, the list is not mutual, the 162 /// this is a list of subcommands or option groups that are required by this one, the list is not mutual, the
163 /// listed subcommands do not require this one 163 /// listed subcommands do not require this one
164 - std::set<App *> need_subcommands_; 164 + std::set<App *> need_subcommands_{};
165 165
166 /// This is a list of options which are required by this app, the list is not mutual, listed options do not need the 166 /// This is a list of options which are required by this app, the list is not mutual, listed options do not need the
167 /// subcommand not be 167 /// subcommand not be
168 - std::set<Option *> need_options_; 168 + std::set<Option *> need_options_{};
169 169
170 ///@} 170 ///@}
171 /// @name Subcommands 171 /// @name Subcommands
172 ///@{ 172 ///@{
173 173
174 /// Storage for subcommand list 174 /// Storage for subcommand list
175 - std::vector<App_p> subcommands_; 175 + std::vector<App_p> subcommands_{};
176 176
177 /// If true, the program name is not case sensitive INHERITABLE 177 /// If true, the program name is not case sensitive INHERITABLE
178 bool ignore_case_{false}; 178 bool ignore_case_{false};
@@ -204,32 +204,32 @@ class App { @@ -204,32 +204,32 @@ class App {
204 App *parent_{nullptr}; 204 App *parent_{nullptr};
205 205
206 /// Counts the number of times this command/subcommand was parsed 206 /// Counts the number of times this command/subcommand was parsed
207 - size_t parsed_ = 0; 207 + size_t parsed_{0};
208 208
209 /// Minimum required subcommands (not inheritable!) 209 /// Minimum required subcommands (not inheritable!)
210 - size_t require_subcommand_min_ = 0; 210 + size_t require_subcommand_min_{0};
211 211
212 /// Max number of subcommands allowed (parsing stops after this number). 0 is unlimited INHERITABLE 212 /// Max number of subcommands allowed (parsing stops after this number). 0 is unlimited INHERITABLE
213 - size_t require_subcommand_max_ = 0; 213 + size_t require_subcommand_max_{0};
214 214
215 /// Minimum required options (not inheritable!) 215 /// Minimum required options (not inheritable!)
216 - size_t require_option_min_ = 0; 216 + size_t require_option_min_{0};
217 217
218 /// Max number of options allowed. 0 is unlimited (not inheritable) 218 /// Max number of options allowed. 0 is unlimited (not inheritable)
219 - size_t require_option_max_ = 0; 219 + size_t require_option_max_{0};
220 220
221 /// The group membership INHERITABLE 221 /// The group membership INHERITABLE
222 std::string group_{"Subcommands"}; 222 std::string group_{"Subcommands"};
223 223
224 /// Alias names for the subcommand 224 /// Alias names for the subcommand
225 - std::vector<std::string> aliases_; 225 + std::vector<std::string> aliases_{};
226 226
227 ///@} 227 ///@}
228 /// @name Config 228 /// @name Config
229 ///@{ 229 ///@{
230 230
231 /// The name of the connected config file 231 /// The name of the connected config file
232 - std::string config_name_; 232 + std::string config_name_{};
233 233
234 /// True if ini is required (throws if not present), if false simply keep going. 234 /// True if ini is required (throws if not present), if false simply keep going.
235 bool config_required_{false}; 235 bool config_required_{false};
@@ -285,6 +285,9 @@ class App { @@ -285,6 +285,9 @@ class App {
285 set_help_flag("-h,--help", "Print this help message and exit"); 285 set_help_flag("-h,--help", "Print this help message and exit");
286 } 286 }
287 287
  288 + App(const App &) = delete;
  289 + App &operator=(const App &) = delete;
  290 +
288 /// virtual destructor 291 /// virtual destructor
289 virtual ~App() = default; 292 virtual ~App() = default;
290 293
include/CLI/ConfigFwd.hpp
@@ -42,13 +42,13 @@ inline std::string ini_join(std::vector&lt;std::string&gt; args) { @@ -42,13 +42,13 @@ inline std::string ini_join(std::vector&lt;std::string&gt; args) {
42 /// Holds values to load into Options 42 /// Holds values to load into Options
43 struct ConfigItem { 43 struct ConfigItem {
44 /// This is the list of parents 44 /// This is the list of parents
45 - std::vector<std::string> parents; 45 + std::vector<std::string> parents{};
46 46
47 /// This is the name 47 /// This is the name
48 - std::string name; 48 + std::string name{};
49 49
50 /// Listing of inputs 50 /// Listing of inputs
51 - std::vector<std::string> inputs; 51 + std::vector<std::string> inputs{};
52 52
53 /// The list of parents and name joined by "." 53 /// The list of parents and name joined by "."
54 std::string fullname() const { 54 std::string fullname() const {
@@ -61,7 +61,7 @@ struct ConfigItem { @@ -61,7 +61,7 @@ struct ConfigItem {
61 /// This class provides a converter for configuration files. 61 /// This class provides a converter for configuration files.
62 class Config { 62 class Config {
63 protected: 63 protected:
64 - std::vector<ConfigItem> items; 64 + std::vector<ConfigItem> items{};
65 65
66 public: 66 public:
67 /// Convert an app into a configuration 67 /// Convert an app into a configuration
include/CLI/FormatterFwd.hpp
@@ -39,7 +39,7 @@ class FormatterBase { @@ -39,7 +39,7 @@ class FormatterBase {
39 39
40 /// @brief The required help printout labels (user changeable) 40 /// @brief The required help printout labels (user changeable)
41 /// Values are Needs, Excludes, etc. 41 /// Values are Needs, Excludes, etc.
42 - std::map<std::string, std::string> labels_; 42 + std::map<std::string, std::string> labels_{};
43 43
44 ///@} 44 ///@}
45 /// @name Basic 45 /// @name Basic
include/CLI/Option.hpp
@@ -233,33 +233,33 @@ class Option : public OptionBase&lt;Option&gt; { @@ -233,33 +233,33 @@ class Option : public OptionBase&lt;Option&gt; {
233 ///@{ 233 ///@{
234 234
235 /// A list of the short names (`-a`) without the leading dashes 235 /// A list of the short names (`-a`) without the leading dashes
236 - std::vector<std::string> snames_; 236 + std::vector<std::string> snames_{};
237 237
238 /// A list of the long names (`--long`) without the leading dashes 238 /// A list of the long names (`--long`) without the leading dashes
239 - std::vector<std::string> lnames_; 239 + std::vector<std::string> lnames_{};
240 240
241 /// A list of the flag names with the appropriate default value, the first part of the pair should be duplicates of 241 /// A list of the flag names with the appropriate default value, the first part of the pair should be duplicates of
242 /// what is in snames or lnames but will trigger a particular response on a flag 242 /// what is in snames or lnames but will trigger a particular response on a flag
243 - std::vector<std::pair<std::string, std::string>> default_flag_values_; 243 + std::vector<std::pair<std::string, std::string>> default_flag_values_{};
244 244
245 /// a list of flag names with specified default values; 245 /// a list of flag names with specified default values;
246 - std::vector<std::string> fnames_; 246 + std::vector<std::string> fnames_{};
247 247
248 /// A positional name 248 /// A positional name
249 - std::string pname_; 249 + std::string pname_{};
250 250
251 /// If given, check the environment for this option 251 /// If given, check the environment for this option
252 - std::string envname_; 252 + std::string envname_{};
253 253
254 ///@} 254 ///@}
255 /// @name Help 255 /// @name Help
256 ///@{ 256 ///@{
257 257
258 /// The description for help strings 258 /// The description for help strings
259 - std::string description_; 259 + std::string description_{};
260 260
261 /// A human readable default value, either manually set, captured, or captured by default 261 /// A human readable default value, either manually set, captured, or captured by default
262 - std::string default_str_; 262 + std::string default_str_{};
263 263
264 /// A human readable type value, set when App creates this 264 /// A human readable type value, set when App creates this
265 /// 265 ///
@@ -267,7 +267,7 @@ class Option : public OptionBase&lt;Option&gt; { @@ -267,7 +267,7 @@ class Option : public OptionBase&lt;Option&gt; {
267 std::function<std::string()> type_name_{[]() { return std::string(); }}; 267 std::function<std::string()> type_name_{[]() { return std::string(); }};
268 268
269 /// Run this function to capture a default (ignore if empty) 269 /// Run this function to capture a default (ignore if empty)
270 - std::function<std::string()> default_function_; 270 + std::function<std::string()> default_function_{};
271 271
272 ///@} 272 ///@}
273 /// @name Configuration 273 /// @name Configuration
@@ -285,32 +285,32 @@ class Option : public OptionBase&lt;Option&gt; { @@ -285,32 +285,32 @@ class Option : public OptionBase&lt;Option&gt; {
285 int expected_max_{1}; 285 int expected_max_{1};
286 286
287 /// A list of Validators to run on each value parsed 287 /// A list of Validators to run on each value parsed
288 - std::vector<Validator> validators_; 288 + std::vector<Validator> validators_{};
289 289
290 /// A list of options that are required with this option 290 /// A list of options that are required with this option
291 - std::set<Option *> needs_; 291 + std::set<Option *> needs_{};
292 292
293 /// A list of options that are excluded with this option 293 /// A list of options that are excluded with this option
294 - std::set<Option *> excludes_; 294 + std::set<Option *> excludes_{};
295 295
296 ///@} 296 ///@}
297 /// @name Other 297 /// @name Other
298 ///@{ 298 ///@{
299 299
300 /// Remember the parent app 300 /// Remember the parent app
301 - App *parent_; 301 + App *parent_{nullptr};
302 302
303 /// Options store a callback to do all the work 303 /// Options store a callback to do all the work
304 - callback_t callback_; 304 + callback_t callback_{};
305 305
306 ///@} 306 ///@}
307 /// @name Parsing results 307 /// @name Parsing results
308 ///@{ 308 ///@{
309 309
310 /// complete Results of parsing 310 /// complete Results of parsing
311 - results_t results_; 311 + results_t results_{};
312 /// results after reduction 312 /// results after reduction
313 - results_t proc_results_; 313 + results_t proc_results_{};
314 /// enumeration for the option state machine 314 /// enumeration for the option state machine
315 enum class option_state { 315 enum class option_state {
316 parsing = 0, //!< The option is currently collecting parsed results 316 parsing = 0, //!< The option is currently collecting parsed results
@@ -336,6 +336,9 @@ class Option : public OptionBase&lt;Option&gt; { @@ -336,6 +336,9 @@ class Option : public OptionBase&lt;Option&gt; {
336 /// @name Basic 336 /// @name Basic
337 ///@{ 337 ///@{
338 338
  339 + Option(const Option &) = delete;
  340 + Option &operator=(const Option &) = delete;
  341 +
339 /// Count the total number of times an option was passed 342 /// Count the total number of times an option was passed
340 size_t count() const { return results_.size(); } 343 size_t count() const { return results_.size(); }
341 344
include/CLI/Validators.hpp
@@ -58,7 +58,7 @@ class Validator { @@ -58,7 +58,7 @@ class Validator {
58 /// Returns a string error message if validation fails. 58 /// Returns a string error message if validation fails.
59 std::function<std::string(std::string &)> func_{[](std::string &) { return std::string{}; }}; 59 std::function<std::string(std::string &)> func_{[](std::string &) { return std::string{}; }};
60 /// The name for search purposes of the Validator 60 /// The name for search purposes of the Validator
61 - std::string name_; 61 + std::string name_{};
62 /// A Validator will only apply to an indexed value (-1 is all elements) 62 /// A Validator will only apply to an indexed value (-1 is all elements)
63 int application_index_ = -1; 63 int application_index_ = -1;
64 /// Enable for Validator to allow it to be disabled if need be 64 /// Enable for Validator to allow it to be disabled if need be
tests/HelpTest.cpp
@@ -570,8 +570,8 @@ TEST(Exit, ExitCodes) { @@ -570,8 +570,8 @@ TEST(Exit, ExitCodes) {
570 570
571 struct CapturedHelp : public ::testing::Test { 571 struct CapturedHelp : public ::testing::Test {
572 CLI::App app{"My Test Program"}; 572 CLI::App app{"My Test Program"};
573 - std::stringstream out;  
574 - std::stringstream err; 573 + std::stringstream out{};
  574 + std::stringstream err{};
575 575
576 int run(const CLI::Error &e) { return app.exit(e, out, err); } 576 int run(const CLI::Error &e) { return app.exit(e, out, err); }
577 577
tests/NewParseTest.cpp
@@ -203,8 +203,8 @@ class spair { @@ -203,8 +203,8 @@ class spair {
203 public: 203 public:
204 spair() = default; 204 spair() = default;
205 spair(const std::string &s1, const std::string &s2) : first(s1), second(s2) {} 205 spair(const std::string &s1, const std::string &s2) : first(s1), second(s2) {}
206 - std::string first;  
207 - std::string second; 206 + std::string first{};
  207 + std::string second{};
208 }; 208 };
209 // an example of custom converter that can be used to add new parsing options 209 // an example of custom converter that can be used to add new parsing options
210 // On MSVC and possibly some other new compilers this can be a free standing function without the template 210 // On MSVC and possibly some other new compilers this can be a free standing function without the template
@@ -352,7 +352,7 @@ template &lt;class X&gt; class objWrapper { @@ -352,7 +352,7 @@ template &lt;class X&gt; class objWrapper {
352 const X &value() const { return val_; } 352 const X &value() const { return val_; }
353 353
354 private: 354 private:
355 - X val_; 355 + X val_{};
356 }; 356 };
357 357
358 // I think there is a bug with the is_assignable in visual studio 2015 it is fixed in later versions 358 // I think there is a bug with the is_assignable in visual studio 2015 it is fixed in later versions
@@ -486,14 +486,17 @@ template &lt;class X&gt; class AobjWrapper { @@ -486,14 +486,17 @@ template &lt;class X&gt; class AobjWrapper {
486 // delete all other constructors 486 // delete all other constructors
487 template <class TT> AobjWrapper(TT &&obj) = delete; 487 template <class TT> AobjWrapper(TT &&obj) = delete;
488 // single assignment operator 488 // single assignment operator
489 - void operator=(X val) { val_ = val; } 489 + AobjWrapper &operator=(X val) {
  490 + val_ = val;
  491 + return *this;
  492 + }
490 // delete all other assignment operators 493 // delete all other assignment operators
491 template <typename TT> void operator=(TT &&obj) = delete; 494 template <typename TT> void operator=(TT &&obj) = delete;
492 495
493 const X &value() const { return val_; } 496 const X &value() const { return val_; }
494 497
495 private: 498 private:
496 - X val_; 499 + X val_{};
497 }; 500 };
498 501
499 static_assert(std::is_assignable<AobjWrapper<uint16_t> &, uint16_t>::value, 502 static_assert(std::is_assignable<AobjWrapper<uint16_t> &, uint16_t>::value,
tests/OptionGroupTest.cpp
@@ -370,16 +370,20 @@ TEST_F(TApp, InvalidOptions) { @@ -370,16 +370,20 @@ TEST_F(TApp, InvalidOptions) {
370 370
371 struct ManyGroups : public TApp { 371 struct ManyGroups : public TApp {
372 372
373 - CLI::Option_group *main;  
374 - CLI::Option_group *g1;  
375 - CLI::Option_group *g2;  
376 - CLI::Option_group *g3;  
377 - std::string name1;  
378 - std::string name2;  
379 - std::string name3;  
380 - std::string val1;  
381 - std::string val2;  
382 - std::string val3; 373 + CLI::Option_group *main{nullptr};
  374 + CLI::Option_group *g1{nullptr};
  375 + CLI::Option_group *g2{nullptr};
  376 + CLI::Option_group *g3{nullptr};
  377 + std::string name1{};
  378 + std::string name2{};
  379 + std::string name3{};
  380 + std::string val1{};
  381 + std::string val2{};
  382 + std::string val3{};
  383 +
  384 + ManyGroups(const ManyGroups &) = delete;
  385 + ManyGroups &operator=(const ManyGroups &) = delete;
  386 +
383 ManyGroups() { 387 ManyGroups() {
384 main = app.add_option_group("main", "the main outer group"); 388 main = app.add_option_group("main", "the main outer group");
385 g1 = main->add_option_group("g1", "group1 description"); 389 g1 = main->add_option_group("g1", "group1 description");
tests/SubcommandTest.cpp
@@ -809,12 +809,15 @@ TEST_F(TApp, RequiredPosInSubcommand) { @@ -809,12 +809,15 @@ TEST_F(TApp, RequiredPosInSubcommand) {
809 809
810 struct SubcommandProgram : public TApp { 810 struct SubcommandProgram : public TApp {
811 811
812 - CLI::App *start;  
813 - CLI::App *stop; 812 + CLI::App *start{nullptr};
  813 + CLI::App *stop{nullptr};
814 814
815 - int dummy;  
816 - std::string file;  
817 - int count; 815 + int dummy{};
  816 + std::string file{};
  817 + int count{};
  818 +
  819 + SubcommandProgram(const SubcommandProgram &) = delete;
  820 + SubcommandProgram &operator=(const SubcommandProgram &) = delete;
818 821
819 SubcommandProgram() { 822 SubcommandProgram() {
820 app.set_help_all_flag("--help-all"); 823 app.set_help_all_flag("--help-all");
@@ -1092,10 +1095,10 @@ TEST_F(SubcommandProgram, CallbackOrderImmediate) { @@ -1092,10 +1095,10 @@ TEST_F(SubcommandProgram, CallbackOrderImmediate) {
1092 1095
1093 struct ManySubcommands : public TApp { 1096 struct ManySubcommands : public TApp {
1094 1097
1095 - CLI::App *sub1;  
1096 - CLI::App *sub2;  
1097 - CLI::App *sub3;  
1098 - CLI::App *sub4; 1098 + CLI::App *sub1{nullptr};
  1099 + CLI::App *sub2{nullptr};
  1100 + CLI::App *sub3{nullptr};
  1101 + CLI::App *sub4{nullptr};
1099 1102
1100 ManySubcommands() { 1103 ManySubcommands() {
1101 app.allow_extras(); 1104 app.allow_extras();
@@ -1105,6 +1108,9 @@ struct ManySubcommands : public TApp { @@ -1105,6 +1108,9 @@ struct ManySubcommands : public TApp {
1105 sub4 = app.add_subcommand("sub4"); 1108 sub4 = app.add_subcommand("sub4");
1106 args = {"sub1", "sub2", "sub3"}; 1109 args = {"sub1", "sub2", "sub3"};
1107 } 1110 }
  1111 +
  1112 + ManySubcommands(const ManySubcommands &) = delete;
  1113 + ManySubcommands &operator=(const ManySubcommands &) = delete;
1108 }; 1114 };
1109 1115
1110 TEST_F(ManySubcommands, Required1Exact) { 1116 TEST_F(ManySubcommands, Required1Exact) {
tests/app_helper.hpp
@@ -13,7 +13,7 @@ using input_t = std::vector&lt;std::string&gt;; @@ -13,7 +13,7 @@ using input_t = std::vector&lt;std::string&gt;;
13 13
14 struct TApp : public ::testing::Test { 14 struct TApp : public ::testing::Test {
15 CLI::App app{"My Test Program"}; 15 CLI::App app{"My Test Program"};
16 - input_t args; 16 + input_t args{};
17 17
18 void run() { 18 void run() {
19 // It is okay to re-parse - clear is called automatically before a parse. 19 // It is okay to re-parse - clear is called automatically before a parse.
@@ -24,7 +24,7 @@ struct TApp : public ::testing::Test { @@ -24,7 +24,7 @@ struct TApp : public ::testing::Test {
24 }; 24 };
25 25
26 class TempFile { 26 class TempFile {
27 - std::string _name; 27 + std::string _name{};
28 28
29 public: 29 public:
30 explicit TempFile(std::string name) : _name(std::move(name)) { 30 explicit TempFile(std::string name) : _name(std::move(name)) {