EmergentOrganization/cell-rpg

View on GitHub

Showing 124 of 206 total issues

Method handleDrawing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void handleDrawing(Vector2 playerPos, InputComponent incComp, Vector2 mouse) {
        Preferences prefs = GameSettings.getPreferences();
        int pathDrawRadius = prefs.getInteger(GameSettings.KEY_WEAPON_PATHDRAW_RADIUS);

        incComp.moveState = MoveState.PATH_FOLLOW;

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void generate(CAGridComponents gridComps) {
        gridComps.cellCount = 0;
        for (int i = 0; i < gridComps.states.length; i++) {
            for (int j = 0; j < gridComps.states[0].length; j++) {
                int newState = util.ca_rule(i, j, gridComps);

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

    private static void _shootTo(Vector2 pos, Entity shooter, EventManager eventMan, EntityFactory entFact, Weapon weapon) {
        if (weapon == null) {
            eventMan.pushEvent(new EntityEvent(EntityEvent.NO_ENTITY, GameEvent.PLAYER_WEAPON_EMPTY));
            return;
        }

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

    private void adjustCASpawns(int score, Entity player) {
        SpontaneousGenerationList genList = player.getComponent(SpontaneousGenerationList.class);
        genList.frequency = getCASpawnFreq(score);
        setCASpawnLayers(genList, score);
        if (score > 1000 * SCL) {

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

Severity
Category
Status
Source
Language