Showing 124 of 206 total issues
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;
MapEditor
has 40 methods (exceeds 20 allowed). Consider refactoring. Open
public class MapEditor extends BaseScene implements InputProcessor {
public static final float BB_THICKNESS = 0.05f; // Bounding box thickness of lines
// TODO: move this with other scenes, and probably extend the WorldScene to reduce code duplication.
private static final float AXIS_POLE_LENGTH = 10000.0f;
private static final float MOVE_SPEED = 300.0f;
Method initMenuBar
has 125 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initMenuBar(final World world) {
MenuBar menuBar = new MenuBar();
final VisTable table = (VisTable) menuBar.getTable();
table.setWidth(MENU_BAR_WIDTH);
table.setHeight(MENU_BAR_HEIGHT);
File MapEditor.java
has 374 lines of code (exceeds 250 allowed). Consider refactoring. Open
package io.github.emergentorganization.cellrpg.tools.mapeditor;
import com.artemis.Aspect;
import com.artemis.ComponentMapper;
import com.artemis.Entity;
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)
- Read upRead up
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 initUI
has 104 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void initUI() {
Skin s = pt.getUISkin();
Table table = new Table(s);
table.row();
File EditorWindow.java
has 335 lines of code (exceeds 250 allowed). Consider refactoring. Open
package io.github.emergentorganization.cellrpg.tools.mapeditor.ui;
import com.artemis.Entity;
import com.artemis.World;
import com.badlogic.gdx.Gdx;
Method handleOutputNode
has a Cognitive Complexity of 27 (exceeds 5 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;
- Read upRead up
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
CAGridComponents
has 27 methods (exceeds 20 allowed). Consider refactoring. Open
public class CAGridComponents extends Component {
private static final int OFF_SCREEN_PIXELS = 200; // number of pixels off screen edge to run CA grid
private final Logger logger = LogManager.getLogger(getClass());
public long TIME_BTWN_GENERATIONS = 100; // ms time in between generation() calls
public final float SCALE = .025f; // empirically derived constant... why is it this? idk...
Method appendEquipmentCard
has 79 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void appendEquipmentCard(final Equipment equipm, final EnergyLevel energyLevel) {
// TODO: set color of card based on equipm.type
final VisTable cardContainer = new VisTable();
cardContainer.addSeparator(true);
Method process
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void process(Entity player) {
Preferences prefs = GameSettings.getPreferences();
int pathDrawRadius = prefs.getInteger(GameSettings.KEY_WEAPON_PATHDRAW_RADIUS);
- Read upRead up
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 generate
has a Cognitive Complexity of 21 (exceeds 5 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++) {
- Read upRead up
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 getNextWarpIn
has 72 lines of code (exceeds 25 allowed). Consider refactoring. Open
private iRegion getNextWarpIn() {
EntityID[] ents = new EntityID[]{};
int[] entCounts = new int[]{};
int[][][] shapes = new int[][][]{};
int[] shapeCounts = new int[]{};
Method testTicksPropagateStrengthForActiveNodes
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Test
public void testTicksPropagateStrengthForActiveNodes() throws Exception {
logger.info("running DGRN signal propagation test...");
DGRN dgrn = getMockDGRN();
GraphInitializer.buildLightenCellTestGraph(dgrn);
EditorWindow
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
public class EditorWindow {
private static final float LEFT_PANEL_HEIGHT = Gdx.graphics.getHeight();
private static final float LEFT_PANEL_WIDTH = Gdx.graphics.getWidth() / 8f;
private static final float MENU_BAR_HEIGHT = Gdx.graphics.getHeight() / 19f;
private static final float MENU_BAR_WIDTH = Gdx.graphics.getWidth() - LEFT_PANEL_WIDTH;
Method handlePath
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
private void handlePath(
InputComponent inComp,
Vector2 pos,
Camera camera
) {
- Read upRead up
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 handleContactPair
has a Cognitive Complexity of 20 (exceeds 5 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;
- Read upRead up
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 processLayer
has a Cognitive Complexity of 18 (exceeds 5 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>();
- Read upRead up
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 render
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
@Override
public void render(FrameBuffer frameBuffer) {
Texture cb = frameBuffer.getColorBufferTexture();
TextureRegion fboRegion = new TextureRegion(cb, 0, 0, cb.getWidth(), cb.getHeight());
fboRegion.flip(false, true); // FBO uses lower left, TextureRegion uses upper-left