Configuring Rule SetsThis section explains about Rule Sets and describes the procedure for creating and editing Rule Sets. It discusses the following topics:
What Are Rule Sets?A Rule Set is of a set of parameters that the Globalyzer Client scanner uses to detect internationalization issues and generate Scan Results. A Rule Set is divided into five scanning categories: Source File Extensions, Embedded Strings, Locale-Sensitive Methods, General Patterns, and Static File References. Within each category, there are Detection or Retention Rules and Filtering Rules. Detection Rules specify internationalization issue conditions that the Globalyzer source code scanner will detect and report to you. All detection categories (except for Embedded Strings) are accessible to Globalyzer users for altering, adding to and deleting. Filtering Rules specify conditions that the scanner will overlook. For instance, by default, Globalyzer detects embedded strings. Embedded string detection is a fixed part of each Rule Set that you create (you cannot edit the embedded string rules). However, some strings embedded in your code are not intended for display to an end user and hence, should not be included in Globalyzer's reports listing strings that need to be externalized for translation. Retention Rules are for embedded strings only and specify conditions upon which strings should be retained. Applying Detection and Filtering RulesFor all Scans, except the Embedded String Scan, there is only one type of Detection Rule to find issues, and then many types of Filtering rules to apply to each detection. The final list of issues is everything that was detected that wasn't later filtered. In the case of Embedded Strings, Globalyzer first detects all the strings in the file, and then applies rules in the order shown below. We have ordered Filtering and Retention Rules so that specific filters and patterns are applied before more general filters and patterns. For example, a string might be a parameter to a method that is in a line that is part of a statement. So, if you defined a String Method Pattern to retain an issue, but you have a String Statement Filter that filters the statement, the issue will ultimately be filtered since the more general, String Statement Filter, is applied last. Order for most Rule Sets
Order for HTML Rule Set
Source File ExtensionsDetection: Source File ExtensionsThis category simply tells Globalyzer which source files to scan if you point it at an entire directory of source files. Filtering: File Extension FiltersFilters allow you to exclude files and directories from being scanned. For example, you may not want to scan files in test directories. Via a filter, you can tell Globalyzer to skip all files with the directory test in its path. Embedded String Scan RulesFiltering: String Content FiltersEmbedded strings that shouldn't be externalized may be programmatic elements or debug messages printed to the console. Globalyzer provides several ways to filter such strings from your scan results. The first way is to specify a pattern, which if Globalyzer detects within a string literal, will cause Globalyzer to ignore that string. This mechanism is called String Content Filters. Filtering: String Variable FiltersAnother mechanism for filtering strings is called String Variable Filters. Your code likely contains strings that are compared or assigned to variables that you know will never be displayed to an end user. For example, in XML there are attribute strings, such as column="status". If you configure column as a String Variable Filter, the string "status" will be filtered. Filtering: String Method FiltersThe second mechanism for filtering strings is called String Method Filters.
Your code likely contains many method or functions
that are passed string arguments. When you are sure that any string passed
into function For example, the Java method: javax.servlet.http.HTTPServletRequest.getParameter(String s) takes a string argument, but this string would never appear as text visible to an end user. Therefore, if you add this method (method name only) to the list of String Method Filter rules, Globalyzer will ignore any string literal passed in. Filtering: String Line FiltersAnother mechanism for filtering embedded strings is called String Line Filters. In the case where there are strings that will never be displayed to the user and reside in lines of code that share a specific string pattern, you can add that pattern to the String Line Filter rules. Whenever Globalyzer detects string literals in a line of code that also contains one of the patterns in this list, it will ignore those strings. For example, suppose you have several strings defined that are used only in conditionally compiled debug code: String szName = "Name"; // Debug Since these are all common words, it would be difficult to eliminate them from
the embedded string report using String Content Filters. However, since each
line of code also contains the comment Filtering: String Statement FiltersFor languages that support the notion of statements (Java, JavaScript, C#, etc), another mechanism for filtering embedded strings is called String Statement Filters. If Globalyzer detects a string literal within the same statement as a defined pattern, that string will be excluded from the Embedded String Scan Results. For example, set up a String Statement filter for the pattern var idioms = ["haste makes waste", The string statement filter will find Filtering: Ignored HTML TagsFor HTML projects only, users will see the Ignored HTML Tags category. This category requires special explanation and has a section dedicated to it. Please read this section if you intend to customize. Retention: Included HTML TagsFor HTML projects only, users will see the Included HTML Tags category. This category requires special explanation and has a section dedicated to it. Please read this section if you intend to customize. Retention: String Content PatternsString Content Patterns helps you add conditions under which strings that would normally be filtered, stay in the Scan Results. It is basically an override of the different string filters. For example, normally strings where the first word starts with a special character such as @ are filtered out, but your product name is @Large, so naturally you want strings beginning with @Large to still be caught. Retention: String Variable PatternsString Variable Patterns ensure that strings compared or assigned to configured variables stay in the Scan Results, even if they would normally be filtered. For example, normally strings where the first word starts with a special character such as @ are filtered out. However, if this special character string is assigned to a variable named DisplayStringToUser, then the string should still be caught. Retention: String Method PatternsString Method Patterns ensure that strings passed to configured methods stay in the Scan Results, even if they would normally be filtered. For example, normally strings where the first word starts with a special character such as @ are filtered out. However, if this special character string is passed to the method MessageBox(), then it most likely will be displayed to the end user and should still be caught. Retention: String Concatenation PatternsFor HTML projects only, users will see the String Concatenation Patterns category. Globalyzer detects concatenations in HTML strings. If a string would normally be filtered (for example, the string is a series of externalized text, or maybe the string contains text and server-side code, but the text is not in the Dictionary), String Concatenation Patterns will be applied and potentially make the string Active with priority C. This enables finding concatenations in HTML strings that have already been externalized in parts, rather than as a whole. Locale-Sensitive Method Scan RulesDetection: Locale-Sensitive MethodsThe Locale-Sensitive Methods category includes
rules used to detect method calls, functions, and constructors in your
source that are potentially locale-sensitive within certain locales and for certain
character encodings. The methods are organized into groups. The Globalyzer user can create
new groups and/or add new methods to groups. This category is programming language dependent and so is
not available for all programming languages. An example of such a rule is
Java's Note: When Globalyzer scans code for locale-sensitive methods, the All Predicted Scan Summary generated by Globalyzer includes links for all detected locale-sensitive methods. The link takes you to information about how to refactor or replace the detected method to make your code function properly across all locales and character encodings. Filtering: Method Line FiltersMethod Line Filters are similar to String Line Filters, but apply to the Locale-Sensitive Methods detection category. Whenever Globalyzer detects a locale-sensitive method in a line of code that also contains one of the patterns in this list, it will ignore the method. General Pattern Scan RulesDetection: General PatternsUsers can alter, add to and delete from the General Patterns category, which can include any regular expression that the user wants the scanner to look for during the scan. This might include patterns used to enforce coding standards or anything at all -- not necessarily internationalization-related patterns. Filtering: General Pattern Line FiltersGeneral Pattern Line Filters are the line filters for the General Patterns scanning category. Whenever Globalyzer detects a general pattern in a line of code that also contains one of the patterns in this list, it will ignore the general pattern detection. Static File Reference Scan RulesDetection: Static File ReferencesThis category is used to detect image and other static file paths in source code. During the internationalization process, these static files need to be localized and placed in locale-specific directories. All paths to those localized files in the source code must then be altered to retrieve and load the localized file at run time from the locale-specific directory corresponding to the user's locale. Filtering: Static File FiltersStatic File Filters apply to the Static File References detection category. Globalyzer will ignore the static file if it contains one of the patterns in this list. Filtering: Static File Line FiltersAnother mechanism for filtering static file references is with the Static File Line Filters. In this case, Globalyzer will ignore the static file if it is in a line of code that also contains one of the patterns in this list. Logging into the ServerRule Sets are typically configured on the Globalyzer Server, using a browser. The first step is to log into your account on the server. Click here for detailed login instructions. Creating New Rule SetsRule Sets can be created as base Rule Sets or inherited Rule Sets.
Base Rule Sets are created with a set of default rules defined on the server.
Inherited Rule Sets extend an existing Rule Set; they inherit all the rules of the parent Rule Set
and can add new rules and/or override inherited rules. When rules are added, modified, or deleted in the
parent Rule Set, those changes are inherited.
Creating a base Rule SetTo create a Base Rule Set:
c# c++ - ANSI UTF-8 c++ - ANSI UTF-16 c++ - Cross Platform UTF-8 c++ - Cross Platform UTF-8 c++ - Qt c++ - Windows Generic c++ - Windows MBCS c++ - Windows Unicode delphi html java javaScript objectivec perl php sql - MS SQL sql - MYSQL sql - Oracle PL/SQL sql - PostgreSQL swift2 vb - Classic VB vb - VB.NET vbscript xml xml - MXML The variant determines the default set of Locale-Sensitive Methods for the Rule Set. Click here for more information on Rule Set languages and variants. This page allows you to edit the default settings for the five scanning categories. Click on a link below for detailed information about configuring each type of rule. Source File ExtensionsSource File Extensions File Extension Filters Embedded String Scan RulesString Content Filters String Method Filters String Variable Filters String Line Filters String Statement Filters Ignored HTML Tags String Content Patterns String Method Patterns String Variable Patterns Included HTML Tags String Concatenation Patterns Locale-Sensitive Method Scan RulesLocale-Sensitive (Unsafe) Methods Method Line Filters General Pattern Scan RulesGeneral Patterns General Pattern Line Filters Static File Reference Scan RulesStatic File References Static File Filters Static File Line Filters
Creating an inherited Rule SetTo create an inherited Rule Set:
The Customize Rule Set page allows you to edit the default settings for the five scanning categories, as described above. Editing Rule SetsTo edit an existing Rule Set:
For example, above is a Javascript rule set with multiple categories based on popular JS frameworks. All rules labeled by specific categories in this rule set can be bulk enabled/disabled with this feature below. This allows a user to enable certain rules if they are using a specific framework, or just want to group certain rules by category for unique projects. Enabling/Disabling Rule Set CategoriesTo enable or disable rules of a Rule Set based on category:
NOTE: These categories relate to the category column within a rule set group as seen below: Copying Rule SetsTo copy an existing Rule Set:
Deleting Rule SetsTo delete an existing Rule Set:
|