cqfn / jpeek

Hosted and command-line calculator of cohesion metrics for Java code
https://i.jpeek.org
MIT License
209 stars 81 forks source link

Fixed CCM metric and added general calculation methodology #526

Closed iMaks99 closed 8 months ago

iMaks99 commented 3 years ago

Fixed tests for CCM of classes Foo and TwoCommonAttributes. explanation of test fix. 1) Foo class has 2 methods, both of them access attribute name. This means that NC number of connected methods is 1, NCC is also 1, NMP between 2 methods is 1. Value will be 1. 2) TwoCommonAttributes class has 3 methods. None of pairs of methods call or access common method or attribute. NC is 0. NCC is equal 3. NMP between 3 methods is 3. Value will be 0. CCM metric can not have NaN values if number of methods more than 1.

iMaks99 commented 3 years ago

We found 2 types of errors. One of them is in our code, we are fixing it. And another is

BUILD com.jcabi.xml.StrictXML: 1 XML validation error(s): -1:-1: cvc-identity-constraint.4.1: Duplicate unique value [Lcom4Test] declared for identity constraint "classUnique" of element "package".

We have no idea what can cause this, could you check it?

yegor256 commented 3 years ago

@iMaks99 it's hard to say... BTW, I'm not sure we can merge the code with this design. All our metrics are designed differently. This change to the project will cause serious reconsideration of the overall design. Can't we fix the problem just using XSL, as it's done in other metrics?

iMaks99 commented 3 years ago

@yegor256 sorry for late answer. We, unfortunately, do not have the necessary skills to fix the problem using just XSL-code and ask you to issue the corresponding task to Paolo or some other programmer with experience in developing in this language.