The Cockpit analyzes projects based on statistical analysis techniques. To do this, a number of elements must be provided at the start of a new analysis.
There are three categories of elements:
- Source files (*.cs and *.java)
- Files generated from compiling (*.dll and *.jar)
- Libraries referenced by the project (*.dll and *.jar)
The source files are used in the analysis to calculate some metrics, such as the number of lines of code, the search for practice anomalies, and the search for duplicates. These files are also used to generate the viewable source code you can access from an anomaly in the Cockpit.
The files generated from compiling are used to extract structural elements from the code (classes, interfaces, methods, etc.), which are used to aggregate the quality measurements. Also, other metrics (number of instructions, cyclomatic complexity, etc) and practice anomalies will be extracted from these files.
Finally, the libraries are not directly analyzed, but they are useful when researching practice anomalies.
Let's consider the example of NeverMakeCtorCallOverridableMethod, which checks for calls to a virtual method in the constructor. For each method called in a constructor, this rule will check if it is virtual. If the method is defined in a library, the declaration must be accessible.
Finally, for consistent results, all of the elements should be synchronous. The source files should be the ones used to generate the compiled files, and the libraries should be the same versions as used in the code. To avoid problems and facilitate processes, we provide packaging tools that interface with the standard tools (MSBuild, Team Foundation System, Ant, Maven, Hudson...). They will be discussed later.