jQAssistant Java Metrics Plugin

This project provides a jQAssistant plugin to measure some widely known metrics.

Лицензия

Лицензия

Категории

Категории

Java Языки программирования Ant Компиляция и сборка jQAssistant Тестирование приложения и мониторинг Code Analysis Metrics Monitoring
Группа

Группа

org.jqassistant.contrib.plugin
Идентификатор

Идентификатор

jqassistant-java-metrics-plugin
Последняя версия

Последняя версия

1.8.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

jQAssistant Java Metrics Plugin
This project provides a jQAssistant plugin to measure some widely known metrics.
Ссылка на сайт

Ссылка на сайт

https://github.com/jqassistant-contrib/jqassistant-java-metrics-plugin
Организация-разработчик

Организация-разработчик

jQAssistant
Система контроля версий

Система контроля версий

https://github.com/jqassistant-contrib/jqassistant-java-metrics-plugin

Скачать jqassistant-java-metrics-plugin

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.jqassistant.contrib.plugin/jqassistant-java-metrics-plugin/ -->
<dependency>
    <groupId>org.jqassistant.contrib.plugin</groupId>
    <artifactId>jqassistant-java-metrics-plugin</artifactId>
    <version>1.8.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.jqassistant.contrib.plugin/jqassistant-java-metrics-plugin/
implementation 'org.jqassistant.contrib.plugin:jqassistant-java-metrics-plugin:1.8.0'
// https://jarcasting.com/artifacts/org.jqassistant.contrib.plugin/jqassistant-java-metrics-plugin/
implementation ("org.jqassistant.contrib.plugin:jqassistant-java-metrics-plugin:1.8.0")
'org.jqassistant.contrib.plugin:jqassistant-java-metrics-plugin:jar:1.8.0'
<dependency org="org.jqassistant.contrib.plugin" name="jqassistant-java-metrics-plugin" rev="1.8.0">
  <artifact name="jqassistant-java-metrics-plugin" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jqassistant.contrib.plugin', module='jqassistant-java-metrics-plugin', version='1.8.0')
)
libraryDependencies += "org.jqassistant.contrib.plugin" % "jqassistant-java-metrics-plugin" % "1.8.0"
[org.jqassistant.contrib.plugin/jqassistant-java-metrics-plugin "1.8.0"]

Зависимости

provided (3)

Идентификатор библиотеки Тип Версия
com.buschmais.jqassistant.core : store jar
com.buschmais.jqassistant.core : report jar
com.buschmais.jqassistant.plugin : java jar

test (12)

Идентификатор библиотеки Тип Версия
org.junit.jupiter : junit-jupiter-engine jar 5.5.1
org.junit.jupiter : junit-jupiter-params jar 5.5.1
org.assertj : assertj-core jar 3.11.1
org.mockito : mockito-core jar 1.10.19
org.slf4j : slf4j-simple jar 1.7.25
com.buschmais.jqassistant.core : store test-jar 1.8.0
com.buschmais.jqassistant.core : scanner jar
com.buschmais.jqassistant.core : analysis test-jar 1.8.0
com.buschmais.jqassistant.core : plugin jar
com.buschmais.jqassistant.plugin : common test-jar 1.8.0
com.buschmais.jqassistant.neo4jserver : neo4jv3 jar 1.8.0
com.buschmais.jqassistant.plugin : java test-jar 1.8.0

Модули Проекта

Данный проект не имеет модулей.

jQAssistant Java Metrics Plugin

This project provides a jQAssistant plugin to measure some widely known metrics.

How It Works

OOD-Metrics

The OOD metrics were described first by Robert C. Martin. He described several metrics:

  • Normalized Distance - It’s very similar to distance, but in normalized range.

  • Distance - The distance from the "main sequence"

    • Instability - Relative number describes the stability of a package.

      • Afferent Couplings - Absolute number of incoming dependencies.

      • Efferent Couplings - Absolute number of outgoing dependencies.

    • Abstractness - Relative number describes the abstractness of a package.

      • Number Classes - Absolute number of classes in a package.

      • Number Abstracts - Absolute number of abstract classes in package.

Visibility Metrics

  • Relative Visibility - Relative number describes the outside visible elements.

Usage

Prerequisites

  • Java 8 or higher

  • Maven 3.2.5 or higher

  • jQAssistant 1.8.0 or higher (see below)

Setup

The plugin can be enabled in Maven based project by adding it as a dependency to the jQAssistant Maven plugin:

pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>com.buschmais.jqassistant</groupId>
            <artifactId>jqassistant-maven-plugin</artifactId>
            <version>1.8.0</version>
            <executions>
                <execution>
                    <goals>
                        <goal>scan</goal>
                        <goal>analyze</goal>
                    </goals>
                    <configuration>
                        <concepts>
                            <concept>ood-metrics:NormalizedDistance</concept>               <!--(1)-->
                            <concept>visiblity-metrics:RelativeVisibility</concept>
                        </concepts>
                    </configuration>
                </execution>
            </executions>
            <dependencies>
                <dependency>                                                                <!--(2)-->
                    <groupId>org.jqassistant.contrib.plugin</groupId>
                    <artifactId>jqassistant-java-metrics-plugin</artifactId>
                    <version>1.8.0</version>
                </dependency>
            </dependencies>
        </plugin>
    </plugins>
</build>
  1. Configure wanted the concepts of the plugin.

  2. Declares the plugin as dependency of jQAssistant

Application of the results

Manually query the results

Query some OOD-Metrics of package a.b.c
MATCH
  (p:Java:Package {fqn:"a.b.c"})
RETURN
  p.normalizedDistance, p.abstractness, p.instability

Usually you won’t query the results manually. Instead you’ll implement your own rule to check if packages meet your requirements.

Rule

jqassistant/my-rules.xml
<jqa:jqassistant-rules xmlns:jqa="http://www.buschmais.com/jqassistant/core/rule/schema/v1.3">
    <constraint id="my-rule:NormalizedDistance">
        <requiresConcept refId="ood-metrics:NormalizedDistance"/>
        <description>The Normalized Distance of package a.b.c must be lower or equals than 0.2.</description>
        <cypher><![CDATA[
            MATCH (p:Package {fqn:"a.b.c"})
            WHERE p.normalizedDistance > 0.2
            RETURN p
        ]]></cypher>
    </concept>
</jqa:jqassistant-rules>

This constraint will return the package a.b.c if its Normalized Distance is greater than 0.2. By using the default settings this will break your build.

Reference

All properties are created at a Node with Label :Java:Package.

Table 1. All properties created by this plugin
Property Description Created by

ca

Afferent couplings

ood-metrics:AfferentCouplings
ood-metrics:Instability
ood-metrics:Distance
ood-metrics:NormalizedDistance

ce

Efferent couplings

ood-metrics:EfferentCouplings
ood-metrics:Instability
ood-metrics:Distance
ood-metrics:NormalizedDistance

instability

Instability

ood-metrics:Instability
ood-metrics:Distance
ood-metrics:NormalizedDistance

nc

Number Classes

ood-metrics:NumberClasses
ood-metrics:Abstractness
ood-metrics:Distance
ood-metrics:NormalizedDistance

na

Number Abstracts

ood-metrics:NumberAbstracts
ood-metrics:Abstractness
ood-metrics:Distance
ood-metrics:NormalizedDistance

abstractness

Abstractness

ood-metrics:Abstractness
ood-metrics:Distance
ood-metrics:NormalizedDistance

distance

Distance

ood-metrics:Distance

normalizeDistance

Normalized Distance

ood-metrics:NormalizedDistance

relativeVisibility

Relative Visibility

visibility-metrics:RelativeVisibility

Feedback

Please report any issues.

Acknowledgements

This plugin could not provide its functionality without the support of the following open source projects:

org.jqassistant.contrib.plugin

jQAssistant Contribution

A place for contributions to jQAssistant, e.g. plugins, tool integrations etc.

Версии библиотеки

Версия
1.8.0