Showing 5,781 of 10,536 total issues

Function on_get has a Cognitive Complexity of 11 (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/distributioncircuit.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 11 (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/sensor.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 11 (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/datasource.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_delete has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def on_delete(req, resp, id_):
        admin_control(req)
        if not id_.isdigit() or int(id_) <= 0:
            raise falcon.HTTPError(status=falcon.HTTP_400, title='API.BAD_REQUEST',
                                   description='API.INVALID_COMMAND_ID')
Severity: Minor
Found in myems-api/core/command.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 11 (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_put has a Cognitive Complexity of 11 (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/energycategory.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 11 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(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/workingcalendar.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 11 (exceeds 5 allowed). Consider refactoring.
Open

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

        try:
Severity: Minor
Found in myems-api/core/user.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 11 (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/energyitem.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 link has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

                link: function (scope, element, attrs, uiSrefActive) {
                    var type = getTypeInfo(element);
                    var active = uiSrefActive[1] || uiSrefActive[0];
                    var unlinkInfoFn = null;
                    var rawDef = {};
Severity: Minor
Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 hr to fix

    Function QRMath has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var QRMath = function() {
    
        var EXP_TABLE = new Array(256);
        var LOG_TABLE = new Array(256);
    
    
    Severity: Minor
    Found in myems-admin/js/angular/qrcode.js - About 1 hr to fix

      Function arrayTuples has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function arrayTuples() {
              var args = [];
              for (var _i = 0; _i < arguments.length; _i++) {
                  args[_i] = arguments[_i];
              }
      Severity: Minor
      Found in myems-admin/js/ui-router/angular-ui-router.js - About 1 hr to fix

        Function write has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            _this.write = function(out) {
        
              //---------------------------------
              // GIF Signature
        
        
        Severity: Minor
        Found in myems-admin/js/angular/qrcode.js - About 1 hr to fix

          Function executeAnimationFn has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                function executeAnimationFn(fn, element, event, options, onDone) {
                  var args;
                  switch (event) {
                    case 'animate':
                      args = [element, options.from, options.to, onDone];
          Severity: Minor
          Found in myems-admin/js/angular/angular-animate.js - About 1 hr to fix

            Function groupEventedAnimations has 31 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  function groupEventedAnimations(element, event, options, animations, fnName) {
                    var operations = [];
                    forEach(animations, function(ani) {
                      var animation = ani[fnName];
                      if (!animation) return;
            Severity: Minor
            Found in myems-admin/js/angular/angular-animate.js - About 1 hr to fix

              Function $$CookieWriter has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function $$CookieWriter($document, $log, $browser) {
                var cookiePath = $browser.baseHref();
                var rawDocument = $document[0];
              
                function buildCookieString(name, value, options) {
              Severity: Minor
              Found in myems-admin/js/angular/angular-cookies.js - About 1 hr to fix

                Function _mouse has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        this._mouse = function (e) {
                
                            var mouseMove = function (e) {
                                var v = s.xy2val(e.pageX, e.pageY);
                
                
                Severity: Minor
                Found in myems-admin/js/plugins/jsKnob/jquery.knob.js - About 1 hr to fix

                  Function _finished has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      value: function _finished(files, responseText, e) {
                        var _iteratorNormalCompletion29 = true;
                        var _didIteratorError29 = false;
                        var _iteratorError29 = undefined;
                  
                  
                  Severity: Minor
                  Found in myems-admin/js/plugins/dropzone/dropzone.js - About 1 hr to fix

                    Function _errorProcessing has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        value: function _errorProcessing(files, message, xhr) {
                          var _iteratorNormalCompletion30 = true;
                          var _didIteratorError30 = false;
                          var _iteratorError30 = undefined;
                    
                    
                    Severity: Minor
                    Found in myems-admin/js/plugins/dropzone/dropzone.js - About 1 hr to fix

                      Function bindSegHandlers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          bindSegHandlers: function() {
                              var _this = this;
                              var view = this.view;
                      
                              $.each(
                      Severity: Minor
                      Found in myems-admin/js/plugins/fullcalendar/fullcalendar.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language