Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »


This coding rule is available for .Net and 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 classes
  • forbid access to java.sql.* from *.ui.* and **.web.* classes

An Architectural constraint rule, provided by the Sonar rule engine, allows to define as many architectural constraints as desired:

The architectural constraint should be considered as a rule template and should not be directly activated. Let's say for instance that you want to forbid use of java.sql package by all your projects. In that case, you must first Copy the Architectural constraint rule to create and share your own specialized architectural constraint:

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

  • No labels