Skip to content

An open source tool for the analysis of source code. It can analyze code complexity and dependencies inside a project.

License

Notifications You must be signed in to change notification settings

hdmsantander/archinaut

Repository files navigation

Archinaut

An open source tool to integrate metric results from other source code analysis tools. It generates a CSV file named archinaut.csv containing all the combined metrics provided. It can also generate a XML report in the JUnit standard, given thresholds over the metrics analyzed by the tool.

Usage: java -jar archinaut.jar --configuration archinaut.yml

Configuration file

Path to the configuration file that holds the Archinaut settings in a YAML format. The configuration file is divided by sections, each section being a source of metrics (metric report) that can be integrated by Archinaut. The current formats recognized by Archinaut are:

The file declared in each section must be an existing file, reachable by Archinaut at runtime.

The renaming section is used to standarize names of the objects inside the metric reports, prefixes and suffixes are removed and then substitutions of characters are performed in the order defined.

The metrics section is used to declare the numeric (integer) metrics that are to be loaded from the metric reports. The one marked with the boolean filename serves as the identifier for the filename in the report, there can only be one filename flag specified. The metrics can be renamed if a rename is specified.

The metric report provided by depends is non-optional and its generated with the following depends options: java -jar $DEPENDS_JAR -s -p dot -d $HOME java ./src depends

An example of the archinaut.yml file can be seen here:

archinaut.yml

---
file: 'scc.csv'
format: 'CSV'
renaming:
  pathSeparator: '/'
  prefix: 'src/main/java/'
  suffix: ''
  substitutions:
    - order: 1
      substitute: '.'
      with: '_'
    - order: 2
      substitute: '/'
      with: '_'
metrics:
  - name: 'Location'
    filename: true
  - name: 'Lines'
    rename: 'SCC_LOC'
  - name: 'Code'
    rename: 'SCC_CLOC'
  - name: 'Complexity'
    rename: 'SCC_COMPLEXITY'
---
file: 'frequencies.csv'
format: 'CSV'
renaming:
  pathSeparator: '/'
  prefix: 'src/main/java/'
  suffix: ''
  substitutions:
    - order: 1
      substitute: '.'
      with: '_'
    - order: 2
      substitute: '/'
      with: '_'
metrics:
  - name: 'entity'
    filename: true
  - name: 'n-revs'
    rename: 'ARCH_REVISIONS'
  - name: 'bugs'
    rename: 'BUG_COMMITS'
  - name: 'added'
    rename: 'LINES_ADDED'
  - name: 'removed'
    rename: 'LINES_REMOVED'
---
file: 'coupling.csv'
format: 'CSV'
renaming:
  pathSeparator: '/'
  prefix: 'src/main/java/'
  suffix: ''
  substitutions:
    - order: 1
      substitute: '.'
      with: '_'
    - order: 2
      substitute: '/'
      with: '_'
metrics:
  - name: 'entity'
    filename: true
  - name: 'cochanges'
    rename: 'COCHANGES'
---
file: 'depends.json'
format: 'DEPENDS'
renaming:
  pathSeparator: '.'
  prefix: 'main.java.'
  suffix: ''
  substitutions:
    - order: 1
      substitute: '.'
      with: '_'
metrics:
  - name: 'Call'
  - name: 'Import'
  - name: 'Return'
  - name: 'Use'
  - name: 'Parameter'
  - name: 'Contain'
  - name: 'Implement'
  - name: 'Create'
  - name: 'Extend'

Threshold inputs

These inputs are optional and serve to generate a JUnit format XML report with the threshold violations. These inputs are provided in the from of environment variables.

Given any metrics declared in the configuration file, an input can be declared in the action specification, that will work as a threshold to generate a JUnit style XML report with the violations of said thresholds. For example, in the archinaut.yml file we specified the metrics SCC_LOC, SCC_CLOC and SCC_COMPLEXITY, so we can declare the following inputs:

  • INPUT_SCC_LOC=150
  • INPUT_SCC_CLOC=100
  • INPUT_SCC_COMPLEXITY=15

These inputs will be parsed and used at runtime to generate a JUnit style XML report named archinaut.xml with the violations detected.

GitHub action

To use the project in a GitHub action please refer to the project found here.

About

An open source tool for the analysis of source code. It can analyze code complexity and dependencies inside a project.

Topics

Resources

License

Stars

Watchers

Forks

Languages