Scanning Source Code
This section describes how to scan source code with Globalyzer and how
to use the Errors Table to filter and sort the errors detected by the
scanner. This section discusses the following topics:
Configuring the Scanner
Before you scan code, the scanner must be configured appropriately. Here
is a checklist of tasks you need to do to prepare to scan code:
- Configure the Rule Set for your project. Click here
for information on managing Rule Sets.
- Configure the scanning properties for your project. If you haven't done so yet,
you'll want to create a Project file to hold your configuration settings. Click
here
for detailed information on how to create a new Project file. If you already have
created a Project file for your scan, click
here for instructions on
loading an existing Project file. Once Globalyzer is using the desired Project file,
you'll want to check and modify the settings in the Scanning Tab in the Project
Properties dialog box. Click
here
for detailed information on this dialog. Note that all changes made to the Project
Properties will be stored in the current Project file.
Starting a Scan
To scan the code in your source path for internationalization errors,
do one of the following:
Click the Scan button
in the Button Bar.
From the main menu, select Scan=>Scan Code
Press F9.
As the scanner scans your code, status messages are printed in the Status
Area, at the bottom of the main window.
When the scan finishes, the detailed error report is displayed in the
Errors Table in the upper-right side of the Main window. An HTML Report
is also created, and you can view it by clicking the Reports Tab
next to the Errors Tab.

Stopping a Scan
The Scan dialog box displays while Globalyzer is scanning your source code.
To abort the scanning process, click the Stop Scan button.

The detailed error report will contain the errors found before the
scan was interrupted, but the summary reports will be empty,
since the contents of these files depend on a completed
scan. To shorten the length of time for a scan to complete, try limiting
the number of source files selected in the
Project Properties Paths
panel or checking fewer scan types in the
Project Properties Types
panel.
Opening and Viewing Reports
A Globalyzer code scan can produce three different types of output.
- An Errors Table, which is saved to disk with the .gid extension.
Within Globalyzer, this table is a sortable, selectable table and is
used to view and fix specific errors detected in the code.
- An HTML summary report. This file reports the number of each type
of error detected in the source code. Each type of unsafe method detected
in the source is hyperlinked to information that helps you determine
how best to replace or refactor it.
- A text summary report. This file contains the same information as
the html summary report, but in a plain text format.
When you complete a scan, the Errors Table generated by the scan is automatically
displayed in the Errors Tab. An HTML Report is also automatically opened
in the Reports tab. To see either, just click the appropriate tab or or
use the View Menu.
If you wish to open another report that you have saved on your system,
click on the panel of the report you wish to open, and do one of the following:
If a file is already open, click on it to select it and use the File=>Open
function.
Right-click on the File Tab of an already open report, and select the
Open function.
In the Project Pane, navigate to the file you wish to open and double-click
it, or right-click on it and select Open.
Errors Table
The Errors Table is displayed under the Errors tab.

The Errors Table itemizes each internationalization error that was detected
and reports the following information:
- the source file in which the error was found
- the line number of the error
- the type of error
- the actual error
- the complete line in which the error was found
The Errors Table data is stored in a file located in the results directory,
which is specified using the Project
Properties dialog box under the Paths tab. The file is given, by default,
a .gid extension.
You can change the name of the Errors Table data file in the Project
Properties dialog box by entering a name in the Types tab.
The Errors Table is primarily used to filter and edit the errors and
assist in locating and fixing them. For detailed information on using
the Errors Table, see the following section Editing
the Errors Table.
HTML Summary Report
In addition to the Errors Table, a summary of the scan results is formatted
in HTML and displayed under the Reports tab (next to the Errors tab).
As with the Errors Table data, the actual HTML Summary file is stored
in the results directory, which is specified using the Project
Properties dialog box. The file is given, by default, a .htm extension.

The following figure shows a portion of the HTML Summary Report. Note
that the Unsafe Methods that were detected are listed and that they are
hypertext links. Click these links to learn more about the unsafe methods
and techniques for re-coding or replacing them.

You can change the name of the HTML Summary data file in the Project
Properties dialog box by entering a name in the Types tab.
Text Summary Report
The Text Summary Report is a plain text file that contains the same basic
information as the HTML Summary file. The Text Summary Report file is
stored in the results directory, which is specified using the Project
Properties dialog box. The file is given, by default, a .txt extension.
Opening Source Files
To open a source file in the Source Editor, do one of the following:
In the Errors Table, double-click on a row to open the source file
associated with the error.
In the Errors Table, single click a row to select it, and then right-click
and select Open Source File from the menu. Alternatively, you
can select File=>Open Source File from the Main Menu.
If a file is already open, click in it to select it and use the File=>Open
function on the Main menu to open a different source file.
Right-click on the file tab of an already open source file, and select
the Open function.
In the Project Pane, navigate to the file you wish to open and double-click
it, or right-click on it and select Open.
Other File Operations
In addition to opening files, Globalyzer provides functions for saving,
closing, and deleting files.
Saving and Closing Files
The procedure for saving and closing files is similar to opening them.
Most of the menus described in the previous Opening Files sections also
contain functions for Save, Save All, Close, and Close All. For information
on these functions, click here.
Deleting Files
You can delete files from within Globalyzer. First, select the file you
wish to delete, and then select File=>Delete from the Main menu.
Alternatively, you can pick the file in the Project Pane, right-click
and select Delete.
Warning: Deleted files are permanently removed from your filesystem
as well as from the Globalyzer project.
Editing the Errors Table
In addition to displaying all the errors found during a scan, the Errors
Table provides functions for sorting, searching, and editing the report.
The process of editing the Errors Table is important, because it can help
you to narrow down the scope of the code-fixing effort. In addition, the
editing process can help you to refine your Rule Set to prepare for another
scanning pass.

The Errors Table provides these basic editing functions:
- Sorting
- Searching
- Removing Rows
Sorting the Errors Table
You can sort the Errors Table by columns. Just click in the header of
the column you wish to sort on. When you click the header of a column,
the entire table is sorted according to the entries in that column. The
arrow icon in the header points up if the column is sorted in ascending
order, and down if descending order.
Tip: Grouping Error Types -- The sorting feature is especially
useful when you wish to group together all Error Types of one kind. By
grouping Error Types, it is easy to get a quick feel for the scope of
the error type and the causes of the errors. Furthermore, when you edit
the table or fix the errors, it is handy to have them grouped together
by type.
Searching the Errors Table
To search for text in the Errors Table:
1. Click in the column you wish to search to select it.
2. Do one of the following:
Right-click over the table and select Search=>Find from the
menu.
Press Ctrl-F.
Select Search=>Find from the Main menu.
3. Use the Find in Errors Table dialog box. For detailed information
on this dialog, click here.
Tip: Use Find All To Group Rows -- Use the Find All feature
in the Find in Errors Table dialog box to group the rows with the found
text together. All rows with found text are automatically selected and
grouped together at the top of the table.
Removing Rows
After scanning code, users typically wish to refine the results of the
scan by removing rows from the Errors Table that do not contain valid
errors. For instance, you may notice that the scan detected embedded strings
that do not represent display text (end-users will never see them). In
this case, you have two choices:
- refine the Rule Set and re-perform the scan, or
- remove the rows from the Errors Table.
In either case, your goal is to produce an Errors Table that accurately
reflects the internationalization errors that need to be fixed. For instance,
a refined or edited Errors Table allows you or another user to move efficiently
through the errors and fix them.
You can remove a single row, multiple contiguous rows, or multiple noncontiguous
rows.
To select a single row, click in it. To select multiple contiguous rows,
click on the first row then press the left mouse button and drag. To select
multiple noncontiguous rows, click each row while holding down the Ctrl
key.
To remove the selected row(s) do one of the following:
Right-click and pick Remove Selected Rows from the menu.
Press Ctrl-Alt-X.
To undo a remove operation in the Error table, do one of the following:
Right-click and pick Undo Remove Rows from the menu.
Press Ctrl-Z.
Note: You can only undo the previous remove operation.
Saving the Edited Report
After you remove row(s), you must save the Errors Table for the changes
to be permanent.
To save the report using the same filename, do one of the following:
Right-click on the file tab for the Error Report you wish to save and
select Save.
Select File=>Save from the Main menu.
Press Ctrl-S.
To save the report to a different file, do one of the following:
Right-click on the file tab for the Error Report you wish to save and
select Save As.
Select File=>Save As from the Main menu.
Press Ctrl-Alt-S.
Use the Save As dialog box to specify the location and name of the new
file.
Refining Scan Rules
As mentioned previously, after scanning your code, you might wish to
return to your Rule Set and edit it to refine the results of a subsequent
scan. It is possible that you will do this iteration more than once.
Say, for example, your code contains numerous calls to a proprietary
method called getSystemInfo. This method takes a string argument
that is simply the key to retrieve some information needed by your application.
This string is never displayed in your application's GUI, but it keeps
showing up in the Globalyzer errors table as an error.
You could go through the errors table and delete each row containing
said key, but this won't help you the next time you scan the code. The
best way to solve the problem is to go into the rule set you used to scan
the code and add a new String Method Filter: getUserInfo. When
you rescan the code, Globalyzer will make sure that each string it detects
is not an argument to getUserInfo before it is added to the errors
table.
1. Log On to the Server
Rule Sets must be edited on the Globalyzer server, using a browser. The
first step is to log in to your account on the server.
2. From your home page, click View My Rule Sets.
3. In the All My Rule Sets page, click the Edit button
next to the Rule Set you wish to edit.
4. Click on the Detection or Filter rule you wish to edit. Remember
that Detection Rules specify patterns the scanner will find and report.
Filter Rules specify patterns the scanner will ignore. The choices are:
- Source File Extensions
- Locale Sensitive Methods
- Image References
- General Patterns
- String Literal Filters
- String Method Filters
- String Line Filters
For detailed information on modifying each of these types of rules, click
here.
User's Guide Contents
|