Showing 5,781 of 10,536 total issues

File tenantenergycategory.py has 870 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import base64
from core.utilities import get_translation
import os
import re
import uuid
Severity: Major
Found in myems-api/excelexporters/tenantenergycategory.py - About 2 days to fix

    File combinedequipmentcarbon.py has 869 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import base64
    from core.utilities import get_translation
    import os
    import re
    import uuid
    Severity: Major
    Found in myems-api/excelexporters/combinedequipmentcarbon.py - About 2 days to fix

      File combinedequipmentcost.py has 868 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import base64
      from core.utilities import get_translation
      import os
      import re
      import uuid
      Severity: Major
      Found in myems-api/excelexporters/combinedequipmentcost.py - About 2 days to fix

        File spacecarbon.py has 867 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import base64
        from core.utilities import get_translation
        import os
        import re
        import uuid
        Severity: Major
        Found in myems-api/excelexporters/spacecarbon.py - About 2 days to fix

          File spacecost.py has 867 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import base64
          from core.utilities import get_translation
          import os
          import re
          import uuid
          Severity: Major
          Found in myems-api/excelexporters/spacecost.py - About 2 days to fix

            Function on_get has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_get(req, resp):
                    if 'API-KEY' not in req.headers or \
                            not isinstance(req.headers['API-KEY'], str) or \
                            len(str.strip(req.headers['API-KEY'])) == 0:
                        access_control(req)
            Severity: Minor
            Found in myems-api/reports/microgriddashboard.py - 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

            Function on_post has a Cognitive Complexity of 104 (exceeds 5 allowed). Consider refactoring.
            Open

                def on_post(req, resp):
                    """Handles POST requests"""
                    admin_control(req)
                    try:
                        raw_json = req.stream.read().decode('utf-8')
            Severity: Minor
            Found in myems-api/core/shopfloor.py - 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

            File space_energy_input_item.py has 855 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import random
            import time
            from datetime import datetime, timedelta
            from decimal import Decimal
            from multiprocessing import Pool
            Severity: Major
            Found in myems-aggregation/space_energy_input_item.py - About 2 days to fix

              File Inspection.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import React, { createRef, Fragment, useEffect, useState } from 'react';
              import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
              import BootstrapTable from 'react-bootstrap-table-next';
              import { toast } from 'react-toastify';
              import {
              Severity: Major
              Found in myems-web/src/components/MyEMS/WorkOrder/Inspection.js - About 2 days to fix

                File Installation.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import React, { createRef, Fragment, useEffect, useState } from 'react';
                import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
                import BootstrapTable from 'react-bootstrap-table-next';
                import { toast } from 'react-toastify';
                import {
                Severity: Major
                Found in myems-web/src/components/MyEMS/WorkOrder/Installation.js - About 2 days to fix

                  File Repair.js has 853 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import React, { createRef, Fragment, useEffect, useState } from 'react';
                  import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
                  import BootstrapTable from 'react-bootstrap-table-next';
                  import { toast } from 'react-toastify';
                  import {
                  Severity: Major
                  Found in myems-web/src/components/MyEMS/WorkOrder/Repair.js - About 2 days to fix

                    File space_energy_input_category.py has 853 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import random
                    import time
                    from datetime import datetime, timedelta
                    from decimal import Decimal
                    from multiprocessing import Pool
                    Severity: Major
                    Found in myems-aggregation/space_energy_input_category.py - About 2 days to fix

                      File offlinemeter.py has 853 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import uuid
                      from datetime import datetime, timedelta
                      import falcon
                      import mysql.connector
                      import simplejson as json
                      Severity: Major
                      Found in myems-api/core/offlinemeter.py - About 2 days to fix

                        Function init has 409 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            return function init(element, initialOptions) {
                              // all of the animation functions should create
                              // a copy of the options data, however, if a
                              // parent service has already created a copy then
                              // we should stick to using that
                        Severity: Major
                        Found in myems-admin/js/angular/angular-animate.js - About 2 days to fix

                          Function generate_excel has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def generate_excel(report, name, reporting_start_datetime_local, reporting_end_datetime_local,
                                             base_period_start_datetime, base_period_end_datetime, period_type, language):
                              trans = get_translation(language)
                              trans.install()
                              _ = trans.gettext
                          Severity: Minor
                          Found in myems-api/excelexporters/meterenergy.py - 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

                          Function generate_excel has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def generate_excel(report,
                                             name,
                                             base_period_start_datetime_local,
                                             base_period_end_datetime_local,
                                             reporting_start_datetime_local,
                          Severity: Minor
                          Found in myems-api/excelexporters/metersaving.py - 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

                          Function generate_excel has a Cognitive Complexity of 100 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def generate_excel(report,
                                             name,
                                             base_period_start_datetime_local,
                                             base_period_end_datetime_local,
                                             reporting_start_datetime_local,
                          Severity: Minor
                          Found in myems-api/excelexporters/meterplan.py - 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

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

                                 function($$rAF,   $rootScope,   $rootElement,   $document,   $$Map,
                                          $$animation,   $$AnimateRunner,   $templateRequest,   $$jqLite,   $$forceReflow,
                                          $$isDocumentHidden) {
                          
                              var activeAnimationsLookup = new $$Map();
                          Severity: Major
                          Found in myems-admin/js/angular/angular-animate.js - About 1 day to fix

                            Function on_get has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(req, resp):
                                    if 'API-KEY' not in req.headers or \
                                            not isinstance(req.headers['API-KEY'], str) or \
                                            len(str.strip(req.headers['API-KEY'])) == 0:
                                        access_control(req)
                            Severity: Minor
                            Found in myems-api/reports/energystoragepowerstationcollectionbilling.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 on_get has a Cognitive Complexity of 99 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(req, resp):
                                    if 'API-KEY' not in req.headers or \
                                            not isinstance(req.headers['API-KEY'], str) or \
                                            len(str.strip(req.headers['API-KEY'])) == 0:
                                        access_control(req)
                            Severity: Minor
                            Found in myems-api/reports/microgridsbilling.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

                            Severity
                            Category
                            Status
                            Source
                            Language