EmergentOrganization/cell-rpg

View on GitHub

Showing 206 of 206 total issues

Method getLiveParentsOf has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    private ArrayList<GeneticCell> getLiveParentsOf(int row, int col, int neighborhoodSize, CAGridComponents gridComps) {
        // returns list of live cells surrounding cell
        // size must be odd!
        ArrayList<GeneticCell> parents = new ArrayList<GeneticCell>();
        final boolean SKIP_SELF = true;

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

Method testActivationPropagation has 51 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    @Test
    public void testActivationPropagation() throws Exception {
        TestCell2 cell_builder = new TestCell2();
        logger.debug("cell builder:" + cell_builder);
        GeneticCell testCell = new GeneticCell(1, cell_builder);

    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 unpackAssets has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          public void unpackAssets() {
              URL url = PixelonTransmission.class.getProtectionDomain().getCodeSource().getLocation();
              logger.info("copying assets...");
              logger.trace("URL:" + url);
              logger.trace("ext:" + Gdx.files.getExternalStoragePath());

      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

      Method handleInput has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          private void handleInput() {
              if (mapInputEnabled) {
                  boolean update = false;
      
                  final float speed = MOVE_SPEED * gameCamera.zoom * Gdx.graphics.getDeltaTime();

      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

      Method unpackAssets has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public void unpackAssets() {
              URL url = PixelonTransmission.class.getProtectionDomain().getCodeSource().getLocation();
              logger.info("copying assets...");
              logger.trace("URL:" + url);
              logger.trace("ext:" + Gdx.files.getExternalStoragePath());

        Method handleContactPair has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private void handleContactPair(Entity entityA, Name nameA, Entity entityB, Name nameB) {
                // collision damage form A to B
                if (entityA.getComponent(CollideEffect.class) != null
                        && entityB.getComponent(Health.class) != null) {
                    entityB.getComponent(Health.class).health -= entityA.getComponent(CollideEffect.class).damage;

          Method process has 45 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              @Override
              public void process(Entity player) {
                  Preferences prefs = GameSettings.getPreferences();
                  int pathDrawRadius = prefs.getInteger(GameSettings.KEY_WEAPON_PATHDRAW_RADIUS);
          
          

            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()) {

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
              
              import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
              import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCellTest;
              import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
              core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/TestCell2.java on lines 1..32

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 115.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
              
              import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
              import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCellTest;
              import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
              core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/TestCell1.java on lines 1..32

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 115.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Method createEntityByID has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public int createEntityByID(EntityID id, Vector2 pos, float angleDeg) {
                      // angleDeg: angle relative to +x axis
                      try {
                          switch (id) {
                              case BULLET:

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
                
                import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
                import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
                import it.uniroma1.dis.wsngroup.gexf4j.core.Node;
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/AgeDarkener.java on lines 1..31
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrGreen.java on lines 1..33
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrRed.java on lines 1..34

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 111.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
                
                import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
                import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
                import it.uniroma1.dis.wsngroup.gexf4j.core.Node;
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrBlue.java on lines 1..33
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrGreen.java on lines 1..33
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrRed.java on lines 1..34

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 111.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
                
                import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
                import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
                import it.uniroma1.dis.wsngroup.gexf4j.core.Node;
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/AgeDarkener.java on lines 1..31
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrBlue.java on lines 1..33
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrRed.java on lines 1..34

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 111.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                package io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.GeneticCellBuilders;
                
                import io.github.emergentorganization.cellrpg.systems.CASystems.CAs.CACell.GeneticCell;
                import io.github.emergentorganization.cellrpg.systems.CASystems.GeneticCells.DGRN4j.DGRN;
                import it.uniroma1.dis.wsngroup.gexf4j.core.Node;
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/AgeDarkener.java on lines 1..31
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrBlue.java on lines 1..33
                core/src/io/github/emergentorganization/cellrpg/systems/CASystems/GeneticCells/GeneticCellBuilders/MrGreen.java on lines 1..33

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 111.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Method initLoadWindow has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    private void initLoadWindow() {
                        final float PADDING = 2f;
                
                        loadWindow.setWidth(SAVE_WINDOW_WIDTH);
                        loadWindow.setHeight(SAVE_WINDOW_HEIGHT);

                  Method makeMenuTable has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      private Table makeMenuTable() {
                          Table table = new Table(skin);
                          table.row();
                          // main menu
                          {

                    Method addMenuTableButtons has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private void addMenuTableButtons() {
                            // set up menu buttons:
                            VisLabel controlTypeLabel = new VisLabel("weapon control scheme");
                            menuTable.add(controlTypeLabel).pad(0f, 0f, 5f, 0f).fill(true, false).row();
                            PlayerInputProcessor playInProc = world.getSystem(InputSystem.class).getPlayerInputProcessor();

                      Method createTubSnake has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          private int createTubSnake(Vector2 pos) {
                              Entity ent = new EntityBuilder(world, npc, "tub still life with snake behavior", EntityID.TUBSNAKE.toString(), pos)
                                      .addBuilder(new VisualBuilder()
                                              .texture(Resources.TEX_TUBSNAKE)
                                              .renderIndex(RenderIndex.NPC)
                        Severity
                        Category
                        Status
                        Source
                        Language