Showing 5,781 of 10,536 total issues

Consider simplifying this complex logical expression.
Open

    if 'parameters' not in report.keys() or \
            report['parameters'] is None or \
            'names' not in report['parameters'].keys() or \
            report['parameters']['names'] is None or \
            len(report['parameters']['names']) == 0 or \
Severity: Critical
Found in myems-api/excelexporters/spacecost.py - About 2 hrs to fix

    Consider simplifying this complex logical expression.
    Open

        if 'parameters' not in report.keys() or \
                report['parameters'] is None or \
                'names' not in report['parameters'].keys() or \
                report['parameters']['names'] is None or \
                len(report['parameters']['names']) == 0 or \
    Severity: Critical
    Found in myems-api/excelexporters/combinedequipmentplan.py - About 2 hrs to fix

      Consider simplifying this complex logical expression.
      Open

          if 'parameters' not in report.keys() or \
                  report['parameters'] is None or \
                  'names' not in report['parameters'].keys() or \
                  report['parameters']['names'] is None or \
                  len(report['parameters']['names']) == 0 or \
      Severity: Critical
      Found in myems-api/excelexporters/offlinemeterplan.py - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

            if 'parameters' not in report.keys() or \
                    report['parameters'] is None or \
                    'names' not in report['parameters'].keys() or \
                    report['parameters']['names'] is None or \
                    len(report['parameters']['names']) == 0 or \
        Severity: Critical
        Found in myems-api/excelexporters/spaceoutput.py - About 2 hrs to fix

          File EnergyStoragePowerStationTable.js has 277 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          import React, { Fragment, createRef, useContext } from 'react';
          import paginationFactory, { PaginationProvider } from 'react-bootstrap-table2-paginator';
          import BootstrapTable from 'react-bootstrap-table-next';
          import Badge from 'reactstrap/es/Badge';
          import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

            Function UrlRuleFactory has 66 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var UrlRuleFactory = /** @class */ (function () {
                    function UrlRuleFactory(router) {
                        this.router = router;
                    }
                    UrlRuleFactory.prototype.compile = function (str) {
            Severity: Major
            Found in myems-admin/js/ui-router/angular-ui-router.js - About 2 hrs to fix

              Function UrlService has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var UrlService = /** @class */ (function () {
                      /** @internal */
                      function UrlService(/** @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 processSeries has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        var processSeries = function(series, seriesOld) {
                          var i;
                          var ids = [];
                
                          if(series) {
                Severity: Major
                Found in myems-admin/js/angular-highcharts/highcharts-ng.js - About 2 hrs to fix

                  Function Dropzone has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function Dropzone(el, options) {
                      var _this;
                  
                      _classCallCheck(this, Dropzone);
                  
                  
                  Severity: Major
                  Found in myems-admin/js/plugins/dropzone/dropzone.js - About 2 hrs to fix

                    Function sortAnimations has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function sortAnimations(animations) {
                          var tree = { children: [] };
                          var i, lookup = new $$Map();
                    
                          // this is done first beforehand so that the map
                    Severity: Major
                    Found in myems-admin/js/angular/angular-animate.js - About 2 hrs to fix

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

                      'use strict';
                      
                      app.controller('DataSourceController', function(
                          $scope,
                          $rootScope,

                        Function updateDataFields has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              this.updateDataFields = function(d) {
                                b.options.dataFields = d
                                  ? {
                                      allowDrag: d.allowDrag ? d.allowDrag : "allowDrag",
                                      allowDrop: d.allowDrop ? d.allowDrop : "allowDrop",
                        Severity: Major
                        Found in myems-admin/js/jcui/angular.integralui.treeview.min.js - About 2 hrs to fix

                          Function deps has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                                          function ($ocLazyLoad) {
                                                              return $ocLazyLoad.load(['ui.select', 'ui.checkbox', 'toaster', 'datepicker']).then(
                                                                  function () {
                                                                      return $ocLazyLoad.load([{
                                                                          files: ['js/plugins/sweetalert/sweetalert.min.js','css/plugins/sweetalert/sweetalert.css']
                          Severity: Major
                          Found in myems-admin/app/config.router.js - About 2 hrs to fix

                            Function CarouselExample has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const CarouselExample = () => {
                              const carouselExample = `function carouselExample (){
                                const [activeIndex, setActiveIndex] = useState(0);
                                const [animating, setAnimating] = useState(false);
                            
                            
                            Severity: Major
                            Found in myems-web/src/components/bootstrap-components/Carousel.js - About 2 hrs to fix

                              File energycategory.py has 275 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import uuid
                              import falcon
                              import mysql.connector
                              import simplejson as json
                              from core.useractivity import user_logger, admin_control, access_control, api_key_control
                              Severity: Minor
                              Found in myems-api/core/energycategory.py - About 2 hrs to fix

                                Function isValidFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                Dropzone.isValidFile = function (file, acceptedFiles) {
                                  if (!acceptedFiles) {
                                    return true;
                                  } // If there are no accepted mime types, it's OK
                                
                                
                                Severity: Minor
                                Found in myems-admin/js/plugins/dropzone/dropzone.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 ItemDashboard has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                const ItemDashboard = ({ setRedirect, setRedirectUrl, t }) => {
                                  const [activeTabLeft, setActiveTabLeft] = useState('1');
                                  const toggleTabLeft = tab => {
                                    if (activeTabLeft !== tab) setActiveTabLeft(tab);
                                  };

                                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 19 (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/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

                                Function on_post has a Cognitive Complexity of 19 (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/sensor.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 19 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def on_get(req, resp):
                                        access_control(req)
                                        start_datetime_local = req.params.get('startdatetime')
                                        end_datetime_local = req.params.get('enddatetime')
                                        status = req.params.get('status')
                                Severity: Minor
                                Found in myems-api/core/ticket.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