EmergentOrganization/cell-rpg

View on GitHub

Showing 124 of 206 total issues

Method generate has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public void generate(CAGridComponents gridComps) {
        // count up all neighbors
        gridComps.cellCount = 0;
        for (int i = 0; i < gridComps.states.length; i++) {
            for (int j = 0; j < gridComps.states[0].length; j++) {

    Method addInputConfigButtons has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        @Override
        public void addInputConfigButtons(VisTable menuTable, final VisWindow menuWindow) {
            final Preferences prefs = GameSettings.getPreferences();
    
            int pathDrawRadius = prefs.getInteger(GameSettings.KEY_WEAPON_PATHDRAW_RADIUS, PATH_RADIUS_DEFAULT);

      Method standardGameWorld has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public static World standardGameWorld(PixelonTransmission pt,
                                                SpriteBatch batch, Stage stage, EntityFactory entityFactory) {
      
              WorldConfiguration wc = new WorldConfiguration();
              wc.register(entityFactory);

        Method configureWindow has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private static void configureWindow(Preferences prefs, LwjglApplicationConfiguration config)
            {
                String type = prefs.getString(GameSettings.KEY_GRAPHICS_TYPE, "windowed");
                int width = prefs.getInteger(GameSettings.KEY_GRAPHICS_WIDTH, 0);
                int height = prefs.getInteger(GameSettings.KEY_GRAPHICS_HEIGHT, 0);

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

              private void initSaveWindow(final World world) {
                  final float PADDING = 2f;
          
                  saveWindow.setWidth(SAVE_WINDOW_WIDTH);
                  saveWindow.setHeight(SAVE_WINDOW_HEIGHT);

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

              Method getInflowNodeValue has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public int getInflowNodeValue(String key) throws KeySelectorException {
                      int TRUE = 9999;
                      int FALSE = 0;
                      if (key.equals(inflowNodes.ALWAYS_ON)) {
                          return 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 checkForMissingBuilders has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void checkForMissingBuilders(ArrayList<IComponentBuilder> builders, Entity entity, boolean verbose) {
                      Bag<Component> components = entity.getComponents(new Bag<Component>());
                      for (Component component : components) {
                          String cName = component.getClass().getName();
                          if (!verbose && ignoredComponentBuilders.contains(component.getClass())) {

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

                  @Override
                  public boolean touchDragged(final int screenX, final int screenY, final int pointer) {
                      if (mapInputEnabled) {
                          final Vector3 gameVec = gameCamera.unproject(new Vector3(screenX, screenY, 0f));
              
              

              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 layerCompSetup has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  private static void layerCompSetup(CAGridComponents layerComponents, CALayer layerType) {
                      // start out with the default settings
                      layerComponents.stateColorMap = new Color[]{new Color(1f, .2f, .2f, 1f), new Color(1f, .4f, .8f, .8f)};
                      layerComponents.cellSize = 3;
                      layerComponents.cellType = CellType.WITH_HISTORY;

                Method handleOutputNode has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public void handleOutputNode(String key, int value) {
                        // handles special actions caused by outflow nodes
                        //logger.info("taking action " + key + "(" + value + ")");
                        final float COLOR_DELTA = .1f * value;
                        final float tooDark = .2f;

                  Method create has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      @Override
                      public void create() {
                          GLProfiler.enable();
                          GLProfiler.listener = new GLErrorListener() {
                              @Override

                    Method handleInput has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

                      Method build has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          @Override
                          public void build(Entity entity) {
                              super.build(entity);
                      
                              BodyDef bDef = new BodyDef();

                        Method processSystem has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            @Override
                            public void processSystem() {
                                if (currentRegion == null) {  // game just started
                                    // add the static background:
                                    TagManager tagMan = world.getSystem(TagManager.class);

                          Method getMaps has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public FileListNode[] getMaps() {
                                  final File folder = new File(MapTools.FOLDER_ROOT);
                          
                                  if (folder.exists()) {
                                      final File[] files = folder.listFiles();

                          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 readRigidBody has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              private RigidBodyModel readRigidBody(JsonValue bodyElem) {
                                  RigidBodyModel rbModel = new RigidBodyModel();
                                  rbModel.name = bodyElem.getString("name");
                                  rbModel.imagePath = bodyElem.getString("imagePath");
                          
                          

                            Method attachFixture has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public void attachFixture(Body body, String name, FixtureDef fd, float scale) {
                                    RigidBodyModel rbModel = model.rigidBodies.get(name);
                                    if (rbModel == null) throw new RuntimeException("Name '" + name + "' was not found.");
                            
                                    Vector2 origin = vec.set(rbModel.origin).scl(scale);

                              Method processLayer has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  private void processLayer(int entityId, int collidingLayerId, CAInteractionList interList, Vector2 lastPosition,
                                                            final Vector2 currentPostion) {
                                      logger.trace("checking layer");
                                      ArrayList<Integer> collidedStates = new ArrayList<Integer>();
                              
                              

                                Method testAlwaysOnStaysActive has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    @Test
                                    public void testAlwaysOnStaysActive() throws Exception {
                                        GeneticCell testCell = new GeneticCell(1, new TestCell1());
                                        // check activation value
                                        int TF = Integer.parseInt(DGRN.getNodeAttributeValue(
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language