Coder Social home page Coder Social logo

cqfn / jpeek Goto Github PK

View Code? Open in Web Editor NEW
204.0 11.0 81.0 12.64 MB

Hosted and command-line calculator of cohesion metrics for Java code

Home Page: https://i.jpeek.org

License: MIT License

Java 66.24% XSLT 32.09% Shell 1.00% CSS 0.07% Ruby 0.57% Procfile 0.03%
java static-analysis quality metrics cohesion oop

jpeek's Introduction

logo

EO principles respected here DevOps By Rultor.com We recommend IntelliJ IDEA

mvn Javadoc PDD status Maven Central License codecov jpeek report SonarQube Hits-of-Code

jPeek is a static collector of Java code metrics.

Motivation: Class cohesion, for example, is considered as one of most important object-oriented software attributes. There are over 30 different cohesion metrics invented so far, but almost none of them have calculators available. The situation with other metrics is very similar. We want to create such a tool that will make it possible to analyze code quality more or less formally (with hundreds of metrics). Then, we will apply this analysis to different Java libraries with an intent to prove that the ideas from Elegant Objects book series make sense.

How to use?

Load the latest jar-with-dependencies.jar file from here and then:

$ java -jar jpeek-jar-with-dependencies.jar --sources . --target ./jpeek

jPeek will analyze Java files in the current directory. XML reports will be generated in the ./jpeek directory. Enjoy.

Available CLI options
Option Description
-s, --sources <path> Required. Path to directory with the class files
-t, --target <path> Required. Path to directory where the reports will be generated
--include-ctors Include constructors into all formulas
--include-static-methods Include static methods into all formulas
--include-private-methods Include private methods into all formulas
--metrics <metrics> Comma-separated list of metrics to include (default: "LCOM5,NHD,MMAC,SCOM,CAMC")
--overwrite Overwrite the target directory, if it exists, or exit with error
--quiet Turn off logging
--help Display help message

You can also deploy it as a web service to your own platform. Just compile it with mvn clean package --settings settings.xml and then run, as Procfile suggests. You will need to have settings.xml with the following data:

<settings>
  <profiles>
    <profile>
      <id>jpeek-heroku</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <properties>
        <sentry.dsn>https://...</sentry.dsn>
        <dynamo.key>AKIAI..........LNN6A</dynamo.key>
        <dynamo.secret>6560KMv5+8Ti....................Qdwob63Z</dynamo.secret>
      </properties>
    </profile>
  </profiles>
</settings>

You will also need these tables in DynamoDB (all indexes must deliver ALL attributes):

jpeek-mistakes:
  metric (HASH/String)
  version (RANGE/String)
  indexes:
    mistakes (GSI):
      version (HASH/String),
      avg (RANGE/Number)
jpeek-results:
  artifact (HASH/String)
  indexes:
    ranks (GSI):
      version (HASH/String)
      rank (RANGE/Number)
    scores (GSI):
      version (HASH/String)
      score (RANGE/Number)
    recent (GSI):
      good (HASH/String)
      added (RANGE/Number)

Cohesion Metrics

These papers provide a pretty good summary of cohesion metrics:

[izadkhah17] Habib Izadkhah et al.,
Class Cohesion Metrics for Software Engineering: A Critical Review,
Computer Science Journal of Moldova, vol.25, no.1(73), 2017, PDF.

[badri08] Linda Badri et al.,
Revisiting Class Cohesion: An empirical investigation on several systems,
Journal of Object Technology, vol.7, no.6, 2008, PDF.

Here is a list of metrics we have already implemented (in order or their appearance):

[chidamber94] Lack of Cohesion in Methods (LCOM).
Shyam Chidamber et al.,
A metrics suite for object oriented design,
IEEE Transactions on Software Engineering, vol.20, no.6, 1994, PDF.

[bieman95] Tight Class Cohesion (TCC) and Loose Class Cohesion (LCC).
James M. Bieman et al.,
Cohesion and Reuse in an Object-Oriented System,
Department of Computer Science, Colorado State University, 1995, PDF.

[hitz95] Lack of Cohesion in Methods 4 (LCOM4).
Martin Hitz et al.,
Measuring Coupling and Cohesion In Object-Oriented Systems,
Institute of Applied Computer Science and Systems Analysis, University of Vienna, 1995, PDF.

[sellers96] Lack of Cohesion in Methods 2-3 (LCOM 2, 3 and 5).
B. Henderson-Sellers et al.,
Coupling and cohesion (towards a valid metrics suite for object-oriented analysis and design),
Object Oriented Systems 3, 1996, PDF.

[bansiya99] Cohesion Among Methods of Classes (CAMC).
Jagdish Bansiya et al.,
A class cohesion metric for object-oriented designs,
Journal of Object-Oriented Programming, vol. 11, no. 8, 1999, PDF.

[etzkorn00] LOgical Relatedness of Methods (LORM).
L. Etzkorn and H. Delugach,
Towards a semantic metrics suite for object-oriented design,
Technology of Object-Oriented Languages and Systems, 2000. TOOLS 34. Proceedings. 34th International Conference on. IEEE, 2000, pp. 71–80, PDF

[wasiq01] Class Connection Metric (CCM).
M. Wasiq
Measuring Class Cohesion in Object-Oriented Systems,
Master Thesis at the King Fahd University of Petroleum & Minerals, 2001, PDF.

[aman04] Optimistic Class Cohesion (OCC) and Pessimistic Class Cohesion (PCC).
Hirohisa Aman et al.,
A proposal of class cohesion metrics using sizes of cohesive parts,
Proc. of Fifth Joint Conference on Knowledge-based Software Engineering, 2002, PDF.

[marcus05] Conceptual Cohesion of Classes (C3).
A. Marcus and D. Poshyvanyk,
The conceptual cohesion of classes,
21st IEEE International Conference on Software Maintenance (ICSM'05), Budapest, Hungary, 2005, pp. 133-142, PDF

[counsell06] Normalized Hamming Distance (NHD).
Steve Counsell et al.,
The interpretation and utility of three cohesion metrics for object-oriented design,
ACM TOSEM, April 2006, PDF.

[fernandez06] A Sensitive Metric of Class Cohesion (SCOM).
Luis Fernández et al.,
[A] new metric [...] yielding meaningful values [...] more sensitive than those previously reported,
International Journal "Information Theories & Applications", Volume 13, 2006, PDF.

[dallal07] Method-Method through Attributes Cohesion (MMAC).
Jehad Al Dallal,
A Design-Based Cohesion Metric for Object-Oriented Classes,
World Academy of Science, Engineering and Technology International Journal of Computer and Information Engineering Vol:1, No:10, 2007, PDF.

[liu09] Maximal Weighted Entropy (MWE).
Y. Liu, D. Poshyvanyk, R. Ferenc, T. Gyim´othy, and N. Chrisochoides,
Modeling class cohesion as mixtures of latent topics,
Software Maintenance, 2009. ICSM 2009. IEEE International Conference on. IEEE, 2009, pp. 233–242, PDF

[dallal11] Transitive Lack of Cohesion in Methods (TLCOM).
Jehad Al Dallal,
Transitive-based object-oriented lack-of-cohesion metric,
Department of Information Science, Kuwait University, 2011, PDF.

How it works?

First, Skeleton parses Java bytecode using Javaassit and ASM, in order to produce skeleton.xml. This XML document contains information about each class, which is necessary for the metrics calculations. For example, this simple Java class:

class Book {
  private int id;
  int getId() {
    return this.id;
  }
}

Will look like this in the skeleton.xml:

<class id='Book'>
  <attributes>
   <attribute public='false' static='false' type='I'>id</attribute>
  </attributes>
  <methods>
    <method abstract='false' ctor='true' desc='()I' name='getId' public='true' static='false'>
      <return>I</return>
      <args/>
    </method>
  </methods>
</class>

Then, we have a collection of XSL stylesheets, one per each metric. For example, LCOM.xsl transforms skeleton.xml into LCOM.xml, which may look like this:

<metric>
  <title>MMAC</title>
  <app>
    <class id='InstantiatorProvider' value='1'/>
    <class id='InstantationException' value='0'/>
    <class id='AnswersValidator' value='0.0583'/>
    <class id='ClassNode' value='0.25'/>
    [... skipped ...]
  </app>
</metric>

Thus, all calculations happen inside the XSLT files. We decided to implement it this way after a less successful attempt to do it all in Java. It seems that XSL is much more suitable for manipulations with data than Java.

jPeek maven plugin

We are developing a jPeek plugin for Maven, see jPeek Maven plugin project.

Known Limitations

  • The java compiler is known to inline constant variables as per JLS 13.1. This affects the results calculated by metrics that take into account access to class attributes if these are final constants. For instance, all LCOM and COM metrics are affected.

How to contribute?

Just fork, make changes, run mvn clean install -Pqulice and submit a pull request; read this, if lost.

Contributors

Don't hesitate to add your name to this list in your next pull request.

jpeek's People

Contributors

amihaiemil avatar dgarus avatar gnusinpavel avatar gsnoff avatar hdouss avatar ilyakharlamov avatar keddok avatar laithalebrahim avatar llorllale avatar magdel avatar metafates avatar mohamednizar avatar oridan avatar paulodamaso avatar pbenety avatar pnatashap avatar rexim avatar rok-povsic avatar rultor avatar sharpler avatar skapral avatar starkda avatar stepanov-dmitry avatar uurl avatar verkhovin avatar victornoel avatar vmotsak avatar vssekorin avatar vzurauskas avatar yegor256 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jpeek's Issues

colors for metrics

Let's add colors to all metrics, to indicate their quality (red, green, yellow).

web front

Let's create a simple web front for public Maven artifacts.

jpeek fails to run

I fail to run jpeek. I end up in exceptions when runnnig the maven repository jar and compiled sources.

When running the repository jar, given in the readme, some class is reported missing:

$ java -jar ~/tools/jpeek/jpeek-0.1-jar-with-dependencies.jar . /tmp/jpeek
Exception in thread "main" java.io.IOException: java.io.UncheckedIOException: java.io.IOException: java.lang.IllegalStateException: javassist.NotFoundException: com.company.releng.tools.deploy.locations.DeployLocations
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
        at org.cactoos.scalar.IoCheckedScalar.value(IoCheckedScalar.java:60)
        at org.jpeek.App.analyze(App.java:96)
        at org.jpeek.Main.main(Main.java:61)
Caused by: java.io.UncheckedIOException: java.io.IOException: java.lang.IllegalStateException: javassist.NotFoundException: com.company.releng.tools.deploy.locations.DeployLocations
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:61)
        at org.cactoos.iterator.Mapped.next(Mapped.java:70)
        at org.jpeek.metrics.cohesion.CAMC.metrics(CAMC.java:118)
        at org.jpeek.metrics.cohesion.CAMC.xembly(CAMC.java:91)
        at org.jpeek.App.lambda$analyze$0(App.java:85)
        at org.cactoos.func.FuncOf.lambda$new$3(FuncOf.java:88)
        at org.cactoos.func.FuncOf.apply(FuncOf.java:104)
        at org.cactoos.scalar.And.lambda$null$0(And.java:101)
        at org.cactoos.scalar.And.value(And.java:127)
        at org.cactoos.scalar.And.value(And.java:52)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        ... 3 more
Caused by: java.io.IOException: java.lang.IllegalStateException: javassist.NotFoundException: com.company.releng.tools.deploy.locations.DeployLocations
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:59)
        ... 13 more
Caused by: java.lang.IllegalStateException: javassist.NotFoundException: com.company.releng.tools.deploy.locations.DeployLocations
        at org.jpeek.metrics.cohesion.CAMC.metric(CAMC.java:146)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        ... 14 more
Caused by: javassist.NotFoundException: com.company.releng.tools.deploy.locations.DeployLocations
        at javassist.ClassPool.get(ClassPool.java:445)
        at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:592)
        at javassist.bytecode.Descriptor.getParameterTypes(Descriptor.java:439)
        at javassist.CtBehavior.getParameterTypes(CtBehavior.java:298)
        at org.jpeek.metrics.cohesion.CAMC.methods(CAMC.java:196)
        at org.jpeek.metrics.cohesion.CAMC.cohesion(CAMC.java:157)
        at org.jpeek.metrics.cohesion.CAMC.metric(CAMC.java:142)
        ... 15 more

When trying to build the tool from source using mvn clean package , the build fails due to errors in tests:

# Build tests fail

Tests in error: 
  AppTest.createsXmlReports:50 » IO java.lang.IllegalArgumentException: 40 error...
  MainTest.createsXmlReports:47 » IO java.lang.IllegalArgumentException: 40 erro...

Tests run: 11, Failures: 4, Errors: 2, Skipped: 0

Building with mvn clean package -DskipTests produces the desired jar.

However when running this file, another exception occurs:

~/git/master$ java -jar ~/source/jpeek/target/jpeek-1.0-SNAPSHOT-jar-with-dependencies.jar . /tmp/jpeek
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Exception in thread "main" java.io.IOException: java.io.UncheckedIOException: java.io.IOException: javassist.NotFoundException: org.apache.commons.cli.CommandLine
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
        at org.cactoos.scalar.IoCheckedScalar.value(IoCheckedScalar.java:60)
        at org.jpeek.App.analyze(App.java:114)
        at org.jpeek.Main.main(Main.java:61)
Caused by: java.io.UncheckedIOException: java.io.IOException: javassist.NotFoundException: org.apache.commons.cli.CommandLine
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:61)
        at org.cactoos.iterator.Mapped.next(Mapped.java:70)
        at org.jpeek.metrics.JavassistClasses.metrics(JavassistClasses.java:129)
        at org.jpeek.metrics.JavassistClasses.xembly(JavassistClasses.java:101)
        at org.jpeek.metrics.cohesion.CAMC.xembly(CAMC.java:76)
        at org.jpeek.App.xml(App.java:134)
        at org.jpeek.App.lambda$analyze$0(App.java:102)
        at org.cactoos.func.FuncOf.lambda$new$3(FuncOf.java:88)
        at org.cactoos.func.FuncOf.apply(FuncOf.java:104)
        at org.cactoos.scalar.And.lambda$null$0(And.java:101)
        at org.cactoos.scalar.And.value(And.java:127)
        at org.cactoos.scalar.And.value(And.java:52)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        ... 3 more
Caused by: java.io.IOException: javassist.NotFoundException: org.apache.commons.cli.CommandLine
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
        at org.jpeek.metrics.JavassistClasses.metric(JavassistClasses.java:147)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:59)
        ... 15 more
Caused by: javassist.NotFoundException: org.apache.commons.cli.CommandLine
        at javassist.ClassPool.get(ClassPool.java:445)
        at javassist.bytecode.Descriptor.toCtClass(Descriptor.java:592)
        at javassist.bytecode.Descriptor.getParameterTypes(Descriptor.java:439)
        at javassist.CtBehavior.getParameterTypes(CtBehavior.java:298)
        at org.jpeek.metrics.cohesion.CAMC.methods(CAMC.java:139)
        at org.jpeek.metrics.cohesion.CAMC.cohesion(CAMC.java:86)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        ... 18 more

Am I missing something or did I catch the project in an unfortunate state?

AST or bytecode

To calculate class cohesion metrics we need information about methods, attributes, and connections between them. We can get that from the bytecode directly, or from AST, which we should get through some parser. Which option is better? The decision is important, since it will affect the entire design of this tool.

MWE

Let's implement MWE cohesion metric.

Y. Liu, D. Poshyvanyk, R. Ferenc, T. Gyim´othy, and N. Chrisochoides,
“Modeling class cohesion as mixtures of latent topics,”
in Software Maintenance, 2009. ICSM 2009. IEEE International
Conference on. IEEE, 2009, pp. 233–242.

PDF is not available :(

http://ieeexplore.ieee.org/document/5306318/

Questions and analyze

I have analyzed some implemented metrics and also think about the following questions during implementation metrics where we counting methods of a class and types of method parameters or return types. Next questions relate to all metrics and I think it should be clarified for all who want to implement some new metric. To be easy it to understand what I want to say let's look to CAMC metric implementation. We can take any metric, but CAMC has easy description and formula.

See this one paper Class Cohesion Metrics for Software Engineering: A Critical Review, PDF, Table 2. Interface-based metrics. CAMC metric is described as:
camc

1. Letter l in formula is a number of distinct parameter types across all methods in a class. For example, if class has the next methods

public int length(String str) {
	return s.length();
}
public int bytes(String str) {
	return str.getBytes().length;
}

then l should be equals to 1 because two methods have the same parameter type String. But for committed to repository implementation l will be equals to 2. It happens because our implementation counts not only parameter types of method but also it counts return types of method. For code above it counts int and String. I think our implementation contradicts to definition in the paper, we should count only parameter types of method.

One more evidence for that: if we should count both parameter types of method and return types then it clearly is wrote in the paper. See description for MMAC metric. Paper clearly tells us that i is can be a parameter type of method or return type. In the description of CAMC metric l is defined only as count of parameter types.

So, am I right that we should count only parameter types of method for l?


2. For example class has the next method:

public int plus(int a, Integer b) {
	return a + b;
}

Let see the point 1 above, for CAMC metric we should calculate value l as a number of distinct parameter types for method. Our implmentation counts l as 2 because method has two distinct types: int and java.lang.Integer. Also we can see it in a bytecode of method:

public plus(ILjava/lang/Integer;)I
 L0
  LINENUMBER 13 L0
  // ... and other instructions  

For compiler int and java.lang.Integer it is two different types, but for human it is one type for integer values.

So, should we consider simple types and theirs analogous boxed types as the same types or consider them as different types (like compiler does)?


3. Letter k in CAMC formula is a number of all methods in a class.

So, is it correct that we consider constructors as methods?

Should we consider only public methods or consider all methods (public, private, protected, package-private)? I think we should consider all methods, but what do you think?

If class inherits from another class then should we consider methods from parent class? I think we shouldn't, but what do you think?


4. Also interesting bug in counting of all methods in a class when class overrides one or more generic methods from parent. Let's see the next code:

public final class OverrideGenericMethodFromInterface 
	implements GenericIncrementor1<Integer> {

  private final int num;

  public OverrideGenericMethodFromInterface(int num) {
    this.num = num;
  }

  @Override
  public Integer inc() {
    return num + 1;
  }
}

interface GenericIncrementor1<T> {
  T inc();
}

We have generic interface GenericIncrementor1 and its implementation presented by class OverrideGenericMethodFromInterface. Visually we see only one method in OverrideGenericMethodFromInterface class, it is public Integer inc() { }. And when we count methods for some metric we expect that Javassist or ASM returns us only one method. But it doesn't. It returns two methods. Why does it happen? Let's see to the bytecode:

// class version 52.0 (52)
// access flags 0x31
// signature Ljava/lang/Object;LGenericIncrementor1<Ljava/lang/Integer;>;
// declaration: OverrideGenericMethodFromInterface implements GenericIncrementor1<java.lang.Integer>
public final class OverrideGenericMethodFromInterface implements GenericIncrementor1  {

  // compiled from: OverrideGenericMethodFromInterface.java

  // access flags 0x12
  private final I num

  // access flags 0x1
  public <init>(I)V
   L0
    LINENUMBER 5 L0
    ALOAD 0
    INVOKESPECIAL java/lang/Object.<init> ()V
   L1
    LINENUMBER 6 L1
    ALOAD 0
    ILOAD 1
    PUTFIELD OverrideGenericMethodFromInterface.num : I
   L2
    LINENUMBER 7 L2
    RETURN
    MAXSTACK = 2
    MAXLOCALS = 2

  // access flags 0x1
  public inc()Ljava/lang/Integer;
   L0
    LINENUMBER 11 L0
    ALOAD 0
    GETFIELD OverrideGenericMethodFromInterface.num : I
    ICONST_1
    IADD
    INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer;
    ARETURN
    MAXSTACK = 2
    MAXLOCALS = 1

  // access flags 0x1041
  public synthetic bridge inc()Ljava/lang/Object;
   L0
    LINENUMBER 1 L0
    ALOAD 0
    INVOKEVIRTUAL OverrideGenericMethodFromInterface.inc ()Ljava/lang/Integer;
    ARETURN
    MAXSTACK = 1
    MAXLOCALS = 1
}

In the bytecode two methods is presented: public inc()Ljava/lang/Integer; and public synthetic bridge inc()Ljava/lang/Object;. And according that Javassist or ASM works properly when returning two methods, because bytecode contains two methods. Compiler always generates one more method on each implementation of generic method in a class. And it impacts all our metrics. To avoid incorrect counting of all methods in a classs we should exclude synthetic methods.

Let's discuss all points/questions and I will fix them if it will be needed.

Too many open files

Analysing large projects fails as too many files are held open at the same time.

Scenario to reproduce:

  • Clone java-bullshifier
  • Generate sample project with 100 subprojects and 256 classes each
    • /tmp/java-bullshifier$ ./gradlew -Pclasses=256 -Psubprojects=100 clean run
    • /tmp/java-bullshifier/output$ ./gradlew fatjar
  • Use jpeek jar from Readme
  • Start analysis: /tmp/jpeek$ java -jar jpeek-0.5-jar-with-dependencies.jar /tmp/java-bullshifier/output /tmp/results

Run will fail following exception:

Exception in thread "main" java.io.IOException: java.io.UncheckedIOException: java.io.FileNotFoundException: /tmp/java-bullshifier/output/ProjAhgodwwubpj/build/tmp/fatjar-stage/ch/qos/logback/core/LogbackException.class (Too many open files)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
        at org.cactoos.scalar.IoCheckedScalar.value(IoCheckedScalar.java:60)
        at org.jpeek.App.analyze(App.java:115)
        at org.jpeek.Main.main(Main.java:61)
Caused by: java.io.UncheckedIOException: java.io.FileNotFoundException: /tmp/java-bullshifier/output/ProjAhgodwwubpj/build/tmp/fatjar-stage/ch/qos/logback/core/LogbackException.class (Too many open files)
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:61)
        at org.cactoos.iterator.Mapped.next(Mapped.java:70)
        at org.cactoos.iterator.Filtered.hasNext(Filtered.java:89)
        at org.cactoos.iterator.Mapped.hasNext(Mapped.java:65)
        at org.jpeek.metrics.JavassistClasses.metrics(JavassistClasses.java:139)
        at org.jpeek.metrics.JavassistClasses.xembly(JavassistClasses.java:103)
        at org.jpeek.metrics.cohesion.CAMC.xembly(CAMC.java:91)
        at org.jpeek.Report.xml(Report.java:124)
        at org.jpeek.Report.save(Report.java:88)
        at org.jpeek.App.lambda$analyze$0(App.java:112)
        at org.cactoos.func.FuncOf.lambda$new$3(FuncOf.java:88)
        at org.cactoos.func.FuncOf.apply(FuncOf.java:104)
        at org.cactoos.scalar.And.lambda$null$0(And.java:101)
        at org.cactoos.scalar.And.value(And.java:127)
        at org.cactoos.scalar.And.value(And.java:52)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        ... 3 more
Caused by: java.io.FileNotFoundException: /tmp/java-bullshifier/output/ProjAhgodwwubpj/build/tmp/fatjar-stage/ch/qos/logback/core/LogbackException.class (Too many open files)
        at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:195)
        at java.io.FileInputStream.<init>(FileInputStream.java:138)
        at org.jpeek.metrics.JavassistClasses.lambda$metrics$2(JavassistClasses.java:132)
        at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
        at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:59)
        ... 18 more

link to GitHub

Let's add GitHub link to those repos, which have that in their .pom files. When we download artifact in Reports, we should pay attention to the .pom file inside. If it contains the link to GitHub repo, in its /project/scm/url -- we should call App with an additional parameter: github, equal to the repository name. Later, we will use this param in XSL processing, to point classes to their sources.

Also, let's send /project/version in version parameter.

badge

Let's implement it.

running out of memory

Heroku logs:

2017-11-06T15:16:08.710384+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:16:31.142395+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:16:31.142499+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:16:52.583138+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:16:52.583189+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:17:14.414977+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:17:14.415136+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:17:36.968745+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:17:36.968940+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:17:59.260627+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:17:59.260845+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:18:20.801884+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:18:20.801884+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:18:42.533605+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:18:42.533660+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:19:05.481493+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:19:05.481529+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2017-11-06T15:19:27.573072+00:00 heroku[web.1]: Process running mem=594M(109.6%)
2017-11-06T15:19:27.573248+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)

We seem to be leaking memory resources somewhere. Let's investigate and fix.

LCOM

Let's implement LCOM cohesion metric.

S. R. Chidamber and C. F. Kemerer, A metrics suite for object oriented design. IEEE Transactions on Software Engineering, vol.20, no.6, 1994.

http://www.pitt.edu/~ckemerer/CK%20research%20papers/MetricForOOD_ChidamberKemerer94.pdf

Shyam R. Chidamber, Chris F. Kemerer. A Metrics suite for Object Oriented design. M.I.T. Sloan School of Management E53-315. 1993. http://uweb.txstate.edu/~mg43/CS5391/Papers/Metrics/OOMetrics.pdf

Victor Basili, Lionel Briand and Walcelio Melo. A Validation of Object-Oriented Design Metrics as Quality Indicators. IEEE Transactions on Software Engineering. Vol. 22, No. 10, October 1996. http://www.cs.umd.edu/users/basili/publications/journals/J60.pdf

Bindu S. Gupta: A Critique of Cohesion Measures in the Object-Oriented Paradigm. Master of Science Thesis. Michigan Technological University, Department of Computer Science. 1997.

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0

java.io.IOException: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.io.UncheckedIOException: java.io.IOException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at org.cactoos.func.IoCheckedBiFunc.apply(IoCheckedBiFunc.java:74)
	at org.jpeek.web.TkReport.act(TkReport.java:74)
	at org.takes.facets.fork.FkRegex.route(FkRegex.java:209)
	at org.takes.facets.fork.FkChain.route(FkChain.java:75)
	at org.takes.facets.fork.TkFork.act(TkFork.java:100)
	at org.takes.facets.forward.TkForward.act(TkForward.java:68)
	at org.takes.tk.TkWrap.act(TkWrap.java:61)
	at org.takes.http.BkBasic.print(BkBasic.java:108)
	at org.takes.http.BkBasic.accept(BkBasic.java:84)
	at org.takes.http.BkSafe$1.accept(BkSafe.java:51)
	at org.takes.http.BkWrap.accept(BkWrap.java:52)
	at org.takes.http.BkTimeable.accept(BkTimeable.java:89)
	at org.takes.http.BkParallel$1$1.run(BkParallel.java:89)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.IllegalStateException: java.util.concurrent.ExecutionException: java.io.UncheckedIOException: java.io.IOException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at org.jpeek.web.AsyncReports.apply(AsyncReports.java:86)
	at org.jpeek.web.AsyncReports.apply(AsyncReports.java:54)
	at org.cactoos.func.IoCheckedBiFunc.apply(IoCheckedBiFunc.java:66)
	... 15 more
Caused by: java.util.concurrent.ExecutionException: java.io.UncheckedIOException: java.io.IOException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.concurrent.FutureTask.report(FutureTask.java:122)
	at java.util.concurrent.FutureTask.get(FutureTask.java:192)
	at org.jpeek.web.AsyncReports.apply(AsyncReports.java:84)
	... 17 more
Caused by: java.io.UncheckedIOException: java.io.IOException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:61)
	at org.cactoos.iterator.Mapped.next(Mapped.java:70)
	at org.cactoos.iterable.Joined.iterator(Joined.java:68)
	at org.cactoos.collection.Joined.iterator(Joined.java:97)
	at org.xembly.Directives.append(Directives.java:250)
	at org.jpeek.Index.value(Index.java:72)
	at org.jpeek.App.analyze(App.java:135)
	at org.jpeek.web.Reports.apply(Reports.java:136)
	at org.jpeek.web.Reports.apply(Reports.java:49)
	at org.jpeek.web.Futures.lambda$apply$0(Futures.java:72)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at com.jcabi.log.VerboseThreads$Wrap.run(VerboseThreads.java:220)
	... 1 more
Caused by: java.io.IOException: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:74)
	at org.cactoos.func.UncheckedFunc.apply(UncheckedFunc.java:59)
	... 14 more
Caused by: java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.LinkedList.checkElementIndex(LinkedList.java:555)
	at java.util.LinkedList.get(LinkedList.java:476)
	at org.cactoos.list.Sorted.get(Sorted.java:185)
	at org.jpeek.Index.metric(Index.java:118)
	at org.cactoos.func.IoCheckedFunc.apply(IoCheckedFunc.java:66)
	... 15 more

OCC

Let's implement OCC cohesion metric.

H. Aman, K. Yamasaki, H. Yamada, and M.-T. Noda, “A proposal
of class cohesion metrics using sizes of cohesive parts,” in Proc. of
Fifth Joint Conference on Knowledge-based Software Engineering,
2002, pp. 102–107.

https://www.researchgate.net/profile/Hirohisa_Aman/publication/268046583_A_Proposal_of_Class_Cohesion_Metrics_Using_Sizes_of_Cohesive_Parts/links/5729ca4b08ae057b0a060fa6/A-Proposal-of-Class-Cohesion-Metrics-Using-Sizes-of-Cohesive-Parts.pdf

skeleton

Let's create a skeleton. I'll do it.

integration testing is absent

Let's add integration testing phase to make sure our JAR actually works with an external code base. Let's use maven-invoker-plugin.

sentry

Let's connect it to Sentry

NHD

Let's implement NHD cohesion metric.

S. Counsell, S. Swift, and J. Crampton, “The interpretation
and utility of three cohesion metrics for object-oriented design,”
ACM Transactions on Software Engineering and Methodology
(TOSEM), vol. 15, no. 2, pp. 123–149, 2006.

PDF: https://www.researchgate.net/profile/Stephen_Swift/publication/220403868_The_interpretation_and_utility_of_three_cohesion_metrics_for_object-oriented_design/links/00b7d52d0fc90cb989000000/The-interpretation-and-utility-of-three-cohesion-metrics-for-object-oriented-design.pdf

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.