| # Source Analyze Codes Source analyze codes are used to perform user-defined checks on scripts such as UI scripts, DLLs and DALs. Each source analyze code is linked to an expression text and to a warning message. The expression text contains a search pattern, which is used to find errors. If an error is found, VSC generates a warning. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message that is linked to the source analyze code. Some source analyze codes are linked to a DLL. This DLL is used to perform more complex search actions. Each source analyze code: has a message ID and a rule ID. belongs to a category, for example: Tools Consistency, Application Design, or Performance. has a priority: High, Normal, Suspicious, or Low. You can maintain source analyze codes in the Source Analyze Codes (tlvsc3511m000) session. For more information, refer to the session help. To make sure that the checks defined in a source analyze code's expression are executed, you must link the source analyze code to one or more verification filters. For more information, refer to To configure VSC. Expressions The search pattern in an expression text consists of start expressions, end expressions and search expressions. Points of attention: Expressions are regular. An expression can consist of several expressions. The start expression can only be a single expression. If you use more expressions in an end expression, the separate expressions must be separated by a pipe sign (|). If you use more expressions in a search expression, the separate expressions must be separated by a pipe sign (|) or an ampersand sign (&). You cannot use both signs in one search expression. If you enter two expressions that are separated by a pipe sign (|), LN must find either one of the expressions, not both. If you enter two expressions that are separated by an ampersand sign (&), LN must find both expressions. Search mechanism To execute the checks that are defined for a source analyze code, VSC does the following: VSC starts searching for a piece of source code that matches the start expression. If VSC finds a matching piece of code, VSC searches for a piece of source code that complies with the end expression. The positions where VSC finds the start and end expressions respectively, will be the start and end position for the actual search. The search expression searches between the start position and the end position. The result is true or false (found or not found). If the error is found, a VSC warning is generated with the category and the priority that are assigned to the source analyze code. Examples Example- Source Analyze Code without DLL VSC executes the following source analyze code.
Source Analyze Code | app_start
Warning Message | Function 'app_start' is not supported by Web UI
Expression Text |
    maxlen		:sourcelinelen
    pattern	:[ =<>,(){]app_start[ ]*[(]
The expression searches for lines that contain the "app_start" function. For each search result, VSC generates a warning. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message ("Function 'app_start' is not supported by Web UI "). Example- Source Analyze Code with DLL VSC executes the following source analyze code.
Source Analyze Code | message_args
Warning Message | Text in function message()
DLL | otlvscdll4009
Expression Text |
    maxlen			:512
    start			:[ ,:(]message[ ]*[(]
    end			:~[)]
    pattern_log		:end_start-start_end
The expression searches for lines that contain the "message" function. Subsequently, the "otlvscdll4009" DLL checks the message arguments. VSC generates a warning if a message call contains plain text, instead of a message code. The warning contains, among other things, the name of the script and the line number where the error is found, and the text of the warning message ("Text in function message()"). |