Showing 5,781 of 10,536 total issues

Function on_get has a Cognitive Complexity of 15 (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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.py - About 1 hr 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 15 (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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.py - About 1 hr 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 15 (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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.py - About 1 hr 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 15 (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_MICROGRID_ID')
Severity: Minor
Found in myems-api/core/microgrid.py - About 1 hr 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 15 (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/microgrid.py - About 1 hr 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 15 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp, id_, gid):
        """Handles PUT requests"""
        admin_control(req)
        try:
            raw_json = req.stream.read().decode('utf-8')
Severity: Minor
Found in myems-api/core/microgrid.py - About 1 hr 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 15 (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/shopfloor.py - About 1 hr 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 15 (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/equipment.py - About 1 hr 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 15 (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/tariff.py - About 1 hr 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 15 (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/tariff.py - About 1 hr 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 registerControllerCallbacks has 47 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    function registerControllerCallbacks($q, $transitions, controllerInstance, $scope, cfg) {
        // Call $onInit() ASAP
        if (isFunction(controllerInstance.$onInit) &&
            !((cfg.viewDecl.component || cfg.viewDecl.componentProvider) && hasComponentImpl)) {
            controllerInstance.$onInit();
Severity: Minor
Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 hr to fix

    Function StateObject has 47 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        var StateObject = /** @class */ (function () {
            /** @deprecated use State.create() */
            function StateObject(config) {
                return StateObject.create(config || {});
            }
    Severity: Minor
    Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 hr to fix

      Function createBytes has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          var createBytes = function(buffer, rsBlocks) {
      
            var offset = 0;
      
            var maxDcCount = 0;
      Severity: Minor
      Found in myems-admin/js/angular/qrcode.js - About 1 hr to fix

        Function compile has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    compile: function (tElement) {
                        var initial = tElement.html();
                        tElement.empty();
                        return function (scope, $element) {
                            var data = $element.data('$uiView');
        Severity: Minor
        Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 hr to fix

          Function MockXhr has 47 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function MockXhr() {
          
            // hack for testing $http, $httpBackend
            MockXhr.$$lastInstance = this;
          
          
          Severity: Minor
          Found in myems-admin/js/angular/angular-mocks.js - About 1 hr to fix

            Function link has 47 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                link: function(scope, $element, attr, ctrl, $transclude) {
                    var currentScope,
                        currentElement,
                        previousLeaveAnimation,
                        autoScrollExp = attr.autoscroll,
            Severity: Minor
            Found in myems-admin/js/angular/angular-route.js - About 1 hr to fix

              Function renderSlotSelection has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function renderSlotSelection(startDate, endDate) {
                          var helperOption = opt('selectHelper');
                          coordinateGrid.build();
                          if (helperOption) {
                              var col = dateToCell(startDate).col;
              Severity: Minor
              Found in myems-admin/js/plugins/fullcalendar/fullcalendar.min.js - About 1 hr to fix

                Function processesImages has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function processesImages($, cont, images, lastRowWidth, settings){    
                            var row = new Array();
                            var row_i, i;
                            var partialRowWidth = 0;
                            var extraW;
                Severity: Minor
                Found in myems-admin/js/plugins/justified-gallery/jquery.justifiedgallery.js - About 1 hr to fix

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

                        this.loadData = function(d, a, u, r) {
                          var h = n.defer();
                          b.suspendLayout();
                          b.allowEvents = !1;
                          b.updateDataFields(u);
                  Severity: Minor
                  Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 1 hr to fix

                    Function editEquipmentParameter has 47 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $scope.editEquipmentParameter = function(equipmentparameter) {
                            var modalInstance = $uibModal.open({
                                templateUrl: 'views/settings/equipment/equipmentparameter.model.html',
                                controller: 'ModalEditEquipmentParameterCtrl',
                              windowClass: "animated fadeIn",
                      Severity
                      Category
                      Status
                      Source
                      Language