Showing 5,781 of 10,536 total issues

Function Forms has 53 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const Forms = () => {
  const { register, errors } = useForm();

  return (
    <>
Severity: Major
Found in myems-web/src/components/widgets/Forms.js - About 2 hrs to fix

    Function generate_excel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
    
        trans = get_translation(language)
        trans.install()
        _ = trans.gettext
    Severity: Major
    Found in myems-api/excelexporters/combinedequipmentbatch.py - About 2 hrs to fix

      Function generate_excel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
          trans = get_translation(language)
          trans.install()
          _ = trans.gettext
          wb = Workbook()
      Severity: Major
      Found in myems-api/excelexporters/equipmentbatch.py - About 2 hrs to fix

        Function generate_excel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def generate_excel(report, name1, name2, reporting_start_datetime_local, reporting_end_datetime_local, period_type,
                           language):
            trans = get_translation(language)
            trans.install()
            _ = trans.gettext
        Severity: Major
        Found in myems-api/excelexporters/metercomparison.py - About 2 hrs to fix

          Function generate_excel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def generate_excel(report,
                             name,
                             base_period_start_datetime_local,
                             base_period_end_datetime_local,
                             reporting_start_datetime_local,
          Severity: Major
          Found in myems-api/excelexporters/spaceenergyitem.py - About 2 hrs to fix

            Function generate_excel has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def generate_excel(report, space_name, reporting_start_datetime_local, reporting_end_datetime_local, language):
            
                trans = get_translation(language)
                trans.install()
                _ = trans.gettext
            Severity: Major
            Found in myems-api/excelexporters/shopfloorbatch.py - About 2 hrs to fix

              Function on_put has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def on_put(req, resp, id_):
                      """Handles PUT requests"""
                      admin_control(req)
                      try:
                          raw_json = req.stream.read().decode('utf-8')
              Severity: Major
              Found in myems-api/core/microgrid.py - About 2 hrs to fix

                Function createMarkers has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                  createMarkers: function(markers) {
                    var i,
                        marker,
                        point,
                        markerConfig,
                Severity: Minor
                Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 2 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 MultiTrendChart has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                const MultiTrendChart = ({
                  reportingTitle,
                  baseTitle,
                  reportingTooltipTitle,
                  baseTooltipTitle,
                Severity: Minor
                Found in myems-web/src/components/MyEMS/common/MultiTrendChart.js - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_PHOTOVOLTAIC_POWER_STATION_ID')
                Severity: Minor
                Found in myems-api/core/photovoltaicpowerstation.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp):
                        access_control(req)
                        cnx = mysql.connector.connect(**config.myems_system_db)
                        cursor = cnx.cursor()
                
                
                Severity: Minor
                Found in myems-api/core/energystoragecontainer.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp):
                        access_control(req)
                        cnx = mysql.connector.connect(**config.myems_system_db)
                        cursor = cnx.cursor()
                
                
                Severity: Minor
                Found in myems-api/core/photovoltaicpowerstation.py - About 2 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 on_post has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_post(req, resp, id_):
                        """Handles POST requests"""
                        admin_control(req)
                        try:
                            raw_json = req.stream.read().decode('utf-8')
                Severity: Minor
                Found in myems-api/core/energystoragecontainer.py - About 2 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 on_put has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_put(req, resp, id_, fid):
                        """Handles PUT requests"""
                        admin_control(req)
                        try:
                            raw_json = req.stream.read().decode('utf-8')
                Severity: Minor
                Found in myems-api/core/energystoragecontainer.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
                Severity: Minor
                Found in myems-api/core/energystoragecontainer.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_PHOTOVOLTAIC_POWER_STATION_ID')
                Severity: Minor
                Found in myems-api/core/photovoltaicpowerstation.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_ENERGY_STORAGE_CONTAINER_ID')
                Severity: Minor
                Found in myems-api/core/energystoragecontainer.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_ENERGY_STORAGE_POWER_STATION_ID')
                Severity: Minor
                Found in myems-api/core/energystoragepowerstation.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp):
                        access_control(req)
                        cnx = mysql.connector.connect(**config.myems_system_db)
                        cursor = cnx.cursor()
                
                
                Severity: Minor
                Found in myems-api/core/energystoragepowerstation.py - About 2 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 on_get has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                    def on_get(req, resp, id_):
                        access_control(req)
                        if not id_.isdigit() or int(id_) <= 0:
                            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                                   description='API.INVALID_ENERGY_STORAGE_POWER_STATION_ID')
                Severity: Minor
                Found in myems-api/core/energystoragepowerstation.py - About 2 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

                Severity
                Category
                Status
                Source
                Language