Description

ArchLint is a tool that combines static and historical source code analysis techniques to provide a lightweight alternative for static architecture conformance checking.

Basically, the approach relies on two types of input information on the target system: (a) history of versions; (b) high-level component specification.

Proposed approach

We consider that the classes of a system are statically organized in modules (or packages, in Java terms) and that modules are logically grouped in coarse-grained structures, called components. The component model includes information on the names of the components and a mapping from modules to the defined components, using regular expressions. From this, ArchLint identifies suspicious dependencies (or lack of) in source code by relying on frequency hypotheses and past corrections made on these dependencies. ArchLint considers all static dependencies possibly established between classes, including dependencies due to method calls, variable declarations, inheritance, exceptions, etc.

Implementation

ArchLint's implementation follows a pipeline architectural pattern with three main components: Code Extractor, Dependency Extractor, and Architectural Violations Detector.

ArchLint architecture
  • The Code Extractor module is responsible for extracting the source code of all versions of the system under evaluation. Currently, our prototype provides access only to SVN repositories.
  • The Dependency Extractor is responsible for creating a dependency model describing the structural relations available in each source code version considered in the evaluation. Essentially, this model is a directed graph, whose nodes are classes and the edges are the dependencies. To extract the dependencies from the source code, we use VerveineJ, a Java parser that exports dependency relations in the format for modeling static information defined by the Moose platform for software analysis. We modified VerveineJ to store this information in a relational database, in order to facilitate queries over the collected data.
  • The Architectural Violations Detector module implements four heuristics for detecting both absences and divergences in source code based architecture. Basically, the heuristics are implemented as SQL queries.