EmergentOrganization/cell-rpg

View on GitHub
core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java

Summary

Maintainability
D
2 days
Test Coverage

File EntityFactory.java has 407 lines of code (exceeds 250 allowed). Consider refactoring.
Open

package io.github.emergentorganization.cellrpg.core.entityfactory;

import com.artemis.Archetype;
import com.artemis.ArchetypeBuilder;
import com.artemis.Entity;

    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:

      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)

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

            public void addCALayers(Vector2 pos, int playerID) {
                logger.info("adding CA layers");
                // adds all ca layer entities to the scene.
                Camera camera = world.getSystem(CameraSystem.class).getGameCamera();
        
        

          Method createGosper has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private int createGosper(Vector2 pos) {
                  Entity playerEnt = tagManager.getEntity(Tags.PLAYER);
                  Entity ent = new EntityBuilder(world, npc, "glider gun that shoots @ target", EntityID.GOSPER.toString(), pos)
                          .angle(90)
                          .addBuilder(new VisualBuilder()

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

                    Entity puffer = new EntityBuilder(world, npc, "vyrapuffer", EntityID.VYRAPUFFER.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .animation(Resources.ANIM_VYRAPUFFER, Animation.PlayMode.LOOP_PINGPONG, 0.7f)
                                    .renderIndex(RenderIndex.NPC)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 352..363

            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 68.

            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

                    Entity ent = new EntityBuilder(world, npc, "pond still life which chases player", EntityID.PONDBOMB.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                .animation(Resources.ANIM_PONDBOMB, Animation.PlayMode.LOOP, .1f)
                                .renderIndex(RenderIndex.NPC)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 282..293

            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 68.

            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 5 locations. Consider refactoring.
            Open

                private int createVyroidBeacon(Vector2 pos, float angleDeg) {
                    Entity bldg = new EntityBuilder(world, collidable, "Vyroid Beacon", EntityID.VYROID_BEACON.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_VYROID_BEACON)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 154..166
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 168..181
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 183..195
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 197..209

            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 67.

            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 5 locations. Consider refactoring.
            Open

                private int createRiftTwo(Vector2 pos, float angleDeg) {
                    Entity bldg = new EntityBuilder(world, collidable, "Rift2", EntityID.RIFT_TWO.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_RIFT_TWO)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 154..166
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 168..181
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 183..195
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 211..223

            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 67.

            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 5 locations. Consider refactoring.
            Open

                private int createBuildingLargeOne(Vector2 pos, float angleDeg) {
                    Entity bldg = new EntityBuilder(world, collidable, "Large Building", EntityID.BUILDING_LARGE_ONE.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_BLDG_LRG_ONE)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 168..181
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 183..195
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 197..209
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 211..223

            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 67.

            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 5 locations. Consider refactoring.
            Open

                private int createBuildingRoundOne(Vector2 pos, float angleDeg) {
                    // TODO: Tie GridSeed component to this somehow
                    Entity bldg = new EntityBuilder(world, collidable, "Round Building", EntityID.BUILDING_ROUND_ONE.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_BLDG_ROUND_ONE)
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 154..166
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 183..195
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 197..209
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 211..223

            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 67.

            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 5 locations. Consider refactoring.
            Open

                private int createRiftOne(Vector2 pos, float angleDeg) {
                    Entity bldg = new EntityBuilder(world, collidable, "Rift1", EntityID.RIFT_ONE.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_RIFT_ONE)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 154..166
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 168..181
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 197..209
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 211..223

            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 67.

            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

                    final Entity powerup = new EntityBuilder(world, collectable, "star powerup", EntityID.POWERUP_STAR.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_POWERUP_STAR)
                                    .renderIndex(RenderIndex.BULLET)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 237..244

            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 56.

            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

                    Entity powerup = new EntityBuilder(world, collectable, "plus powerup", EntityID.POWERUP_PLUS.toString(), pos)
                            .addBuilder(new VisualBuilder()
                                    .texture(Resources.TEX_POWERUP_PLUS)
                                    .renderIndex(RenderIndex.BULLET)
                            )
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/EntityFactory.java on lines 260..267

            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 56.

            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

                                    new CAInteraction()
                                            // vyroid damage
                                            .addCollisionImpactStamp(1, CGoLShapeConsts.BOOM(10, 10), energyLayer.getId())
                                            .addCollisionImpactStamp(1, CGoLShapeConsts.EMPTY(10, 10), vyroidLayer.getId())
                                            .addEventTrigger(1, GameEvent.PLAYER_HIT)
            core/src/io/github/emergentorganization/cellrpg/core/entityfactory/Entities/Bullet.java on lines 83..86

            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 42.

            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

            There are no issues that match your filters.

            Category
            Status