Criterion References
Text Criterion
name_is
Syntax: name_is "pattern", matching strategy, case-sensitivity
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark: This criterion will evaluate to True if name of the candidate code element matched the given pattern. For more details about matching strategy and case-sensitivity modifier, see the documentation of text criterion.
text_is
Syntax: text_is "pattern", matching strategy, case-sensitivity
Applicable on: Class, Generic, Feature, Assertion, Argument, Local, Line
Remark: This criterion will evaluate to True if text of a candidate code element matches the given pattern.
top_indexing_contain
Syntax: top_indexing_contain "pattern", matching strategy, case-sensitivity
Applicable on: Class
Remark: This criterion will evaluate to True if text (indexing tags are not included) of the top indexing clause in the candidate class matches the given pattern.
top_indexing_has_tag
Syntax: top_indexing_has_tag "pattern", matching strategy, case-sensitivity
Applicable on: Class
Remark: This criterion will evaluate to True if tags of the top indexing clause in the candidate class matches the given pattern.
bottom_indexing_contain
Syntax: bottom_indexing_contain "pattern", matching strategy, case-sensitivity
Applicable on: Class
Remark:This criterion will evaluate to True if text (indexing tags are not included) of the bottom indexing clause in the candidate class matches the given pattern.
bottom_indexing_has_tag
Syntax: bottom_indexing_has_tag "pattern", matching strategy, case-sensitivity
Applicable on: Class
Remark:This criterion will evaluate to True if tags of the bottom indexing clause in the candidate class matches the given pattern.
indexing_contain
Syntax: indexing_contain "pattern", matching strategy, case-sensitivity
Applicable on:Class
Remark:This criterion will evaluate to True if (top or bottom) indexing clause matches the given pattern.
indexing_has_tag
Syntax: indexing_has_tag "pattern", matching strategy, case-sensitivity
Applicable on: Class
Remark: This criterion will evaluate to True if tag of (top or bottom) indexing clause of the candidate class matches the given pattern.
Path Criterion
path_in
Syntax: path_in "path"
Applicable on: Class
Remark: This criterion will evaluate to True if path (related to the class's written in group) of the class candidate is "path" or its subdirectory. "path" is in Unix format, i.e., different sections are separated by a "/". On Windows, path matching is case-insensitive, on other platforms, it's case-sensitive.
path_is
Syntax: path_is "path"
Applicable on: Class
Remark: This criterion will evaluate to True if path (related to the class's written in group) of the class candidate is "path". "path" is in Unix format, i.e., different sections are separated by a "/". On Windows, path matching is case-insensitive, on other platforms, it's case-sensitive.
Relation Criterion
ancestor_is
Syntax: ancestor_is {domain}
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if candidate class (or feature) is descendant of any (if more than one are possible) of the class (or feature) specified in the criterion domain.
For example, in a class metric,
will evaluate to True when a candidate class is a descendant of class
In a class metric, will evaluate to True when a candidate class is a descendant of either
proper_ancestor_is
Syntax: proper_ancestor_is {domain}
Applicable on: Class
Remark: This criterion will evaluate to True if a candidate class is a proper descendant of any of the classes in criterion domain. First, let's use the following figure to demonstrate the concepts of ancestor, proper ancestor, parent and indirect parent. (Note: the hierarchy is not complete)
Ancestors of
Proper ancestors of
Parents of
Indirect parents of
The related concepts of descendants, proper descendants, heirs, indirect heirs follow the same rule but are in the reversed direction.
descendant_is
Syntax: descendant_is {domain}
Applicable on: Class, Feature
Remark: This criterion evaluates to True if candidate class is or feature is ancestor of any (if more than one are possible) of the class or feature specified in the criterion domain.
proper_descendant_is
Syntax: proper_descendant_is {domain}
Applicable on: Class
Remark: This criterion evaluates to True if a candidate class is a proper ancestor of any of the classes in criterion domain.
parent_is
Syntax: parent_is {domain}
Applicable on: Class
Remark: This criterion evaluates to True if a candidate class is a heir of any of the classes in criterion domain.
indirect_parent_is
Syntax: indirect_parent_is {domain}
Applicable on: Class
Remark: This criterion evaluates to True if a candidate class is a indirect heir of any of the classes in criterion domain.
heir_is
Syntax: heir_is {domain}
Applicable on: Class
Remark: This criterion evaluates to True if a candidate class is a parent of any of the classes in criterion domain.
indirect_heir_is
Syntax: indirect_heir_is {domain}
Applicable on: Class
Remark: This criterion evaluates to True if a candidate class is a indirect parent of any of the classes in criterion domain.
client_is
Syntax: client_is {domain}, directness, normally_referenced, syntactically_referenced
Applicable on: Class
Remarks: This criterion evaluates to True if a candidate class is supplier of any of the classes in criterion domain. Directness modifier is boolean modifier, if it's True only direct suppliers are picked, if indirect modifier is set, only indirect suppliers are picked. normally_referenced and syntactically_referenced modifiers are both boolean modifiers, they enable to specify how one class is used by another class. Let's use an example to demonstrate these ideas, for example, in class A, there is a feature foo:
foo
local
l_str: STRING
l_file: FILE
do
create l_str.make_empty
end
Then both
supplier_is
Syntax: supplier_is {domain}, directness, normally_referenced, syntactically_referenced
Applicable on: Class
Remark:
This criterion evaluates to True if a candidate class is client of any of the classes in criterion domain.
For more information of directness modifier, normally_referenced modifier and syntactically_referenced modifier, see document for relation criterion client_is
callee_is
Syntax: callee_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature is calling any of the feature listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
caller_is
Syntax: caller_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature is called by any of the feature listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
assignee_is
Syntax: assignee_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature assigns to any of the feature listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
assigner_is
Syntax: assigner_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature assigns to any of the feature listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
createe_is
Syntax: createe_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature creates any of the feature (must be an attribute) listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
creator_is
Syntax: creator_is {domain}, only_current_version
Applicable on: Feature
Remark:
This criterion evaluates to True if a candidate feature (must be an attribute) is created by any of the feature listed in criterion domain.
only_current_verision modifier is a boolean modifier, if it's True, when the criterion is evaluated, only the candidate feature is taken into consideration, otherwise, the candidate feature and all its descendant versions are taken into consideration.
is_exported_to
Syntax: is_exported_to {domain}
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate class is exported to all the classes listed in criterion domain.
is_implementors_of
Syntax: is_implementors_of {domain}
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is an implementer of some features listed in criterion domain.
return_type_is
Syntax: return_type_is {domain}
Applicable on: Feature
Remark: This criterion will evaluate to True if associated class of the return type of the candidate feature is listed in criterion domain.
Value Criterion
value_of_metric_is
Syntax: value_of_metric_is Metric, {domain}, value_tester
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark:The Metric modifier will be a specified metric name. This criterion will evaluate to True if the calculated metric (from metric modifier) over input domain (from criterion domain) satisfies some given value tester (from value_tester modifier).
For example, if we want to find classes whose code is over 1000 lines, we can create the following metric and run it over input domain {Application target}:
In the above dialog, you can customize the value_of_metric_is criterion. A metric needs to be specified as well as its input domain. Sometimes, "Delayed item" is set in the input domain meaning that no matter what the current candidate code element is, use it as input domain to the selected metric and calculate that metric to see if it's value satisfies the given value testers which are also set in this dialog.
You can specify more than one value tester and they can be anded (when "Match all" is selected) or ored (when "Match any" is selected). if no value tester is set, the value_of_metric_is criterion always evaluates to True.
This metric reads, for every class from application target, calculate metric Lines of code over that class (this is the usage of "Delayed item"), and if the value of Lines of code over that class is larger than 1000, that class satisfies the value_of_metric_is criterion thus it's included in the result.
Let's see another example of value_of_metric_is criterion which is more complicated and involves the use of the "Use external delayed domain" option.
Suppose we are to construct a metric called Unused features which can finds unused features. First, it must be a feature metric because we want features in the result. Second, for every feature candidate, we want a predicate which evaluates to True if that candidate feature is not called by any feature.
And this predicate is semantically equal to say: count all callers of the candidate feature and check if the value is zero. So now, we realize that we need a metric which returns the number of callers of a given feature.
We can construct this feature metric as follows:
Let's call it "callee_is" (note: here callee_is is a metric name instead of a criterion name). It uses "Delayed item" because we want that "Delayed item" to be replaced by the actual candidate feature at run-time.
Then we can construct our Unused features metric as follows:
In this dialog, note that the "Use external delayed domain" option is checked. It has to be checked. Let's see why.
This value_of_metric_is criterion should check this: for every candidate feature, test if the number of callers of that feature in current application target scope is zero.
Suppose now a feature named foo is the candidate feature.
If the "Use external delayed domain" is not checked, then the metric callee_is is calculated over input domain {application target}.
So when calculate callee_is metric, every feature (let's call the current candidate feature
As you can see, if "Use external delayed domain" option is not checked, during the period of value_of_metric_is criterion evaluation, the current feature candidate from the Unused features metrics is never involved. This of course yields wrong result.
Now we select the "Use external delayed domain" option. Recall that current candidate feature of metric Unused features is
When the value_of_metric_is criterion is evaluated, the delayed item from metric callee_is is replaced by
which reads: calculate the number of callers of feature
As we can see, when the option "Use external delayed domain" is selected, the delayed item from the criterion metric will be replaced by the current candidate code element. Otherwise, it will be replaced by the candidate element from criterion metric input domain when criterion metric is calculated.
Normal Criterion
false
Syntax: false
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark: This criterion will always evaluate to False.
has_argument
Syntax: has_argument
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has arguments.
has_assertion
Syntax: has_assertion
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has any precondition or postcondition.
has_assigner
Syntax: has_assigner
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature (must be an attribute then) has assigner.
has_bottom_indexing
Syntax: has_bottom_indexing
Applicable on: Class
Remark: This criterion will evaluate to True if candidate class has bottom indexing.
has_comment
Syntax: has_comment
Applicable on: Feature
Remark: This criterion will evaluate to True if candidate feature has header comment.
has_constraint
Syntax: has_constraint
Applicable on: Generic
Remark: This criterion will evaluate to True if the candidate generic has constraint.
has_creation_constraint
Syntax: has_creation_constraint
Applicable on: Generic
Remark: This criterion will evaluate to True if the candidate generic has creation constraint
has_expression
Syntax: has_expression
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion has associated expression.
has_indexing
Syntax: has_indexing
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate class or feature has indexing clause.
has_immediate_invariant
Syntax: has_immediate_invariant
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class has immediate invariant clause (not inherited invariant clause).
has_local
Syntax: has_local
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has locals defined in it.
has_postcondition
Syntax: has_postcondition
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has immediate postconditions.
has_precondition
Syntax: has_precondition
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has immediate preconditions.
has_rescue
Syntax: has_rescue
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature has rescue clause.
has_tag
Syntax: has_tag
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate has a descriptive tag associated with it.
has_top_indexing
Syntax: has_top_indexing
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class has top indexing clause.
is_always_compiled
Syntax: is_always_compiled
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is an always compiled class. Some basic class such as
is_assembly
Syntax: is_assembly
Applicable on: Group
Remark: This criterion will evaluate to True if the candidate group is an assembly.
is_attribute
Syntax: is_attribute
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is an attribute.
is_blank
Syntax: is_blank
Applicable on: Line
Remark: This criterion will evaluate to True if the candidate line is blank.
is_cluster
Syntax: is_cluster
Applicable on: Group
Remark: This criterion will evaluate to True if the candidate group is a cluster.
is_command
Syntax: is_command
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is a command.
is_comment
Syntax: is_comment
Applicable on: Line
Remark: This criterion will evaluate to True if the candidate line is comment line.
is_compiled
Syntax: is_compiled
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark: This criterion will evaluate to True if the candidate code element is compiled. Target, group are considered to be compiled once they are referenced by the application. Class (if it is not an always-compiled class) is considered to be compiled if it's used somewhere in the application. always-compiled class are always compiled. and the compilation status of generic, feature, assertion, argument local and line are determined by the compilation status of their written in class.
is_constant
Syntax: is_constant
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is a constant.
is_creator
Syntax: is_creator
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is a creator feature.
is_deferred
Syntax: is_deferred
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate feature is deferred
is_effective
Syntax: is_effective
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate class or feature is effective.
is_ensure
Syntax: is_ensure
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is in ensure clause.
is_ensure_then
Syntax: is_ensure_then
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is in ensure then clause.
is_enum
Syntax: is_enum
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is an enumeration. Only has effect on .NET platform, on other platforms, this criterion always evaluates to False.
is_expanded
Syntax: is_expanded
Applicable on: Class, Generic
Remark: This criterion will evaluate to True if the candidate class or generic is expanded.
is_exported
Syntax: is_exported
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is exported to ANY.
is_external
Syntax: is_external
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate class or feature is external.
is_feature
Syntax: is_feature
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is real feature. In metrics tool, invariant is treated as a special kind of feature. So if you count features in a class, it's invariant clause will be included. is_feature criterion is used to filter invariant clause out.
is_from_any
Syntax: is_from_any
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is from class
is_frozen
Syntax: is_frozen
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate feature is frozen.
is_function
Syntax: is_function
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate is a function.
is_generic
Syntax: is_generic
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is a generic class.
is_hidden
Syntax: is_hidden
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is exported to
is_immediate
Syntax: is_immediate
Applicable on: Feature, Assertion, Argument, Local
Remark: This criterion will evaluate to True if the candidate code element is immediate instead of inherited.
is_implementation_comment
Syntax: is_implementation_comment
Applicable on: Line
Remark: This criterion will evaluate to True if the candidate line is implementation comment. Implementation comment is also called commented code. In Eiffel, the convention is that if the comment indicator "--" starts from the first column of a line, that line is an implementation comment line.
is_infix
Syntax: is_infix
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is infix.
is_invariant
Syntax: is_invariant
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is from invariant clause.
is_invariant_feature
Syntax: is_invariant_feature
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is an invariant. See the description of criterion is_feature for more detail.
is_library
Syntax: is_library
Applicable on: Group
Remark: This criterion will evaluate to True if the candidate group is a library.
is_obsolete
Syntax: is_obsolete
Applicable on: Class, Feature
Remark: This criterion will evaluate to True if the candidate class or feature is obsolete.
is_once
Syntax: is_once
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is once.
is_origin
Syntax: is_origin
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is origin instead of a inherited one.
is_override
Syntax: is_override
Applicable on: Group
Remark: This criterion will evaluate to True if the candidate group overrides some other group.
is_overriden
Syntax: is_overriden
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is overridden by some other class.
is_overrider
Syntax: is_overrider
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class overrides some other class.
is_partial
Syntax: is_partial
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is partical class. Only has effect on .NET platform, on other platforms, this criterion always evaluates to False.
is_postcondition
Syntax: is_postcondition
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is a postcondition.
is_precompiled
Syntax: is_precompiled
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is precompiled.
is_precondition
Syntax: is_precondition
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is a precondition.
is_prefix
Syntax: is_prefix
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate is a prefix.
is_procedure
Syntax: is_procedure
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is a procedure.
is_query
Syntax: is_query
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is a query.
is_read_only
Syntax: is_read_only
Applicable on: Class
Remark: This criterion will evaluate to True if the candidate class is read-only.
is_reference
Syntax: is_reference
Applicable on: Generic
Remark: This criterion will evaluate to True if the candidate generic is reference.
is_require
Syntax: is_require
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is in require clause.
is_require_else
Syntax: is_require_else
Applicable on: Assertion
Remark: This criterion will evaluate to True if the candidate assertion is in require else clause.
is_satisfied_by
Syntax: is_satisfied_by command specification
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark:
This criterion will invoke external command given in command specification to decide whether current item is evaluated to True. Placeholders are used as interface between current item and the external command. The following placeholders are supported:
- $class_name: this will be replaced by class name of current item
- $directory_name: this will be replaced by the directory location of current item
- $file: this will be replaced by file name part, i.e., without heading directory, of $path of current item
- $file_name: this will be replaced by the path of current item
- $f_code: this will be replaced by the F_code directory of current target, if defined
- $group_directory: this will be replaced by the directory of the group of current item
- $group_name: this will be replaced by the group name of current item
- $path: same as $file_name
- $project_directory: this will be replaced by the directory of current project, if defined
- $target_directory: this will be replaced by the directory of current target, if defined
- $target_name: this will be replaced by name of current target, if defined
- $w_code: this will be replaced by the W_code directory of current target, if defined
Command specification can be set in the dialog associated to this criterion, shown in the following picture:
Command name
External command is specified here.
The command shown in the picture will test the subversion status of the current class (suppose we are running a class metric). The class path is given by "$path". And the output of the "svn stat $path" command is redirected to grep so we can check if the output starts with a letter "M" which indicates tha the class is changed locally.
Workding directory
Working directory for the command is set here.
Input
Input, if any, of the command is set here.
If the option "As file name" is checked, the text specified is treated as a file name in which actual input is stored.
Output
Expected output, if any, of the command is set here.
If the option "As file name" is checked, the text specified is treated as a file name in which actual output is stored.
If the option "Enabled" is not checked, the output will be ignored.
Error
Expected error, if any, of the command is set here.
If the option "As file name" is checked, the text specified is treated as a file name in which actual error is stored.
If the option "Enabled" is not checked, the error will be ignored.
If the option "Redirected to output" is checked, error of the command will be redirected to output.
Exit code
Expected exit code of the command is set here.
If the option "Enabled" is not checked, the exit code will be ignored.
In the above output, error, exit code sections, if more than one are enabled, they are treated as "and-ed". For example if output and exit code are enabled, this criterion is evaluated to True only if the actual output from the command matches the expected output and the exit code from the command matches the expected exit code.
is_unique
Syntax: is_unique
Applicable on: Feature
Remark: This criterion will evaluate to True if the candidate feature is an unique feature.
is_used
Syntax: is_used
Applicable on: Local
Remark: This criterion will evaluate to True if the candidate local is used.
is_used_in_library
Syntax: is_used_in_library
Applicable on: Group
Remark: This criterion will evaluate to True if the candidate group is used in some library instead of only referenced by current application.
is_visible
Syntax: is_visible
Applicable on: Class, Generic, Feature, Assertion, Argument, Local
Remark: This criterion will evaluate to True if the candidate code element is visible from the input domain of current calculated metric.
Visibility of a class means that if that element is visible from the input domain of the metric. To explains it more clearly, let's see an example:
The figure shows the group hierarchy of a Vision2 application. library
And if we create the following basic metric and run it with current application target as input domain:
We'll get all classes in the application including those classes in
But if we do things a little bit differently, we create the following metric and run it with current application target as input domain:
Then we will get all visible classes in current application target. i.e., those classes in
Visibility of a generic, feature, assertion, argument, local is determined by its written in class.
true
Syntax: true
Applicable on: Target, Group, Class, Generic, Feature, Assertion, Argument, Local, Line
Remark: This criterion always evaluates to True.