Showing 5,781 of 10,536 total issues

Function on_put has a Cognitive Complexity of 18 (exceeds 5 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: Minor
Found in myems-api/core/distributioncircuit.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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_, eid):
        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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_, hid):
        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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_, pid):
        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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.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 18 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp, id_):
        """Handles POST requests"""
        admin_control(req)

        try:
Severity: Minor
Found in myems-api/core/user.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/store.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

File point.controller.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

'use strict';

app.controller('PointController', function(
    $scope,
    $rootScope,
Severity: Minor
Found in myems-admin/app/controllers/settings/datasource/point.controller.js - About 2 hrs to fix

    File SidePanelModal.js has 267 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
    import PropTypes from 'prop-types';
    import React, { useContext, useEffect } from 'react';
    import classNames from 'classnames';
    import { Button, CustomInput, Modal, ModalHeader, ButtonGroup, Label, Media, Badge } from 'reactstrap';
    Severity: Minor
    Found in myems-web/src/components/side-panel/SidePanelModal.js - About 2 hrs to fix

      Function UrlRouter has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var UrlRouter = /** @class */ (function () {
              /** @internal */
              function UrlRouter(/** @internal */ router) {
                  var _this = this;
                  this.router = router;
      Severity: Major
      Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

        Function getElements has 60 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Dropzone.getElements = function (els, name) {
          var el, elements;
        
          if (els instanceof Array) {
            elements = [];
        Severity: Major
        Found in myems-admin/js/plugins/dropzone/dropzone.js - About 2 hrs to fix

          Function formatDate has 60 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              function formatDate(d, fmt, monthNames, dayNames) {
          
                  if (typeof d.strftime == "function") {
                      return d.strftime(fmt);
                  }
          Severity: Major
          Found in myems-admin/js/plugins/flot/jquery.flot.time.js - About 2 hrs to fix

            Function combine has 60 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function combine(data) {
            
                        var total = 0,
                            combined = 0,
                            numCombined = 0,
            Severity: Major
            Found in myems-admin/js/plugins/flot/jquery.flot.pie.js - About 2 hrs to fix

              Function handler has 60 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function handler(event) {
                      var orgEvent   = event || window.event,
                          args       = slice.call(arguments, 1),
                          delta      = 0,
                          deltaX     = 0,
              Severity: Major
              Found in myems-admin/js/plugins/jvectormap/jquery-jvectormap-2.0.2.min.js - About 2 hrs to fix

                Function on_get has 60 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/energystoragepowerstationitemdashboard.py - About 2 hrs to fix

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

                      def on_put(req, resp, id_, hid):
                          """Handles PUT 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 $IntervalProvider has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    angular.mock.$IntervalProvider = function() {
                      this.$get = ['$browser', '$$intervalFactory',
                           function($browser,   $$intervalFactory) {
                        var repeatFns = [],
                            nextRepeatId = 0,
                    Severity: Major
                    Found in myems-admin/js/angular/angular-mocks.js - About 2 hrs to fix
                      Severity
                      Category
                      Status
                      Source
                      Language