Showing 5,781 of 10,536 total issues

Function generate_excel has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

def generate_excel(report,
                   name,
                   base_period_start_datetime_local,
                   base_period_end_datetime_local,
                   reporting_start_datetime_local,
Severity: Minor
Found in myems-api/excelexporters/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 generate_excel has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

def generate_excel(report,
                   name,
                   base_period_start_datetime_local,
                   base_period_end_datetime_local,
                   reporting_start_datetime_local,
Severity: Minor
Found in myems-api/excelexporters/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

Function generate_excel has a Cognitive Complexity of 88 (exceeds 5 allowed). Consider refactoring.
Open

def generate_excel(report,
                   name,
                   base_period_start_datetime_local,
                   base_period_end_datetime_local,
                   reporting_start_datetime_local,
Severity: Minor
Found in myems-api/excelexporters/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

File tenantsaving.py has 747 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/tenantsaving.py - About 1 day to fix

    File tenantplan.py has 747 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/tenantplan.py - About 1 day to fix

      File virtualpowerplant.py has 747 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import uuid
      from datetime import datetime, timedelta
      import falcon
      import mysql.connector
      import simplejson as json
      Severity: Major
      Found in myems-api/core/virtualpowerplant.py - About 1 day to fix

        Function on_get has a Cognitive Complexity of 87 (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 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 shopfloorsaving.py has 744 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/shopfloorsaving.py - About 1 day to fix

          File shopfloorplan.py has 744 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/shopfloorplan.py - About 1 day to fix

            File storeload.py has 744 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/storeload.py - About 1 day to fix

              File storeplan.py has 743 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

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

                File storesaving.py has 743 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

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

                  File windfarm.py has 742 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  import uuid
                  from datetime import datetime, timedelta
                  import falcon
                  import mysql.connector
                  import simplejson as json
                  Severity: Major
                  Found in myems-api/core/windfarm.py - About 1 day to fix

                    File shopfloorload.py has 739 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/shopfloorload.py - About 1 day to fix

                      File photovoltaicpowerstation.py has 738 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      import uuid
                      from datetime import datetime, timedelta
                      import falcon
                      import mysql.connector
                      import simplejson as json
                      Severity: Major
                      Found in myems-api/core/photovoltaicpowerstation.py - About 1 day to fix

                        File datasource.py has 733 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

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

                          Function on_get has a Cognitive Complexity of 85 (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/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 tenantstatistics.py has 732 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/tenantstatistics.py - About 1 day to fix

                            File spacestatistics.py has 730 lines of code (exceeds 250 allowed). Consider refactoring.
                            Open

                            import base64
                            from core.utilities import get_translation
                            import os
                            import uuid
                            import openpyxl.utils.cell as format_cell
                            Severity: Major
                            Found in myems-api/excelexporters/spacestatistics.py - About 1 day to fix

                              Function on_get has a Cognitive Complexity of 84 (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/energystoragepowerstationdashboard.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