Filtering Embedded String Errors via Line Patterns

The String Line Filters category provides a way to filter strings from the embedded strings errors reports based on patterns that are detected in the line of code that the string is found. Specifically, this category of filter rules tells Globalyzer that if an embedded string is detected in a line of code that contains one of the selected regular expressions, then ignore it; it doesn't need to be externalized so it shouldn't be listed as an error in the errors table or summary reports.

For example, suppose you have several strings defined that are used only in conditionally compiled debug code:

    String szName = "Name";  // Debug
    String szStart = "Start";// Debug
    String szEnd = "End";    // Debug
    String szTime = "Time";  // Debug

Since these are all common words, it would be difficult to eliminate them from the embedded string report using String Literal Filters. However, since each line of code also contains the comment Debug, we can add that shared pattern to the String Line Filters list. Now, when Globalyzer scans for string literals, it will find a matching pattern in the String Line Filters list for these four lines, and thus filter the four string literals from the embedded string report.

The following shows the default string line filters for VB.

To deselect a line filter, uncheck the box and click the Save button at the bottom of the page.

To edit an existing line filter, click on its Filter Pattern hyperlink. To add a customized line filter, click the Add New button at the bottom of the page. The result from either of these two operations is that the Add/Edit String Line Filter page displays.

The Add/Edit page that displays contains three fields that are used to describe a rule: Name, Pattern, and Description. In the case of an existing Line Filter, you'll only be able to modify the Name and Description fields. Use the Name field to give your pattern a brief, meaningful name. Use the Description field to (1) enter a more indepth explanation of the pattern, (2) understand the reason for its inclusion in the scan, and/or (3) describe a process to correct the problem.

Note: The Pattern field must contain a valid Regular Expression. For more information on Regular Expression syntax, click here.

Once you've added or modified a Line Filter, click the OK button. The String Line Filters List redisplays, showing your changes.

In this example, the new line filter appears in the list with its checkbox selected. Click the Save button for the changes to take effect, and then the Back to Summary link to return to the Configure I18N Rule Set page.