Showing 5,781 of 10,536 total issues

Function loadData has 63 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  const loadData = table => {
    table.current.selectionContext.selected = [];
    onSelect();
    let isResponseOK = false;
    fetch(
Severity: Major
Found in myems-web/src/components/MyEMS/Notification/Notification.js - About 2 hrs to fix

    Function worker has 63 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def worker(space):
        ####################################################################################################################
        # Step 1: get all input meters associated with the space
        ####################################################################################################################
        print("Step 1: get all input meters associated with the space " + str(space['name']))
    Severity: Major
    Found in myems-aggregation/space_energy_input_item.py - About 2 hrs to fix

      Function worker has 63 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      def worker(space):
          ####################################################################################################################
          # Step 1: get all input meters associated with the space
          ####################################################################################################################
          print("Step 1: get all input meters associated with the space " + str(space['name']))
      Severity: Major
      Found in myems-aggregation/space_energy_input_category.py - About 2 hrs to fix

        Function on_get has 63 lines of code (exceeds 25 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: Major
        Found in myems-api/reports/metersubmetersbalance.py - About 2 hrs to fix

          Function on_post has 63 lines of code (exceeds 25 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: Major
          Found in myems-api/core/energystoragecontainer.py - About 2 hrs to fix

            Function on_post has 63 lines of code (exceeds 25 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: Major
            Found in myems-api/core/tenant.py - About 2 hrs to fix

              File emailserver.py has 271 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import base64
              import re
              import falcon
              import mysql.connector
              import simplejson as json
              Severity: Minor
              Found in myems-api/core/emailserver.py - About 2 hrs to fix

                Function cancelUpload has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    value: function cancelUpload(file) {
                      if (file.status === Dropzone.UPLOADING) {
                        var groupedFiles = this._getFilesWithXhr(file.xhr);
                
                        var _iteratorNormalCompletion19 = true;
                Severity: Major
                Found in myems-admin/js/plugins/dropzone/dropzone.js - About 2 hrs to fix

                  Function changeWatcher has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          this.changeWatcher = function(arraySource, tokenFn) {
                              var self;
                              var getTokens = function() {
                                  var array = angular.isFunction(arraySource) ? arraySource() : arraySource;
                                  var result = [], token, el;
                  Severity: Major
                  Found in myems-admin/js/plugins/fullcalendar/calendar.js - About 2 hrs to fix

                    File EchartMap.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { Fragment } from 'react';
                    import { Button, Card, CardBody } from 'reactstrap';
                    import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
                    import ReactEchartsCore from 'echarts-for-react/lib/core';
                    import * as echarts from 'echarts/lib/echarts';
                    Severity: Minor
                    Found in myems-web/src/components/plugins/EchartMap.js - About 2 hrs to fix

                      Function Echarts has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const Echarts = () => {
                        const { isDark } = useContext(AppContext);
                      
                        return (
                          <Fragment>
                      Severity: Major
                      Found in myems-web/src/components/plugins/Echarts.js - About 2 hrs to fix

                        Function ruleInAngularExpression has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        MessageFormatParser.prototype.ruleInAngularExpression = function ruleInAngularExpression() {
                          var match = this.searchRe(INTERESTING_OPERATORS_RE);
                          var position;
                          if (match == null) {
                            if (this.angularOperatorStack.length === 0) {
                        Severity: Major
                        Found in myems-admin/js/angular/angular-message-format.js - About 2 hrs to fix

                          Function allocateAxisBoxFirstPhase has 61 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function allocateAxisBoxFirstPhase(axis) {
                                      // find the bounding box of the axis by looking at label
                                      // widths/heights and ticks, make room by diminishing the
                                      // plotOffset; this first phase only looks at one
                                      // dimension per axis, the other dimension depends on the
                          Severity: Major
                          Found in myems-admin/js/plugins/flot/jquery.flot.js - About 2 hrs to fix

                            Function Map has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            jvm.Map = function(params) {
                              var map = this,
                                  e;
                            
                              this.params = jvm.$.extend(true, {}, jvm.Map.defaultParams, params);
                            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 arrayReducer has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            export const arrayReducer = (state, action) => {
                              const { type, id, payload, sortBy, order, isAddToStart, isUpdatedStart } = action;
                              switch (type) {
                                case 'ADD':
                                  if (!payload) {
                            Severity: Minor
                            Found in myems-web/src/reducers/arrayReducer.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 job has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                            def job(logger, ):
                                ################################################################################################################
                                # Step 1: Verify Gateway Token
                                ################################################################################################################
                                cnx_system_db = None
                            Severity: Minor
                            Found in myems-modbus-tcp/gateway.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 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(req, resp, id_, gid):
                                    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 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(req, resp, id_, lid):
                                    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 18 (exceeds 5 allowed). Consider refactoring.
                            Open

                                def on_get(req, resp, id_, bid):
                                    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 18 (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/virtualpowerplant.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