Showing 5,781 of 10,536 total issues

File emailmessage.py has 414 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import re
from datetime import datetime, timedelta, timezone
import falcon
import mysql.connector
import simplejson as json
Severity: Minor
Found in myems-api/core/emailmessage.py - About 5 hrs to fix

    Function setValues has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring.
    Open

      setValues: function(values) {
        var max = -Number.MAX_VALUE,
            min = Number.MAX_VALUE,
            val,
            cc,
    Severity: Minor
    Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 5 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 39 (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/core/energyflowdiagram.py - About 5 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 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_, pid):
            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/core/combinedequipment.py - About 5 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 39 (exceeds 5 allowed). Consider refactoring.
    Open

        def on_get(req, resp, id_, pid):
            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/core/equipment.py - About 5 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 init has 146 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function init(plot) {
    
            plot.hooks.processOptions.push(processOptions);
    
            //if the plugin is active register processDatapoints method
    Severity: Major
    Found in myems-admin/js/plugins/flot/curvedLines.js - About 5 hrs to fix

      Function Invoice has 146 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      const Invoice = () => {
        const [subtotal, setSubtotal] = useState(0);
        const [tax, setTax] = useState(0);
        const [total, setTotal] = useState(0);
        const { loading: invoiceLoading, data: invoice } = useFakeFetch(rawInvoice);
      Severity: Major
      Found in myems-web/src/components/page/Invoice.js - About 5 hrs to fix

        File space_energy_output_category.py has 407 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: Minor
        Found in myems-aggregation/space_energy_output_category.py - About 5 hrs to fix

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

              def on_get(req, resp, id_):
                  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/core/energyflowdiagram.py - About 5 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 38 (exceeds 5 allowed). Consider refactoring.
          Open

              def on_get(req, resp, id_):
                  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/core/energyflowdiagram.py - About 5 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 changeLogs.js has 403 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          export default [
            {
              title: `2.10.2 - African hobby`,
              publish: '13 May, 2021',
              logs: {
          Severity: Minor
          Found in myems-web/src/components/changelog/changeLogs.js - About 5 hrs to fix

            Consider simplifying this complex logical expression.
            Open

                          if (Ha && !va)
                            switch (b) {
                              case "start":
                                Wa(0);
                                a.updateCurrentList();
            Severity: Critical
            Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 5 hrs to fix

              Function s has 141 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function s() {
                      function t(t, a, o) {
                          var i = e("<td>");
                          return t.formatter ? i.html(t.formatter(a, i, o)) : i.html(a || ""), i
                      }
              Severity: Major
              Found in myems-admin/js/plugins/footable/footable.all.min.js - About 5 hrs to fix

                Function CodeHighlightDoc has 140 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const CodeHighlightDoc = () => {
                  return (
                    <Fragment>
                      <PageHeader
                        title="CodeHighlight"
                Severity: Major
                Found in myems-web/src/components/plugins/CodeHighlightDoc.js - About 5 hrs to fix

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

                      def on_post(req, resp, id_):
                          """Handles POST requests"""
                          admin_control(req)
                          if not id_.isdigit() or int(id_) <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                  Severity: Minor
                  Found in myems-api/core/meter.py - About 5 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 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def on_post(req, resp, id_):
                          """Handles POST requests"""
                          admin_control(req)
                          if not id_.isdigit() or int(id_) <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                  Severity: Minor
                  Found in myems-api/core/combinedequipment.py - About 5 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 37 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def on_post(req, resp, id_):
                          admin_control(req)
                          """Handles POST requests"""
                          if not id_.isdigit() or int(id_) <= 0:
                              raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                  Severity: Minor
                  Found in myems-api/core/equipment.py - About 5 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 tariff.controller.js has 399 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  'use strict';
                  
                  app.controller('TariffController', function(
                      $scope,
                      $rootScope,
                  Severity: Minor
                  Found in myems-admin/app/controllers/settings/tariff/tariff.controller.js - About 5 hrs to fix

                    Function NgMessagesCtrl has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          controller: ['$element', '$scope', '$attrs', function NgMessagesCtrl($element, $scope, $attrs) {
                            var ctrl = this;
                            var latestKey = 0;
                            var nextAttachId = 0;
                    
                    
                    Severity: Major
                    Found in myems-admin/js/angular/angular-messages.js - About 5 hrs to fix

                      Function EventDetailsForm has 138 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const EventDetailsForm = () => {
                        // Data
                        const { loading: loadingTimezones, data } = useFakeFetch(rawTimezones);
                        const timezones = data.map(item => ({ value: item.offset, label: `${item.offset} ${item.name}` }));
                      
                      
                      Severity: Major
                      Found in myems-web/src/components/event/EventDetailsForm.js - About 5 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language