Skip to end of metadata
Go to start of metadata

This coding rule is only available for Java projects.

Note that compiled code must be available.

Source code complies to an architectural model when it fully adheres to a set of architectural constraints. Setting an architectural constraint allows you to set patterns to flag forbidden references between classes.

Here are some examples of patterns:

  • forbid access to *.web.* from *.dao.* classes
  • forbid access to java.util.Vector, java.util.Hashtable and java.util.Enumeration from any class
  • forbid access to java.sql.* from *.ui.* and **.web.* classes

The Architectural constraint template, provided by the Sonar rule engine, allows you to define as many architectural constraint rules as desired:

When creating a custom rule based on this architectural rule template, you must specify the access constraints:

Your newly created rule can now be used and activated in any desired quality profile:

  • No labels