Showing 5,781 of 10,536 total issues

Function on_get has a Cognitive Complexity of 94 (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/metertracking.py - About 1 day 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 94 (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/metersubmetersbalance.py - About 1 day 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

File utilities.py has 792 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import collections
import statistics
from datetime import datetime, timedelta
from decimal import Decimal
import mysql.connector
Severity: Major
Found in myems-api/core/utilities.py - About 1 day to fix

    Function on_post has a Cognitive Complexity of 93 (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/tenant.py - About 1 day 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

    File storedashboard.py has 788 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    from datetime import datetime, timedelta, timezone
    from decimal import Decimal
    import falcon
    import mysql.connector
    import simplejson as json
    Severity: Major
    Found in myems-api/reports/storedashboard.py - About 1 day to fix

      File tenantdashboard.py has 788 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      from datetime import datetime, timedelta, timezone
      from decimal import Decimal
      import falcon
      import mysql.connector
      import simplejson as json
      Severity: Major
      Found in myems-api/reports/tenantdashboard.py - About 1 day to fix

        File dashboard.py has 788 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from datetime import datetime, timedelta, timezone
        from decimal import Decimal
        import falcon
        import mysql.connector
        import simplejson as json
        Severity: Major
        Found in myems-api/reports/dashboard.py - About 1 day to fix

          File shopfloordashboard.py has 788 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          from datetime import datetime, timedelta, timezone
          from decimal import Decimal
          import falcon
          import mysql.connector
          import simplejson as json
          Severity: Major
          Found in myems-api/reports/shopfloordashboard.py - About 1 day to fix

            File spaceload.py has 781 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import base64
            from core.utilities import get_translation
            import os
            import re
            import uuid
            Severity: Major
            Found in myems-api/excelexporters/spaceload.py - About 1 day to fix

              File tenantload.py has 780 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              import base64
              from core.utilities import get_translation
              import os
              import re
              import uuid
              Severity: Major
              Found in myems-api/excelexporters/tenantload.py - About 1 day to fix

                File tenantcost.py has 776 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                import base64
                from core.utilities import get_translation
                import os
                import re
                import uuid
                Severity: Major
                Found in myems-api/excelexporters/tenantcost.py - About 1 day to fix

                  File tenantcarbon.py has 776 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import base64
                  from core.utilities import get_translation
                  import os
                  import re
                  import uuid
                  Severity: Major
                  Found in myems-api/excelexporters/tenantcarbon.py - About 1 day to fix

                    File storecost.py has 775 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import base64
                    from core.utilities import get_translation
                    import os
                    import re
                    import uuid
                    Severity: Major
                    Found in myems-api/excelexporters/storecost.py - About 1 day to fix

                      File storecarbon.py has 775 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import base64
                      from core.utilities import get_translation
                      import os
                      import re
                      import uuid
                      Severity: Major
                      Found in myems-api/excelexporters/storecarbon.py - About 1 day to fix

                        Function on_post has a Cognitive Complexity of 91 (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/store.py - About 1 day 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

                        File combinedequipmentincome.py has 770 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        import base64
                        from core.utilities import get_translation
                        import os
                        import re
                        import uuid
                        Severity: Major
                        Found in myems-api/excelexporters/combinedequipmentincome.py - About 1 day to fix

                          Function on_get has a Cognitive Complexity of 90 (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/offlinemetercarbon.py - About 1 day 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 90 (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/offlinemetercost.py - About 1 day 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 90 (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/virtualmetercarbon.py - About 1 day 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 90 (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/virtualmetercost.py - About 1 day 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