EmergentOrganization/cell-rpg

View on GitHub
core/src/io/github/emergentorganization/cellrpg/input/player/MovementControls/PathDraw.java

Summary

Maintainability
C
1 day
Test Coverage

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

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

    private void handlePath(
            InputComponent inComp,
            Vector2 pos,
            Camera camera
    ) {

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

        private void handlePath(
                InputComponent inComp,
                Vector2 pos,
                Camera camera
        ) {

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

            private void inputComponentDebugRender(
                    Vector2 playerPos,
                    InputComponent inComp,
                    Vector2 mouse
            ) {

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

        There are no issues that match your filters.

        Category
        Status