Giter Site home page Giter Site logo

jqassistant-archive / jqassistant-java-metrics-plugin Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 0.0 42 KB

@jQAssistant plugin providing concepts to calculate software quality metrics

License: GNU General Public License v3.0

Java 100.00%
quality jqassistant metrics plugin software-analytics

jqassistant-java-metrics-plugin's Introduction

jQAssistant Java Metrics Plugin

NOTE

This project has been archived and is no longer actively developed. Please refer to the existing releases and documentation.

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

How It Works

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.

  • 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:

jqassistant-java-metrics-plugin's People

Contributors

dirkmahler avatar jdufner avatar stephanpirnbaum avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jqassistant-java-metrics-plugin's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.