Showing 5,781 of 10,536 total issues

Function on_put has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def on_put(req, resp, id_, pid):
        """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_post has a Cognitive Complexity of 14 (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_post has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def on_post(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 14 (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/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 14 (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/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 htmlSanitizeWriterImpl has 43 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function htmlSanitizeWriterImpl(buf, uriValidator) {
    var ignoreCurrentElement = false;
    var out = bind(buf, buf.push);
    return {
      start: function(tag, attrs) {
Severity: Minor
Found in myems-admin/js/angular/angular-sanitize.js - About 1 hr to fix

    Function $get has 43 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {
        return function initDriverFn(animationDetails) {
          if (animationDetails.from && animationDetails.to) {
            var fromAnimation = prepareAnimation(animationDetails.from);
            var toAnimation = prepareAnimation(animationDetails.to);
    Severity: Minor
    Found in myems-admin/js/angular/angular-animate.js - About 1 hr to fix

      Function inject has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        window.inject = angular.mock.inject = function() {
          var blockFns = Array.prototype.slice.call(arguments, 0);
          var errorForStack = new Error('Declaration Location');
          // IE10+ and PhanthomJS do not set stack trace information, until the error is thrown
          if (!errorForStack.stack) {
      Severity: Minor
      Found in myems-admin/js/angular/angular-mocks.js - About 1 hr to fix

        Function position has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            position: function() {
                var options = this.options;
                var origin = this.el.offsetParent().offset();
                var width = this.el.outerWidth();
                var height = this.el.outerHeight();
        Severity: Minor
        Found in myems-admin/js/plugins/fullcalendar/fullcalendar.js - About 1 hr to fix

          Function show has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ClockPicker.prototype.show = function(e){
                  // Not show again
                  if (this.isShown) {
                      return;
                  }
          Severity: Minor
          Found in myems-admin/js/plugins/clockpicker/clockpicker.js - About 1 hr to fix

            Function _invokeQueue has 43 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function _invokeQueue(providers, queue, moduleName, reconfig) {
                        if (!queue) {
                            return;
                        }
            
            
            Severity: Minor
            Found in myems-admin/js/plugins/oclazyload/ocLazyLoad.js - About 1 hr to fix

              Function uiBrCpfCnpjMask has 43 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  function uiBrCpfCnpjMask() {
                      function applyCpfCnpjMask (value) {
                          if(!value) {
                              return value;
                          }
              Severity: Minor
              Found in myems-admin/js/plugins/uiMask/masks.js - About 1 hr to fix

                Function b has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                              var b = q(function() {
                                if (0 < a.currentList.length) {
                                  v = k.$new();
                                  v.data = Fb();
                                  v.checkBoxStyle = a.options.checkBoxSettings.style;
                Severity: Minor
                Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 1 hr to fix

                  Function editEnergyStorageContainer has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      $scope.editEnergyStorageContainer = function(energystoragecontainer) {
                          var modalInstance = $uibModal.open({
                              windowClass: "animated fadeIn",
                              templateUrl: 'views/settings/energystoragecontainer/energystoragecontainer.model.html',
                              controller: 'ModalEditEnergyStorageContainerCtrl',

                    Function editShopfloor has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $scope.editShopfloor = function(shopfloor) {
                            var modalInstance = $uibModal.open({
                                windowClass: "animated fadeIn",
                                templateUrl: 'views/settings/shopfloor/shopfloor.model.html',
                                controller: 'ModalEditShopfloorCtrl',

                      Function addSpace has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          $scope.addSpace = function () {
                              var modalInstance = $uibModal.open({
                                  templateUrl: 'views/settings/space/space.model.html',
                                  controller: 'ModalAddSpaceCtrl',
                                  windowClass: "animated fadeIn",
                      Severity: Minor
                      Found in myems-admin/app/controllers/settings/space/space.controller.js - About 1 hr to fix

                        Function addMicrogridPowerconversionsystem has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              $scope.addMicrogridPowerconversionsystem = function() {
                        
                                  var modalInstance = $uibModal.open({
                                      templateUrl: 'views/settings/microgrid/microgridpowerconversionsystem.model.html',
                                      controller: 'ModalAddMicrogridPowerconversionsystemCtrl',

                          Function editMicrogridBattery has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                $scope.editMicrogridBattery = function(microgridbattery) {
                                    var modalInstance = $uibModal.open({
                                        templateUrl: 'views/settings/microgrid/microgridbattery.model.html',
                                        controller: 'ModalEditMicrogridBatteryCtrl',
                                      windowClass: "animated fadeIn",

                            Function render has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              render() {
                                const { t } = this.props;
                                const chartData = {
                                  ...this.state.chartData,
                                  datasets: [
                            Severity: Minor
                            Found in myems-web/src/components/MyEMS/Meter/RealtimeChart.js - About 1 hr to fix

                              Function onSpaceCascaderChange has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                let onSpaceCascaderChange = (value, selectedOptions) => {
                                  setSelectedSpaceName(selectedOptions.map(o => o.label).join('/'));
                                  setSelectedSpaceID(value[value.length - 1]);
                              
                                  let isResponseOK = false;
                              Severity: Minor
                              Found in myems-web/src/components/MyEMS/Tenant/TenantBill.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language