EmergentOrganization/cell-rpg

View on GitHub
core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/DGRN4j/DGRN.java

Summary

Maintainability
C
1 day
Test Coverage

Method inheritGenes has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public void inheritGenes(DGRN parent, int maxAlleles) {
        // inherits genes from given parent assuming parent will represent 1/maxAlleles in genetic material
        //     example: maxAlleles=2 (haploid)
        //      parent_1: gene1(alleles:2), gene2(alleles:1)
        //      patent_2: gene1(alleles:1), gene2(alleles:1), gene3(alleles:1)

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

File DGRN.java has 275 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j;

import it.uniroma1.dis.wsngroup.gexf4j.core.*;
import it.uniroma1.dis.wsngroup.gexf4j.core.data.*;
import it.uniroma1.dis.wsngroup.gexf4j.core.impl.GexfImpl;

    Method inheritGenes has 49 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public void inheritGenes(DGRN parent, int maxAlleles) {
            // inherits genes from given parent assuming parent will represent 1/maxAlleles in genetic material
            //     example: maxAlleles=2 (haploid)
            //      parent_1: gene1(alleles:2), gene2(alleles:1)
            //      patent_2: gene1(alleles:1), gene2(alleles:1), gene3(alleles:1)

      Method tick has 44 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void tick() {
              // computes one cycle through the DGRN
              // propagate signals through network
              HashMap<String, Integer> nodeUpdates = new HashMap<String, Integer>();
              for (Edge edge : graph.getAllEdges()) {

        Method tick has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            public void tick() {
                // computes one cycle through the DGRN
                // propagate signals through network
                HashMap<String, Integer> nodeUpdates = new HashMap<String, Integer>();
                for (Edge edge : graph.getAllEdges()) {

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        There are no issues that match your filters.

        Category
        Status