11# CPPINCLUDE
22
33Tool for analyzing includes in C++.
4- One of the problem in C++ is that if header file was changed all files that
5- include the file will be recompiled and sometime it takes a lot of time.
4+ One of the problems in C++ is that if a header file was changed all files that
5+ include that file will be recompiled and sometime it takes a lot of time.
66
77## Table of Contents
88
@@ -69,9 +69,10 @@ public:
6969
7070```
7171
72- If file * char_kind.hpp* is changed all files that include * base_char_factory.hpp*
73- and * base_char.hpp* will be recompile and it will take time. This tool helps to find
74- file in top of include hierarchy:
72+ If file * char_kind.hpp* is changed all files that
73+ include * base_char_factory.hpp* and * base_char.hpp* will be recompiled and
74+ it will take time. This tool helps to find the file at the top of
75+ the include hierarchy:
7576
7677```
7778cppinclude
@@ -123,8 +124,8 @@ Name|Short description
123124
124125### configuration_file
125126
126- The tool read setting from * .cppinclude.json* in work directory or
127- you can set file in argument * configuration_file* .
127+ The tool reads settings from * .cppinclude.json* located in the work directory or
128+ you can pass a configuration file in the argument * configuration_file* .
128129For example:
129130
130131` cppinclude --configuration_file=project.json `
@@ -138,102 +139,103 @@ Path to generated *compile_commands.json* file by CMake with argument
138139
139140` cmake .. -DCMAKE_EXPORT_COMPILE_COMMANDS=ON `
140141
141- You can set path in configuration file:
142+ You can set the path for the compile_command.json file in the configuration file:
142143
143144``` json
144145{
145146 "compile_commands" : " build/compile_commands.json"
146147}
147148```
148149
149- or in arguments :
150+ or, pass as an argument :
150151
151152` cppinclude --compile_commands=build/compile_commands.json `
152153
153154[ Back to top] ( #cppinclude )
154155
155156### project_dir
156157
157- Path to folder with sources. Often source files are located in * src * or
158- * sources* folder, not in root folder of project.
159- You can set in configuration file:
158+ PPath to a folder that contains sources. Often source files are located
159+ in * src * or * sources* folder, not in the root folder of project.
160+ You can set it in configuration file with :
160161
161162``` json
162163{
163164 "project_dir" : " src"
164165}
165166```
166167
167- or in arguments :
168+ or, pass as an argument :
168169
169170` cppinclude --project_dir=src `
170171
171172[ Back to top] ( #cppinclude )
172173
173174### file_extensions
174175
175- If you use file extensions for C++ that aren’t in default values. You can set in
176- configuration file:
176+ If you use other file extensions than default values * file_extensions *
177+ for C++ sources you can specify them in the configuration file with :
177178
178179``` json
179180{
180181 "file_extensions" : [" *.cc" , " *.hh" ]
181182}
182183```
183184
184- or in arguments :
185+ or, pass as an argument :
185186
186187` cppinclude --file_extensions=*.cc,*hh `
187188
188189[ Back to top] ( #cppinclude )
189190
190191### analyze_without_extension
191192
192- Analyze files in project directory without extension , default: false.
193- You can set in configuration file:
193+ Analyze files without extension in the project directory, default: false.
194+ You can set this option in the configuration file with :
194195
195196``` json
196197{
197198 "analyze_without_extension" : true
198199}
199200```
200201
201- or in arguments :
202+ or, pass as an argument :
202203
203204` cppinclude --analyze_without_extension=true `
204205
205206[ Back to top] ( #cppinclude )
206207
207208### include_dirs
208209
209- Add folders where search included files . Default value is project folder.
210- You can set in configuration file:
210+ Add paths to the header search directories . Default value is project folder.
211+ You can set it in the configuration file with :
211212
212213``` json
213214{
214215 "include_dirs" : [ " lib1" , " lib2" ]
215216}
216217```
217218
218- or in arguments :
219+ or, pass as an argument :
219220
220221` cppinclude --include_dirs=lib1,lib2 `
221222
222223[ Back to top] ( #cppinclude )
223224
224225### ignore_dirs
225226
226- Folders that will be ignored during analyzing project’s files.
227- It can be third-party libraries that are located in project directory
228- but don't need to analyze. You can set in configuration file:
227+ Folders to be ignored during project analysis.
228+ For example: third-party libraries that are located under the project directory
229+ but should not be analyzed.
230+ You can set it in the configuration file with:
229231
230232``` json
231233{
232234 "ignore_dirs" : [" ./3rd-part" , " gtest" ]
233235}
234236```
235237
236- or in arguments :
238+ or, pass as an argument :
237239
238240` cppinclude --ignore_dirs=./3rd-part,gtest `
239241
@@ -242,15 +244,15 @@ or in arguments:
242244### ignore_system_includes
243245
244246Ignore includes with * \<\> * , example * #include \< iostream\> * will be ignored.
245- You can set in configuration file:
247+ You can set it in the configuration file with :
246248
247249``` json
248250{
249251 "ignore_system_includes" : true
250252}
251253```
252254
253- or in arguments :
255+ or, pass as an argument :
254256
255257` cppinclude --ignore_system_includes=true `
256258
@@ -268,7 +270,7 @@ or generated files (*.gen). You can set in configuration file
268270}
269271```
270272
271- or in arguments :
273+ or, pass as an argument :
272274
273275` cppinclude --ignore_files=boost/.*,.*\\.def `
274276
@@ -278,18 +280,20 @@ or in arguments:
278280
279281Name of report. Possible values:
280282
281- * * unresolved* -- show included files that are not found in project folder;
283+ * * unresolved* -- show included files that are not found within the project folder;
282284* * most_impact* -- show files that most impact on other files;
283285* * unincluded* -- show unincluded headers;
284286* * different_type* -- show headers that are included in #include <...> and #include "..." .
285287
288+ As arguments:
289+
286290```
287291cppinclude --report=unresolved
288292cppinclude --report=most_impact
289293cppinclude --report=unresolved,most_impact
290294```
291295
292- Also you can set in configuration file:
296+ As a configuration file setting :
293297
294298``` json
295299{
@@ -301,9 +305,10 @@ Also you can set in configuration file:
301305
302306#### unresolved
303307
304- Show files that are found in includes but didn't found in file system.
305- One of the resean is missing includes files, for example:
306- There is file * main.cpp* , folder * include* that store file * header.hpp* :
308+ Show headers that are included but not found in the given search paths.
309+ One possible reason is missing include files, for example:
310+ iven a * main.cpp* file and a * include* folder that stores
311+ the * header.hpp* header:
307312
308313```
309314tree
314319
315320```
316321
317- If run * cppinclude* result will be:
322+ When * cppinclude* is run, the result will be:
318323
319324```
320325cppinclude --report=unresolved
@@ -327,7 +332,8 @@ Unresolved files:
327332
328333```
329334
330- But if add folder * include* to * include_dirs* resultat will be empty:
335+ Adding the * include* folder to * include_dirs* will remove the
336+ unresolved files entry:
331337
332338```
333339cppinclude --report=unresolved --include_dirs=include
@@ -337,7 +343,7 @@ cppinclude --report=unresolved --include_dirs=include
337343
338344#### most_impact
339345
340- Show how many files will be recompiled with header will be changed.
346+ Show how many files will be recompiled when a given header is changed.
341347Example from [ docs/examples/simple_example/] ( docs/examples/simple_example/ )
342348
343349```
@@ -359,14 +365,17 @@ Included by:
359365...
360366```
361367
362- It means if file char_kind.hpp will be changed 11 files are recompiled.
368+ The above output means that a change in char_kind.hpp will force 11
369+ files to recompile.
363370
364371[ Back to top] ( #cppinclude )
365372
366373#### unincluded
367374
368- Show files that are found in file system but didn't found in includes.
369- It often happens after refactoring when file that include header was deleted.
375+ Show headers that are found in the search directories but that were not
376+ included in the source code.
377+ It often happens after refactoring when headers when include directives
378+ were removed from code and thefiles remained in place.
370379Example from [ docs/examples/simple_example_with_unincluded_headers/] ( docs/examples/simple_example_with_unincluded_headers/ )
371380
372381```
@@ -382,18 +391,19 @@ Unincluded headers:
382391
383392** Limitations:**
384393
385- * Header with same names:
394+ * Headers with same names:
386395
387- If headers have same name but are located in different folders will be found
388- only first header and other will be unincluded.
389- For example: * lib1/ header.hpp * , * lib2/header.hpp * and
390- * main.cpp* :
396+ If headers have the same name but are located in different paths only one
397+ occurrence will be counted.
398+ only first header and other will be unincluded.
399+ For example: * lib1/header.hpp * , * lib2/header.hpp * and * main.cpp* :
391400
392401``` c++
393402#include " header.hpp"
394403...
395404```
396- Result will be:
405+
406+ The result will be:
397407
398408```
399409cppinclude --include_dirs=lib1,lib2 --report=unincluded
@@ -406,23 +416,22 @@ Unincluded headers:
406416
407417```
408418
409- * Empty result for CMake project:
419+ * Empty result for CMake project:
410420
411- If analyze CMake project ( generated file compile_commands.json )
412- result will be empty. Because in current implementation * cppinclude * analyze
413- source files on file system or files from compile_commands.json
421+ The current implementation ignores CMake project files.
422+ Only source files are analyzed currently that are either specified
423+ in compile_commands.json or that are found on the filesystem.
414424
415425* Header files are files that have extension started with * h* letter
416426
417- *** All limitations will be fixed in future releases ** *
418-
427+ *** All limitations will be fixed in future releases***
419428
420429[ Back to top] ( #cppinclude )
421430
422431#### different_type
423432
424433Show headers that are included in different ways.
425- It helps to follow code style in project,
434+ It helps to follow code styles in project,
426435for example include third party libraries in <...> and project header in "...".
427436Example from [ docs/examples/simple_example_for_different_type_report/] ( docs/examples/simple_example_for_different_type_report/ )
428437
0 commit comments