Page tree
Skip to end of metadata
Go to start of metadata

Information about Object Filters/Explicit Content in a User Defined Module


Combining Object Filters and Explicit Content

When defining a User Define Module (see User Defined Module editor), it is possible to combine various different filter options. A User Defined Module can consist of 0 to N Object Filters (defined in the Filter tab in the User Defined Module editor) and 0 to 1 Explicit Content (defined in the Explicit Content tab in the User Defined Module editor). The result of these options is derived using a UNION between the Object Filter(s) and the Explicit Content.

By default, a new User Defined Module will be provided with an empty filter called "My Object Filter". This filter contains no configuration at all, however, if left as is, it will return all objects associated with the Application (identical to the Full Content module - see the Modules tab). This is of particular importance if you choose to configure an Explicit Content filter - if the empty "My Object Filter" is left then it will override any Explicit Content filters you create and return all objects.

Object Filters

An Object Filter can target objects using an INTERSECTION of the various filter types. A target object must:

  • (if the filter is active) belong to a filtered Technology
  • (if the filter is active) AND belong to one of the selected Analysis Units that function using a UNION between Analysis Units
  • (if the filter is active) AND match a selected Object Type that function using a UNION between Object Types
  • (if the filter is active) AND match one of the expressions on the Object Name, Object Full Name and Object Path that function using a UNION between expressions.
Behaviour with regard to child objects

User Defined Modules will always include child objects, i.e:

  • children of directly matched objects
  • children of children and so on.

This can sometimes be confusing when using user defined modules defined on object full paths in CAST dashboards: violations will be displayed for objects that may not necessarily match the the object full path defined in the filter. This is because some objects may be child objects. CAST recommends using object filters based on Analysis Units rather than on the object full path to avoid having violations returned for child objects that are not specifically part of the object filter.

Take the following example. If the object filter is based on the object full path, for instance SomeCode\NextCode\Comments\src, it will retrieve the file comment1.cs and its children, and children of these children etc. In this situation, we can expect that the Namespace viewComment and objects of the class comment1 to be part of the module. However, since we have matched the namespace viewComment (a child of the comment1.cs file), the class comment2 will also be part of the module as it is a child of the namespace.


CAST Website

  • No labels