World Wide Navi Help
Analysis Rules
Source Code Analysis,
String Externalization, and
Declaration And Function Replacement are based the
on analysis rules editable by the rule tuning dialog in
[I18N] -> [Rules], or
[Rules Icon In Toolbar].
YouTube Demo
MP4 Demo
The rules are made up of the 5 categories described below, common in every source type
(programming language).
Categories
1 | Declaration | char* str;, Integer num = 0; |
2 | Function Call | printf("%s", msg);, GetString("key1"); |
3 | String Literal | "hello, how are you?", "yyyy/mm/dd", <td>Chapter1</td>, <input value="Submit"> |
4 | Character Comparison | if ( c > 'a') |
5 | Necessary Keyword | setlocale, ResourceBundle |
No. 1 to 4 get reported as Errors or Important Codes in
Error Detail View,
Error Summary View, and
Important Code View.
Errors are deprecated coding points for internationalization, and
need to be fixed.
No. 5 gets reported as Missing Keywords in
Missing Keyword View.
These are necessary but not appearing in the source codes, and
need to be inserted correctly.
For No. 3, String Literals, you can fix them
automatically by
String Externalization.
For No. 1 and 2, Declarations and Function Calls, you can fix (replace) them
automatically by
Declaration And Function Replacement.
Configure Skip
You can set skipping configurations for Source Code Analysis.
With these configurations, files with the specific names, Windows auto-generated codes, and other type codes
can be skipped in analysis.
Import
You can import the rules to the current one from the exported files.
This opearation can merge the rules without deleting the current ones.
Export
You can export the current rules to the external directory as xml and other files.
Exporting (backup the current rules) and Importing
(merge the backup rules with the new default ones)
get executed automatically when you install
the new wwnavi.
*Importing and exporting enable you to share the rules with other people.
Common Items
These are common items in all categories.
[Keyword]
Specify the deprecated/important/necessary
data type or function name ,
embedded/unrecommended string pattern expressions, and others.
String pattern expressions support
Java Regular Expression.
The labels in each edit dialog indicate the examples.
[Library]
Select the library (application type, framework name, etc.) from the
library selector.
Your own libraries can be set by the library selector, too.
This will be used for Libraries Of
Source Code Analysis.
('Common' is a basic library used automatically for every analysis.)
*Keyword and library are the key of rules, wwnavi searches for
the rules reading these 2 items, and these cannot be duplicated in each category.
[Level]
Set the level of the rule, low for basic, high for advanced.
This will be used for Level Of
Source Code Analysis.
[Description]
Select the description (messages for solutions) from the
message selector.
Your own messages can be set by the message selector, too.
This will be used for Result Views and
Result Reports.
[Alternatives]
Specify the alternatives for the error (recommended data type, function, .etc.)
separated by ",".
This will be used for Result Views and
Result Reports.
[Advisory Info]
Set the advisory info describing the detailed solution or references
for the error.
The URL or text file can be selected. If you select the text file, the chosen file
by the browsing button get copied to the working directory.
This will be used for Result Views and
Result Reports.
Category Items
These are items of each category.
Declarations
[Keyword]
Specify the data type name. (e.g. int, String)
See the Keyword.
[Library]
See the Library.
[Level]
See the Level.
[Description]
See the Description.
[Alternatives]
See the Alternatives.
[Advisory Info]
See the Advisory Info.
[Mark this type deprecated]
If checked, this declaration will appear in
Error Detail View and
Error Summary View.
[Mark this type important code]
If checked, this declaration will appear in
Important Code View.
[Pick up only arrays (and pointers)]
If checked, only arrays (e.g. char msg[256];} and pointers (e.g. char* msg;)
get detected as error.
This is a filter for eliminating single byte data from error (in most cases
not string data).
[Declarations in the following function parameters are not errors]
Specify the function names in each line.
This is a filter for eliminating system defined parameters from error.
[Declarations with the following specifier or modifiers are not errors]
Specify the specifier or modifiers (e.g. unsigned, const, static)
in each line.
This is a filter for eliminating system constant or binary data from error.
Function Calls
[Keyword]
Specify the function name. (e.g. printf, toString)
See the Keyword.
[Library]
See the Library.
[Level]
See the Level.
[Description]
See the Description.
[Alternatives]
See the Alternatives.
[Advisory Info]
See the Advisory Info.
[Mark this function deprecated]
If checked, this function call will appear in
Error Detail View and
Error Summary View.
[Mark this function important code]
If checked, this function call will appear in
Important Code View.
[Error Information of Parameters]
You can set the valid or invalid values in each parameter with
parameter numbers.
The values support
Java Regular Expression.
String Literals
[Keyword]
Specify the literal or regular expression. (e.g. Hello, [a-zA-Z])
See the Keyword.
In the case of String Literals,
"*(all data)" means all string literals, other ones mean
the literals matched with the specified regular expression.
[Library]
See the Library.
[Level]
See the Level.
[Description]
See the Description.
[Advisory Info]
See the Advisory Info.
[Externalize this string]
If checked, the matched strings with this rule will be externalized automatically
by String Externalization, otherwise,
just appears in error without being modified.
[Use the following rules as exceptional strings]
If selected, the strings matched with the registered rules get eliminated from errors.
You can set the exceptional strings with
Java Regular Expression
, function names, preprocessor names, variable names, specifier or modifiers, and tag attributes.
e.g.)
Symbolic or numeric strings such as "123" and "+/-" can be eliminated by
the regular expression '([\p{Digit}\p{Punct}])+'.
Logging strings such as 'error("System error occurred!")' can be eliminated by
the function name 'error'.
Defined strings such as '#define APP_NAME "World Wide Navi"' can be eliminated by
the preprocessor name 'define'.
SQL strings such as 'sqlStr = "select * from mytable"' can be eliminated by
the variable name 'sql'.
Constant strings such as 'const string = "KEY_NAME"' can be eliminated by
the modifier 'const'.
HTML style sheet strings such as '<SPAN style="color: red;"...' can be eliminated by
the attribute name 'style'.
[Use the following rules as specific strings]
If selected, only the strings matched with the registered rules get detected as errors.
You can set the specific strings with
Java Regular Expression
, function names, preprocessor names, variable names, specifier or modifiers, and tag attribute names.
e.g.)
Only alphabet strings such as "abc" and "XYZ" can be detected by
the regular expression '([a_zA_Z])+'.
Only warning strings such as 'warn("Duplicated data!")' can be detected by
the function name 'warn'.
Only included file strings such as '#include "wwnavi.h"' can be detected by
the preprocessor name 'include'.
Only command strings such as 'cmd = "copy /x "' can be detected by
the variable name 'cmd'.
Only static strings such as 'static string = "My Name"' can be detected by
the modifier 'static'.
Only HTML INPUT value strings such as '<INPUT value="Click Me"' can be detected by
the attribute name 'value'.
*Relation between regular expression and other parameters
(function name, preprocessor name, variable name, modifier, and attribute name) is
'AND'.
e.g.)
The rule of the regular expression '[a-c]+' AND
(the function name 'printf' OR the preprocessor name 'include' OR
the variable name 'foo' OR the modifier 'static' OR
the attribute name 'name')
matches '"abc"', 'printf("a")', '#include "b"', 'char* foo="c"', 'static char* str="ac"', '<input name="ab"',
doesn't match '"de"', 'printf("Bye")', '#include "my.h"', 'char* foo="foo"', 'static char* str="App"', '<input name="go"'.
In most of cases you specify other parameters than regular expressions,
you need set the regular expression '.*' (any literals).
*About exceptional/specific strings, please try to find more useful usages by your own.
[Validate this rule]
If unchecked, this rule will be ignored (not used) by analysis.
== Rule Priority ==
If a string literal matches seveal rules, the rule will be applied under
the following priorities.
1. The libraries listed higher have priority over lower ones.
(e.g. 'Common' > 'Std' > 'Win32' > 'MFC' > 'User1')
2. The regular expression keyword have priority over '*(all data)'.
(e.g. '[a-c]+' > '*(all data)')
3. The library priorities (1.) have priority over keyword priorities (2.).
(e.g. '*(all data)' of 'Common' > '[a-c]+' of 'Std')
Character Comparisons
[Keyword]
"*(all data)" only.
See the Keyword.
In the case of Character Comparisons,
"*(all data)" means all characters.
[Library]
See the Library.
[Level]
See the Level.
[Description]
See the Description.
[Advisory Info]
See the Advisory Info.
[Exceptional Characters]
The matched characters with this options will be eliminated from
error.
You can set the exceptional characters with
Java Regular Expression.
For details, refer to the exceptional character dialog.
[Validate this rule]
If unchecked, this rule will be ignored (not used) by analysis.
Necessary Keywords
[Keyword]
Secify the necessary function name, class name, values, .etc. (e.g. setlocale, Locale, DEFAULT)
See the Keyword.
[Library]
See the Library.
[Level]
See the Level.
[Description]
See the Description.
[Advisory Info]
See the Advisory Info.
[Mark this keyword necessary]
If checked, this keyword will appear in
Missing Keyword View.
[Location to be Found]
Specify the location (e.g. function name) where this keyword should be.
If the keyword gets found but in other location than this,
the keyword will be reported as missing keyword.
[This keyword must be present before the following keywords]
Specify the data type or function names in each line.
If this keyword affects other data type or functions, use this option.
Go to Index
Copyright (C) 2012 Kokusaika JP, Inc.
All rights reserved. No reproduction or republication without written permission.