Showing 10,536 of 10,536 total issues

File spaceenergyitem.py has 549 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
from datetime import datetime, timedelta, timezone
from decimal import Decimal
import falcon
import mysql.connector
Severity: Major
Found in myems-api/reports/spaceenergyitem.py - About 1 day to fix

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

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['energy_item']['id'],))
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793

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

    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 10 locations. Consider refactoring.
    Open

            if master_meter_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_meters "
                               " WHERE id = %s ",
                               (new_values['data']['master_meter_id'],))
    Severity: Major
    Found in myems-api/core/meter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['energy_item']['id'],))
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if master_meter_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_meters "
                               " WHERE id = %s ",
                               (new_values['data']['master_meter_id'],))
    Severity: Major
    Found in myems-api/core/meter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/offlinemeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/meter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/virtualmeter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 221..236
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 10 locations. Consider refactoring.
    Open

            if energy_item_id is not None:
                cursor.execute(" SELECT name, energy_category_id "
                               " FROM tbl_energy_items "
                               " WHERE id = %s ",
                               (new_values['data']['energy_item_id'],))
    Severity: Major
    Found in myems-api/core/meter.py and 9 other locations - About 1 day to fix
    myems-api/core/meter.py on lines 239..254
    myems-api/core/meter.py on lines 783..798
    myems-api/core/meter.py on lines 801..816
    myems-api/core/offlinemeter.py on lines 187..202
    myems-api/core/offlinemeter.py on lines 600..615
    myems-api/core/offlinemeter.py on lines 831..846
    myems-api/core/virtualmeter.py on lines 263..278
    myems-api/core/virtualmeter.py on lines 778..793
    myems-api/core/virtualmeter.py on lines 1141..1156

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

    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 combinedequipmentcost.py has 546 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import re
    from datetime import datetime, timedelta, timezone
    from decimal import Decimal
    import falcon
    import mysql.connector
    Severity: Major
    Found in myems-api/reports/combinedequipmentcost.py - About 1 day to fix

      Function $get has 227 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

             function($injector,   $$AnimateRunner,   $$jqLite) {
      
          var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
               // $animateJs(element, 'enter');
          return function(element, event, classes, options) {
      Severity: Major
      Found in myems-admin/js/angular/angular-animate.js - About 1 day to fix

        File angular.integralui.checkbox.min.js has 544 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*
          filename: angular.integralui.checkbox.min.js
          version : 1.4.5
          Copyright � 2014-2018 Lidor Systems. All rights reserved.
        
        
        Severity: Major
        Found in myems-admin/js/jcui/angular.integralui.checkbox.min.js - About 1 day to fix

          File combinedequipmentenergyitem.py has 544 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import re
          from datetime import datetime, timedelta, timezone
          from decimal import Decimal
          import falcon
          import mysql.connector
          Severity: Major
          Found in myems-api/reports/combinedequipmentenergyitem.py - About 1 day to fix

            Function Dial has 225 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                k.Dial = function () {
                    k.o.call(this);
            
                    this.startAngle = null;
                    this.xy = null;
            Severity: Major
            Found in myems-admin/js/plugins/jsKnob/jquery.knob.js - About 1 day to fix

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

                      if status == 'acknowledged':
                          if 'reply' not in new_values['data'].keys() or \
                              not isinstance(new_values['data']['reply'], str) or \
                                  len(str.strip(new_values['data']['reply'])) == 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_REPLY')
              Severity: Major
              Found in myems-api/core/webmessage.py and 1 other location - About 1 day to fix
              myems-api/core/webmessage.py on lines 309..317

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

              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

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

                      if status == 'acknowledged':
                          if 'reply' not in new_values['data'].keys() or \
                                  not isinstance(new_values['data']['reply'], str) or \
                                  len(str.strip(new_values['data']['reply'])) == 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST', description='API.INVALID_REPLY')
              Severity: Major
              Found in myems-api/core/webmessage.py and 1 other location - About 1 day to fix
              myems-api/core/webmessage.py on lines 535..543

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

              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 energystoragepowerstationdetails.py has 541 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import re
              from datetime import datetime, timedelta, timezone, time
              from decimal import Decimal
              import falcon
              import mysql.connector
              Severity: Major
              Found in myems-api/reports/energystoragepowerstationdetails.py - About 1 day to fix

                File equipmentstatistics.py has 540 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import re
                from datetime import datetime, timedelta, timezone
                from decimal import Decimal
                import falcon
                import mysql.connector
                Severity: Major
                Found in myems-api/reports/equipmentstatistics.py - About 1 day to fix
                  Severity
                  Category
                  Status
                  Source
                  Language