berpress/swagger-coverage

View on GitHub

Showing 11 of 11 total issues

Function merge_results has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

    def merge_results(self, paths: List[Path]) -> SwaggerData:
        """
        merge results in one obj (dict)
        need, for example, if you use pytest xdist
        """
Severity: Minor
Found in swagger_coverage/src/results/load_results.py - About 1 hr 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 create has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def create(self, path):
        # script
        script = JS_SCRIPT
        # head
        head = Head(title="Swagger Report")
Severity: Minor
Found in swagger_coverage/src/report/html/html_report.py - About 1 hr to fix

    Function _set_check_result has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
    Open

        def _set_check_result(
            key: str, status_code: int, data: dict, time_execution: float
        ) -> dict:
            """
            Set check result
    Severity: Minor
    Found in swagger_coverage/src/check_data.py - About 1 hr 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 __init__ has 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(
    Severity: Major
    Found in swagger_coverage/src/report/html/models.py - About 1 hr to fix

      Function get_summary has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_summary(self):
              """
              Calculate report summary
              """
              # init stats
      Severity: Minor
      Found in swagger_coverage/src/results/swagger_summary.py - About 45 mins 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 _sort_requests_results has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def _sort_requests_results(dself, data: dict) -> List:
              """
              Sort request result
              """
              results = []
      Severity: Minor
      Found in swagger_coverage/src/report/html/table.py - About 45 mins 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 load_swagger has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_swagger(urls) -> SwaggerResponse:
          """
          Load and get swagger data
          """
          path_data = []
      Severity: Minor
      Found in swagger_coverage/src/requests.py - About 45 mins 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 __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(
      Severity: Minor
      Found in swagger_coverage/src/coverage.py - About 35 mins to fix

        Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(
        Severity: Minor
        Found in swagger_coverage/src/models/stats.py - About 35 mins to fix

          Function _calculate_list_dict_res has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def _calculate_list_dict_res(self, res1: list, res2: list):
                  res = res1 + res2
                  total = {}
                  for item in res:
                      for key, val in item.items():
          Severity: Minor
          Found in swagger_coverage/src/results/load_results.py - About 35 mins 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 prepare_check_file_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def prepare_check_file_data(data: dict) -> dict:
                  """
                  Prepare data for check
                  """
                  for k, value in data.items():
          Severity: Minor
          Found in swagger_coverage/src/prepare_data.py - About 25 mins 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