CodeTools 3.1.14 for Visual Basic/Windows

1: Analysing source-code
2: Tidying source-code

Part 1: Analysing source code

The previous version of this program was called VBCodeCheck, and it survives as the analysis module in CodeTools.  When the program starts, click on the green ? icon to do an analysis of any visual-basic file.

Function tree view

The tree-view displays each function or subroutine it finds in the Visual Basic source-code, and lets you view some details of each function.  It will display the number of lines of code, the whitespace and comment ratios, and some details of the arguments supplied to each function.

tree_view.png

Function Graph

The function-graph view will give you, for each function in your file, a breakdown of which ones contain the right ratio of code to comments, and which ones have yet to be commented. 

graph_view.png

File Summary

The file-summary view displays only a very brief summary of the file in total.

Text report

Most of the information displayed in graph form can also be displayed as a text report.  There is a control to vary the level of detail in the report, and the text output is put into a textbox.  Cut-and-paste to your word processor for reports (but beware 32Kb size limit for text-boxes in windows98)

Part 2: Tidying source-code

Note: Before you use any of these functions, beware that they will modify your source-code, and you should make a complete backup before using any of these tools, in case results are not to your liking and you need to undo changes.  Initially, try operating the tools on a copy of your source-code, to see how the tools work before attempting to use them for real.

Tools available

The three tools available are:

wizard.png

Add function headers

When you add function headers, it lists the functions available, and asks which ones to put headers on. By default, it chooses the ones without any comments on the line above the function-declaration (i.e. don't add headers where they already exist)

check_functions.png
There are various screens to edit the type of function-headers, and it can even produce a custom-formatted listing of the arguments.  This area is reasonably flexible, to take account of the many different style-guides used by each company.

function_headers.png

Add error handling

CodeTools can add error-handling to each of your functions (or to those which don't already have it), which adds an "On error goto x" statement at the beginning of each function, and an error-handler at the end of each function.

Error-handlers are typically of the form "display message and quit" or "display message and resume", although there is an option to specify custom code to be placed in each error-handler.

The screenshot below shows some of the customisation available for error messages, should you choose to display them.  Even a blank "do nothing but exit the function" style of error-handler can keepyour program running through some errors, and make the program appear more stable.

error_options.png

Add commenting

CodeTools allows you to do various things with the commenting in a piece of code:  the only truly useful one is the "Format existing comments", which allows you to specify a style (e.g. putting a box around each comment) and apply it to all the comments in your file.

The "insert blank boxes" mode will create a neat blank box before each statement, allowing you to quickly add comments without having to worry about formatting.

The "intelligent formatting" mode is a highly experimental feature, and will prepend lots of rather useless comments to each line of uncommented code.  It can be interesting to see what it comes up with, but it's somewhat unreliable, and no substitute for real comments.

comment_options.png

Copyleft

Copyright 2003, Oliver White. This document released under your choice of the GNU Free Documentation license, or the Design Science License