jardiacaj/finem_imperii

View on GitHub

Showing 323 of 336 total issues

Function OrbitControls has a Cognitive Complexity of 123 (exceeds 5 allowed). Consider refactoring.
Open

THREE.OrbitControls = function ( object, domElement ) {

    this.object = object;

    this.domElement = ( domElement !== undefined ) ? domElement : document;
Severity: Minor
Found in base/static/base/3rd/OrbitControls.js - About 2 days 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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def test_send_and_mark_read_non_own_message(self):
        message_body = 'Nice to meet you, foobar.'
        response = self.client.post(
            reverse('messaging:compose'),
            data={
Severity: Major
Found in messaging/tests.py and 1 other location - About 2 days to fix
messaging/tests.py on lines 343..364

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 256.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    def test_send_and_mark_favourite_non_own_message(self):
        message_body = 'Nice to meet you, foobar.'
        response = self.client.post(
            reverse('messaging:compose'),
            data={
Severity: Major
Found in messaging/tests.py and 1 other location - About 2 days to fix
messaging/tests.py on lines 320..341

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 256.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function OrbitControls has 425 lines of code (exceeds 25 allowed). Consider refactoring.
Open

THREE.OrbitControls = function ( object, domElement ) {

    this.object = object;

    this.domElement = ( domElement !== undefined ) ? domElement : document;
Severity: Major
Found in base/static/base/3rd/OrbitControls.js - About 2 days to fix

    Function execute has a Cognitive Complexity of 83 (exceeds 5 allowed). Consider refactoring.
    Open

        def execute(self):
            proposal = self.get_proposal_json_content()
            applying_to = self.capability.applying_to
            if self.capability.type == Capability.POLICY_DOCUMENT:
                try:
    Severity: Minor
    Found in organization/models/capability.py - About 1 day 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 BattleRenderer has a Cognitive Complexity of 79 (exceeds 5 allowed). Consider refactoring.
    Open

    function BattleRenderer(battle_data) {
    
        var zis = this;
    
        /* API */
    Severity: Minor
    Found in battle/static/battle/battle_renderer.js - About 1 day 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 create_next_turn has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_next_turn(battle: Battle):
        new_turn = battle.get_latest_turn()
        new_turn.id = None
        new_turn.num += 1
        new_turn.save()
    Severity: Minor
    Found in battle/battle_tick.py - About 1 day 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 BattleRenderer has 226 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function BattleRenderer(battle_data) {
    
        var zis = this;
    
        /* API */
    Severity: Major
    Found in battle/static/battle/battle_renderer.js - About 1 day to fix

      Function MapRenderer has 209 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function MapRenderer(world_data) {
      
          var zis = this;
      
          /* API */
      Severity: Major
      Found in world/static/world/world_renderer.js - About 1 day to fix

        File tests.py has 501 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from django.contrib import auth
        from django.contrib.auth.models import User
        from django.test import TestCase
        from django.urls.base import reverse
        
        
        Severity: Major
        Found in messaging/tests.py - About 1 day to fix

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              def test_non_matching_passwords(self):
                  response = self.client.post(
                      reverse('account:register'),
                      {
                          'username': 'Bob',
          Severity: Major
          Found in account/tests.py and 2 other locations - About 1 day to fix
          account/tests.py on lines 44..58
          account/tests.py on lines 60..74

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 122.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              def test_duplicate_username(self):
                  response = self.client.post(
                      reverse('account:register'),
                      {
                          'username': 'Alice',
          Severity: Major
          Found in account/tests.py and 2 other locations - About 1 day to fix
          account/tests.py on lines 60..74
          account/tests.py on lines 76..90

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 122.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 3 locations. Consider refactoring.
          Open

              def test_duplicate_email(self):
                  response = self.client.post(
                      reverse('account:register'),
                      {
                          'username': 'Alice2000',
          Severity: Major
          Found in account/tests.py and 2 other locations - About 1 day to fix
          account/tests.py on lines 44..58
          account/tests.py on lines 76..90

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 122.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          File OrbitControls.js has 497 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /**
           * @author qiao / https://github.com/qiao
           * @author mrdoob / http://mrdoob.com
           * @author alteredq / http://alteredqualia.com/
           * @author WestLangley / http://github.com/WestLangley
          Severity: Minor
          Found in base/static/base/3rd/OrbitControls.js - About 7 hrs to fix

            File capability.py has 484 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import json
            
            from django.db import models
            from django.urls import reverse
            
            
            Severity: Minor
            Found in organization/models/capability.py - About 7 hrs to fix

              Function get_target_distance_function has a Cognitive Complexity of 49 (exceeds 5 allowed). Consider refactoring.
              Open

              def get_target_distance_function(battle_contubernium_in_turn: BattleContuberniumInTurn):
                  order = battle_contubernium_in_turn.battle_unit_in_turn.battle_unit.get_order()
                  enemy_contubernia = BattleContuberniumInTurn.objects.filter(
                      battle_turn=battle_contubernium_in_turn.battle_turn
                  ).exclude(
              Severity: Minor
              Found in battle/battle_tick.py - About 7 hrs 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 MapRenderer has a Cognitive Complexity of 46 (exceeds 5 allowed). Consider refactoring.
              Open

              function MapRenderer(world_data) {
              
                  var zis = this;
              
                  /* API */
              Severity: Minor
              Found in world/static/world/world_renderer.js - About 7 hrs 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

              File models.py has 440 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import math
              
              from django.contrib.auth.models import User
              from django.db import models, transaction
              
              
              Severity: Minor
              Found in character/models.py - About 6 hrs to fix

                File battle_tick.py has 432 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import math
                import random
                
                import django
                from django.db import transaction
                Severity: Minor
                Found in battle/battle_tick.py - About 6 hrs to fix

                  Identical blocks of code found in 2 locations. Consider refactoring.
                  Open

                      def setUp(self):
                          # create one user for convenience
                          response = self.client.post(
                              reverse('account:register'),
                              {
                  Severity: Major
                  Found in account/tests.py and 1 other location - About 6 hrs to fix
                  account/tests.py on lines 98..112

                  Duplicated Code

                  Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                  Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                  When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                  Tuning

                  This issue has a mass of 102.

                  We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                  The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                  If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                  See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                  Refactorings

                  Further Reading

                  Severity
                  Category
                  Status
                  Source
                  Language