Editing Code Cleanup

From BRL-CAD

Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision Your text
Line 84: Line 84:
  
 
[[Image:CodeCleanup.pdf|right|512px| ... best practices, particularly for collaborative code refactoring]]
 
[[Image:CodeCleanup.pdf|right|512px| ... best practices, particularly for collaborative code refactoring]]
 
 
=CPPCHECK-CLEANUP=
 
*Run the following:
 
**cd brlcad
 
**cppcheck -isrc/other/ include/ src/ --enable=all 2>cppcheck_brlcad.txt
 
*It checks for issues in 1690 files under all src/ except src/other and all include/
 
*By default,(i.e. without --enable=all ) , only error messages are shown.
 
*To get just Stylistic issues, change --enable=all to --enable=style
 
*To get just unused function issues, change --enable=all to --enable=unusedFunction
 
*If not checking for unusedFunction, it can also have multithreaded checking by option -j 4.
 
*The following issues will be stored in the file cppcheck_brlcad.txt. Note,many a times, cppcheck is wrong about reported errors. There are many bugs it doesn't catch.
 
* A small snippet of the output is like below -
 
[src/adrt/librender/spall.c:195]: (warning) scanf without field width limits can crash with huge input data
 
[src/adrt/master/master.c:488]: (style) Array index i is used before limits check
 
[src/anim/anim_hardtrack.c:185]: (warning) scanf without field width limits can crash with huge input data
 
[src [src/burst/Hm.c:347]: (style) The scope of the variable 'bit' can be reduced
 
[src/conv/asc/g2asc.c:655]: (error) fprintf format string has 3 parameters but only 1 are given
 
.
 
.
 
.
 
[src/util/ttcp.c:612]: (style) The scope of the variable 'cnt' can be reduced
 
[src/util/xyz-pl.c:59]: (warning) scanf without field width limits can crash with huge input data
 
(information) Cppcheck cannot find all the include files (use --check-config for details)
 

Please note that all contributions to BRL-CAD may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see BRL-CAD:Copyrights for details). Do not submit copyrighted work without permission!

To edit this page, please answer the question that appears below (more info):

Cancel Editing help (opens in new window)