Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with CCM metric addition #522

Open
User123363 opened this issue May 6, 2021 · 4 comments · May be fixed by #548
Open

Problem with CCM metric addition #522

User123363 opened this issue May 6, 2021 · 4 comments · May be fixed by #548

Comments

@User123363
Copy link

User123363 commented May 6, 2021

The problem with CCM metrics was found in the file "org/jpeek/metrics/CCM.xsl" in line 65 the variable 'ncc' is assigned the number of methods connected by edges, but^ according to the definition NCC is the number of connectivity components in a graph.

Definition of graph component - https://en.wikipedia.org/wiki/Component_(graph_theory)

An example implementation of an algorithm for finding connectivity components in a graph - https://www.geeksforgeeks.org/connected-components-in-an-undirected-graph/

The class on which the metric works in error:

public class Worker {

    String name;

    public void one() {
        name = "1";
    }

    public void two() {
        name = "2";
    }

    public void three() {
        name = "3";
    }

    public void four() {
        name = "4";
    }

    public void five() {
        name = "5";
    }

}

Снимок экрана 2021-05-06 в 16 08 32

In the above example you can see that all 5 methods are one connectivity component, however, jpeek says that NCC = 5, so we can conclude that instead of connectivity components he counts the number of connected methods.

According to the definition of CCM, the class given as an example should get a score of 1 because:

Снимок экрана 2021-05-06 в 16 13 26

Indeed, if we calculate the connectivity components of the graph from the example, then NCC = 1, substituting the correct value in the formula:

Снимок экрана 2021-05-06 в 16 14 52

The CCM metric will be 1, this will be the correct answer.

@0crat 0crat added the 0crat/new label May 6, 2021
@starkda
Copy link
Contributor

starkda commented Mar 14, 2024

@yegor256 i want to take that issue. Do you think implementing dfs inside xsl file is a good approach?

@yegor256
Copy link
Member

@starkda you can try. Indeed, implementing all metrics in XSL is what this project is about. Only if it's absolutely impossible to do so, we resort to Java.

@starkda
Copy link
Contributor

starkda commented Mar 15, 2024

@yegor256 now i am quite confident that using java is the only applicable approach.
What i want to do is to append information about connectivity components to the end skeleton.xml after it is generated so ccm.xsl would capture it. What do you think?

@yegor256
Copy link
Member

@starkda let's try!

pnatashap added a commit to pnatashap/jpeek that referenced this issue Mar 23, 2024
pnatashap added a commit to pnatashap/jpeek that referenced this issue Mar 23, 2024
…rror while instrumenting java/sql/Date with JaCoCo 0.8.8.202204050719/5dcf34a)
pnatashap added a commit to pnatashap/jpeek that referenced this issue Mar 23, 2024
@starkda starkda mentioned this issue Apr 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants