Showing 5,781 of 10,536 total issues

Function OrderDetails has 114 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const OrderDetails = () => {
  const { currency } = useContext(AppContext);
  const subtotal = getTotalPrice(orderedProducts, orderedProducts);

  return (
Severity: Major
Found in myems-web/src/components/e-commerce/OrderDetails.js - About 4 hrs to fix

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

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

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

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

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

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

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

                  File protocol.py has 355 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import re
                  import uuid
                  from datetime import datetime, timedelta
                  import falcon
                  import mysql.connector
                  Severity: Minor
                  Found in myems-api/core/protocol.py - About 4 hrs to fix

                    Function tickGenerator has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                        axis.tickGenerator = function(axis) {
                    
                                            var ticks = [];
                                            var d = dateGenerator(axis.min, opts);
                                            var minSize = 0;
                    Severity: Major
                    Found in myems-admin/js/plugins/flot/jquery.flot.time.js - About 4 hrs to fix

                      Function EmailDetail has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      const EmailDetail = () => {
                        const { isRTL } = useContext(AppContext);
                        const { sender, subject } = emailDetails;
                        const [star, setStar] = useState(true);
                      
                      
                      Severity: Major
                      Found in myems-web/src/components/email/EmailDetail.js - About 4 hrs to fix

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

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

                            Function componentDidMount has 111 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              componentDidMount() {
                                this._isMounted = true;
                                const { t } = this.props;
                                // fetch meter realtime data at the first time
                                let isResponseOK = false;
                            Severity: Major
                            Found in myems-web/src/components/MyEMS/Meter/RealtimeChart.js - About 4 hrs to fix

                              File virtualmeter.py has 351 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import random
                              import time
                              from datetime import datetime, timedelta
                              from decimal import Decimal
                              from multiprocessing import Pool
                              Severity: Minor
                              Found in myems-normalization/virtualmeter.py - About 4 hrs to fix

                                Function on_get has a Cognitive Complexity of 30 (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/reports/energystoragepowerstationdetailsmeter.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_get has a Cognitive Complexity of 30 (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/reports/equipmenttracking.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 30 (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/energyflowdiagram.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 30 (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/energystoragecontainer.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_put has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    def on_put(req, resp, id_, lid):
                                        """Handles PUT requests"""
                                        admin_control(req)
                                        try:
                                            raw_json = req.stream.read().decode('utf-8')
                                Severity: Minor
                                Found in myems-api/core/energystoragecontainer.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

                                Severity
                                Category
                                Status
                                Source
                                Language