Showing 124 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;
- 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 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());
- 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 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();
- 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 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 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 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()) {
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 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 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 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 arcadeGameWorld
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static World arcadeGameWorld(PixelonTransmission pt,
SpriteBatch batch, Stage stage, EntityFactory entityFactory) {
WorldConfiguration wc = new WorldConfiguration();
wc.register(entityFactory);
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 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()) {
- 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 applyCollision
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private void applyCollision(final int entityId, CAInteraction inter, BaseCell cell, Vector2 pos) {
// impact the CA
int state = cell.state; // copy int here to avoid concurrency issue
if (state > 0) {
logger.trace("colliding w/ state " + state);
- 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 get3dKernelizedValue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
private float get3dKernelizedValue(final int[][][] kernel, final int row, final int col, final int size, CAGridComponents gridComps) {
// returns value from applying the kernel matrix to the given neighborhood
// 3rd dimension of the kernel is state-space (ie, kernel[x][y][state])
final boolean SKIP_SELF = true;
- 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 handlePath
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
private void handlePath(
InputComponent inComp,
Vector2 pos,
Camera camera
) {