The following commands are unique to RuleWizard:

ModifyAllows you to modify nodes through the Modify Node window. This window opens the selected node dictionary in tree form.
EditLets you use the editing commands; you can cut, copy, delete, or paste the selected node or element.
Edit Options

The following options for editing the node or element are available:

  • Cut: Cuts the selected node from the workspace area and places it on the clipboard.
  • Copy: Copies the selected node or element onto the clipboard
  • Delete: Deletes the selected node or element from the workspace.
  • Paste: Pastes the contents of the clipboard onto the workspace.
  • Paste As: This command allows you to paste the contents of the clipboard as a different form. For a copied or cut node this can be as a condition (Body, Context, and so on). For a copied or cut element, they can be pasted as another element (IsDecl, IsFinal, and so on).
Create Collector

Adds a collector, displayed as a pentagon, to the selected rule node. The collector allows you to place numerical stipulations on the outcome of a rule. Works with the Count command (available by right-clicking the collector). The collector keeps track of the number of times a pattern is found; Count places a condition on what number of instances constitutes a rule violation.

For more information on collectors, see Customizing Counts with Collectors, Counts, and Trigger Points.

Create MethodAdds a scripting component to the rule definition. This functionality allows for advanced flexibility in creating custom rules. For more information, see Using Scripts to Customize Rules.
Create Method Options

The following Create Method Options are available:

  • Boolean: Controls the behavior of the entire rule by returning a value of 1 (one) to indicate a violation, or by returning a value of 0 (zero) to indicate conformance to the verified rule.
  • Node: Generates an output message based on its arguments. The return value of the underlying method does not affect the logic of the rule.
Create Boolean MethodAdds a scripting component to the rule definition. This controls the behavior of the entire rule by returning a value of 1 (one) to indicate a violation, or by returning a value of 0 (zero) to indicate conformance to the verified rule.For more information, see Using Scripts to Customize Rules.
Create Output

Adds an output arrow to the selected rule node. The output arrow is the essential closing to any rule. An output arrow tells RuleWizard to report an error if the specified pattern is found; if no output arrow is included, no violations of this rule can be reported.

The placement of the arrow determines what line number is reported in the error message. For example, if you have a rule with nodes A, B, and C and you attach the output arrow to node C, the line number will reference the line where C occurs; if you attach the output to node A, the line number will reference the line where A occurs.

If you are adding an output arrow to a set component (a collector or set operator), you must choose between Hits Output and Trigger Output. If you are adding an output arrow to any other node, you must choose between Display and Method.

The following options are available:

  • Display: Determines the output message to be displayed when the rule is violated or the pattern is found.
  • Method: Adds a scripting component to the rule definition. This functionality allows for advanced flexibility in creating custom rules. For more information, see Using Scripts to Customize Rules.
  • Hits Output: Choose this output to indicate that one output message should be reported each time that the attached node is matched. The output message should reference the line number of the node to which the collector is attached. For more information on creating this type of output, see Determining the Output Type of a Set Component.
  • Trigger Output: Choose this output to indicate that one output message should be reported each time that the trigger point is matched (for example, if the trigger point references a file, one message will be reported for each file). The output message’s line number should reference the line number of the trigger point node. This type of output arrow is placed below the center of the set operator that it is attached to.

    When you choose this type of output, the violation output can contain properties of the collector, but not properties of nodes contained in the set operator. Currently, the only variable you can use here is “$count”.

    For example, if you have a collector that contains variables and you select a Hits Output, you can use an output message such as “Initialize all variables in constructor. Variable $name is not initialized.” (When this rule is actually violated, the $name variable will be replaced with the name of the uninitialized variable). This type of output can contain variables (such as “$tag”, or “$value”) for nodes contained in the set collector or operator. For example, if you have a collector that counts the number of <TD> or <TH> tags that occur in a certain context and you select a Hits Output, you can use an output message such as “<$tag> does not appear in the correct context.” (When this rule is actually violated, the $tag variable will be replaced with the name of the tag (TD or TH).

    For more information on creating this type of output, see Determining the Output Type of a Set Component.
Create AssertionAdds an assertion. An assertion specifies the numerical relationship between node collectors. Assertions use the set references MIN, MAX, AVERAGE, and MEDIAN. They are used on set components whose elements are number nodes to compare the values of the trigger counts between node sets (For example, MIN(A) < MAX(B)). For more information on assertions, see see Assertions.
Create Logic Component

Creates a logic component. The following options are available:

  • AND: Every branch must be true for the logic component to return a true condition.
  • OR: At least one branch must be true for the logic component to return a true condition.
  • NAND: The negation of AND. At least one branch must be false for the logic component to return a true condition.
  • NOR: The negation of OR. Every branch must be false for the logic component to return a true condition.
  • XOR: If applied to two branches, one branch or the other must be true —but not both —for the logic component to return a true condition. In general, for more than two branches, an odd number of branches must return true for the logic component to return a true condition.
  • XNOR: The negation of XOR. An even number of branches must be true for the logic component to return a true condition
Indirect/Direct Check

When an indirect check is performed, Parasoft static analysis searches for the specified condition in all nodes that have the specified relationship to the given node. When a direct check is performed, Parasoft static analysis searches for the specified condition only in the first node that has the specified relationship to the given node.

Examples:

Head-->Body: Indirect check will return all nodes in the body of the head. Direct check will only return the first node in the body of the head.

Head->Context: Indirect check will return all nodes which contain the head either directly or indirectly. Direct check will return only the node which is immediately “outside” the head.

Create Set Operator

Creates a set operator. Set operators are used to specify relationships between set components. The following options are available:

  • Union: The set of nodes that are in either the attached set component or the operand, including the nodes that are in both.
  • Intersection: The set of nodes that are in both the attached set component and the operand.
  • Difference: The set of nodes that are in the attached set component but not in the operand, or the set of nodes that are in the operand but not in the attached set component. Available options include:
    • Left minus Right: The set of nodes that are in the attached set component (to the left of the set operator), but which are not in the operand (as indicated in the circle attached to the right of the set operator).
    • Right minus Left: The set of nodes that are in the operand (as indicated in the circle attached to the right of the set operator), but which are not in the attached set component (to the left of the set operator).
  • XOR: The set of nodes that are either in the attached set component, the operand, but not in both.

For information on set components and set operators, see Working with Node Sets.

Add LabelLabels a set component so that it can be used as the operand of a set operator.
Change TypeChanges the type of set operator. For example, changes a Union set operator to an Intersection set operator.
  • No labels