|
|
Scanning Source CodeThis section describes how to scan source code with the Globalyzer Client and how to use the Scan Results table to filter and sort the potential internationalization issues detected by the scanner. This section discusses the following topics:
Create a Project and ScansBefore you scan code, the Globalyzer Client must be configured appropriately. Here is a checklist of tasks you need to do to prepare to scan code:
Starting a ScanTo scan the code in your source path, do one of the following:
As the Globalyzer Client scans your code, status messages are printed in the Status pane, at the bottom of the main window. When the scan finishes, the detected problems are displayed in the Scan Results table in the upper-right side of the Main window.
Stopping a ScanThe Scan dialog box displays while Globalyzer is scanning your source code. To abort the scanning process, click the Stop Scan button.
The Scan Results table will contain the potential i18n issues found before the scan was interrupted. Scan Results and ReportsA Globalyzer code scan can produce three different types of output.
When you complete a scan, the Scan Results table generated by the scan is automatically displayed in the Scan Results pane. An report is also automatically opened in the Quick Summary pane. Scan ResultsScan results are displayed in the Scan Results pane.
The Scan Results table itemizes each potential internationalization problem that was detected and reports the following information:
The Scan Results data is stored in the database you chose during the Globalyzer installation process. If you chose the default, it will be in your home directory (/Documents and Settings/[Login Name] on Windows). The default directory for the database files is called .globalyzer. The Scan Results table is used to filter, edit and fix issues. For detailed information on using the Scan Results table, see the following section Editing Scan Results. Quick SummaryIn addition to the Scan Results table, a summary of the currently-selected results is displayed in the Quick Summary pane (bottom left corner). This includes information about lines of code scanned, issues found, and in the case of Unsafe Methods, links to information that can be used to understand and address their i18n issues.
The following figure shows a portion of the Quick Summary. 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.
Generating ReportsTo generate a report of your scan results:
Click here for more information. Source FilesOpening Source FilesTo open a source file in the Source Files pane, do one of the following:
Saving and Closing FilesThe 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. Editing Scan ResultsIn addition to displaying all the issues found during a scan, the Scan Results table supports various editing features that can help you to categorize and narrow down the scope of the code-fixing effort.
The Results Table provides these basic editing functions:
Sorting Scan ResultsYou can sort the Scan Results table by any column. Just click in the header of a column to sort the data in ascending order. Click again to sort data in descending order. Set Status tip: Use the status settings to differentiate between different kinds of issues. For example, it might make sense to mark all string concatenations ToDo and then temporarily hide them (by unchecking the Status ToDo) while you deal with the regular strings. Searching Scan ResultsTo search for text in the current page of the Scan Results table, do one of the following:
The Find in Scan Results dialog box displays. For detailed information on this dialog, click here. Scan Result FiltersClick the Filter button to create filters for your Scan Results. Filters are useful when you have many results that you want to address in more manageable chunks. For example, in C++, you could create Filter for your Embedded String scan that just displays AfxMessageBox calls. The filter is applied to all results, not just the current page's results. Once you've created and saved a filter, select it from the Filters dropdown. Click here for information on the Filters Dialog box. Changing Status of Scan ResultsAfter scanning code, users typically wish to refine the results of the scan by removing rows from the Active Scan Results that do not contain valid issues. 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:
In either case, your goal is to produce Scan Results that accurately reflect the internationalization issues that need to be fixed. For instance, a refined or edited Scan Results table allows you or another user to move efficiently through the problems and fix them. You can change the status of a single row, multiple contiguous rows, or multiple non-contiguous 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 (or shift-click on the last row). To select multiple non-contiguous rows, click each row while holding down the Ctrl key. To change the status of the selected row(s) do one of the following:
To view Results with a Status other than Active or ToDo (the default), click on the Status button and check the statuses you want to display in the Scan Results table. Refining Rule SetsAs 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 Results Table as an issue.
You could go through the Scan Results 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 Active Scan Results. 1. Log On to 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, Filter or Retention 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, and Retention Rules allow you to override Filter Rules. The choices are:
For detailed information on modifying each of these types of rules, click here. Inserting Ignore CommentsUse Globalyzer's Ignore Comments feature to insert the following types of comments into your source code:
To insert a comment into a source file, either double-click on the Scan Results Issue or set the cursor in the source file at the position where you want the comment to appear, and do one of the following:
The comment will be inserted above the current source code line. You can change the default text associated with these comments
in the Project Properties dialog box. Click the Project Properties button
|