jardiacaj/finem_imperii

View on GitHub

Showing 105 of 336 total issues

Avoid too many return statements within this function.
Open

        return render(request, 'account/register.html')
Severity: Major
Found in account/views.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    if ( state !== STATE.TOUCH_DOLLY ) return; // is this needed?...
    Severity: Major
    Found in base/static/base/3rd/OrbitControls.js - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return capability_success(capability, request)
      Severity: Major
      Found in organization/views/diplomacy.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                        if ( scope.enablePan === false ) return;
        Severity: Major
        Found in base/static/base/3rd/OrbitControls.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                  return redirect(character.activation_url)
          Severity: Major
          Found in character/views/creation.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return result
            Severity: Major
            Found in battle/battle_tick.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return result
              Severity: Major
              Found in battle/battle_tick.py - About 30 mins to fix

                Function create_unit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def create_unit(name, owner, location, soldiers, recruitment_type, unit_type):
                    orders = Order.objects.create(what=Order.STAND)
                
                    unit = WorldUnit.objects.create(
                        owner_character=owner,
                Severity: Minor
                Found in unit/creation.py - About 25 mins to fix

                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

                Function check_if_order_done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def check_if_order_done(battle_unit_in_turn: BattleUnitInTurn):
                    order = battle_unit_in_turn.battle_unit.get_order()
                    if order:
                        if order.what == Order.MOVE:
                            if euclidean_distance(battle_unit_in_turn.coordinates(), order.target_location_coordinates()) == 0:
                Severity: Minor
                Found in battle/battle_tick.py - About 25 mins to fix

                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

                Function opponents_in_organization_list has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def opponents_in_organization_list(organizations, tile):
                    potential_conflicts = []
                
                    input_list = list(organizations)
                    while len(input_list):
                Severity: Minor
                Found in turn/battle.py - About 25 mins to fix

                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

                Function coordinate_neighbours has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def coordinate_neighbours(coord: Coordinates):
                    result = []
                    for dx in (-1, 0, 1):
                        for dz in (-1, 0, 1):
                            if not dx == dz == 0:
                Severity: Minor
                Found in battle/battle_tick.py - About 25 mins to fix

                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

                Function unit_breaker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def unit_breaker(value, units):
                    unit = units[0]
                    unit_amount = value // unit.multiplier
                    rest = value % unit.multiplier
                    suffix = ''
                Severity: Minor
                Found in world/templatetags/extra_filters.py - About 25 mins to fix

                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

                Function present_candidacy_capability_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def present_candidacy_capability_view(request, capability_id):
                    capability = get_object_or_404(
                        Capability, id=capability_id, type=Capability.CANDIDACY)
                
                    election = capability.applying_to.current_election
                Severity: Minor
                Found in organization/views/elections.py - About 25 mins to fix

                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

                Function military_stance_capability_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def military_stance_capability_context(request, capability, context):
                    if capability.applying_to.violence_monopoly:
                        context['states'] = []
                        for state in capability.applying_to.world.get_violence_monopolies():
                            if state == capability.applying_to:
                Severity: Minor
                Found in organization/views/capability.py - About 25 mins to fix

                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

                Function unit_attack_melee has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def unit_attack_melee(contubernium: BattleContuberniumInTurn,
                                      target_contubernium: BattleContuberniumInTurn):
                    for soldier in contubernium.battlesoldierinturn_set.all():
                        target_soldier = random.choice(
                            target_contubernium.battlesoldierinturn_set.all()[:]
                Severity: Minor
                Found in battle/battle_tick.py - About 25 mins to fix

                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

                Function diplomacy_capability_context has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def diplomacy_capability_context(request, capability, context):
                    if capability.applying_to.violence_monopoly:
                        context['states'] = []
                        for state in capability.applying_to.world.get_violence_monopolies():
                            if state == capability.applying_to:
                Severity: Minor
                Found in organization/views/capability.py - About 25 mins to fix

                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

                Function joining_contubernium_position_generator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def joining_contubernium_position_generator():
                    for z in range(30, 48):
                        for x in range(20):
                            for multiplier in (-1, 1):
                                yield Coordinates(x=x*multiplier, z=z)
                Severity: Minor
                Found in battle/battle_init.py - About 25 mins to fix

                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

                Function ability_roll has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def ability_roll(self):
                        if self.wound_status == BattleSoldierInTurn.MEDIUM_WOUND:
                            if random.getrandbits(3) == 0:
                                self.able = False
                                self.save()
                Severity: Minor
                Found in world/models/npcs.py - About 25 mins to fix

                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

                Function conquest_capability_view has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def conquest_capability_view(request, capability_id):
                    capability = get_object_or_404(
                        Capability, id=capability_id, type=Capability.CONQUEST)
                    tile_to_conquer = get_object_or_404(
                        Tile,id=request.POST.get('tile_to_conquest_id'))
                Severity: Minor
                Found in organization/views/conquest.py - About 25 mins to fix

                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

                Function build_population_query_from_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                def build_population_query_from_request(request, location):
                    args = {}
                    for arg_name, arg_type in flag_types.items():
                        arg = []
                        for arg_element in arg_type:
                Severity: Minor
                Found in unit/creation.py - About 25 mins to fix

                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