Showing 5,781 of 10,536 total issues

File customers.js has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {v4 as uuid} from 'uuid';
import team2 from '../../assets/img/team/2.jpg';
import team3 from '../../assets/img/team/3.jpg';
import team4 from '../../assets/img/team/4.jpg';
import team13 from '../../assets/img/team/13.jpg';
Severity: Minor
Found in myems-web/src/data/e-commerce/customers.js - About 4 hrs to fix

    File acquisition.py has 337 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import json
    import math
    import telnetlib3
    import asyncio
    import time
    Severity: Minor
    Found in myems-modbus-tcp/acquisition.py - About 4 hrs to fix

      Function on_put has a Cognitive Complexity of 28 (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/microgrid.py - About 4 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 28 (exceeds 5 allowed). Consider refactoring.
      Open

          def on_post(req, resp):
              """Handles POST requests"""
              admin_control(req)
      
              try:
      Severity: Minor
      Found in myems-api/core/wechatmessage.py - About 4 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 convert_tree_to_html has 102 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function convert_tree_to_html( tree, references, options ) {
              var i;
              options = options || {};
      
              // shallow clone
      Severity: Major
      Found in myems-admin/js/plugins/bootstrap-markdown/markdown.js - About 4 hrs to fix

        Function Orders has 102 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const Orders = () => {
          let table = createRef();
          // State
          const [isSelected, setIsSelected] = useState(false);
          const handleNextPage = ({ page, onPageChange }) => () => {
        Severity: Major
        Found in myems-web/src/components/e-commerce/Orders.js - About 4 hrs to fix

          Function on_get has 102 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/tenantcost.py - About 4 hrs to fix

            Function on_get has 102 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/tenantcarbon.py - About 4 hrs to fix

              Function on_get has 102 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/storecost.py - About 4 hrs to fix

                Function on_get has 102 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/combinedequipmentenergyitem.py - About 4 hrs to fix

                  Function on_get has 102 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/storecarbon.py - About 4 hrs to fix

                    Function _uploadData has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        value: function _uploadData(files, dataBlocks) {
                          var _this16 = this;
                    
                          var xhr = new XMLHttpRequest(); // Put the xhr object in the file objects to be able to reference it later.
                    
                    
                    Severity: Major
                    Found in myems-admin/js/plugins/dropzone/dropzone.js - About 4 hrs to fix

                      Function drawPie has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  function drawPie() {
                      
                                      var startAngle = Math.PI * options.series.pie.startAngle;
                                      var radius = options.series.pie.radius > 1 ? options.series.pie.radius : maxRadius * options.series.pie.radius;
                      
                      
                      Severity: Major
                      Found in myems-admin/js/plugins/flot/jquery.flot.pie.js - About 4 hrs to fix

                        Function getOption has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        const getOption = (month, isDark) => {
                          const grays = getGrays(isDark);
                          return {
                            tooltip: {
                              trigger: 'axis',
                        Severity: Major
                        Found in myems-web/src/components/dashboard-alt/TotalSales.js - About 4 hrs to fix

                          Function getOption has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          const getOption = (month, isDark) => {
                            const grays = getGrays(isDark);
                            return {
                              tooltip: {
                                trigger: 'axis',
                          Severity: Major
                          Found in myems-web/src/components/MyEMS/Shopfloor/TotalSales.js - About 4 hrs to fix

                            Function getOption has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const getOption = (month, isDark) => {
                              const grays = getGrays(isDark);
                              return {
                                tooltip: {
                                  trigger: 'axis',
                            Severity: Major
                            Found in myems-web/src/components/MyEMS/Store/TotalSales.js - About 4 hrs to fix

                              Function getOption has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              const getOption = (month, isDark) => {
                                const grays = getGrays(isDark);
                                return {
                                  tooltip: {
                                    trigger: 'axis',
                              Severity: Major
                              Found in myems-web/src/components/MyEMS/Tenant/TotalSales.js - About 4 hrs to fix

                                Function Customers has 101 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const Customers = () => {
                                  let table = createRef();
                                  // State
                                  const [isSelected, setIsSelected] = useState(false);
                                  const handleNextPage = ({ page, onPageChange }) => () => {
                                Severity: Major
                                Found in myems-web/src/components/e-commerce/Customers.js - About 4 hrs to fix

                                  Function on_get has 101 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/shopfloorload.py - About 4 hrs to fix

                                    Function on_get has 101 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/spaceoutput.py - About 4 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language