smok-serwis/smok-client

View on GitHub

Showing 7 of 24 total issues

File client.py has 685 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import datetime
import io
import logging
import os
import tempfile
Severity: Major
Found in smok/client/client.py - About 1 day to fix

    File communicator.py has 336 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import logging
    import queue
    import time
    import typing as tp
    
    
    Severity: Minor
    Found in smok/threads/communicator.py - About 4 hrs to fix

      Function __init__ has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def __init__(self, cert: tp.Union[str, io.StringIO],
                       priv_key: tp.Union[str, io.StringIO],
                       evt_database: tp.Union[str, BaseEventDatabase],
                       pp_database: tp.Optional[BasePathpointDatabase] = None,
                       macro_database: tp.Optional[BaseMacroDatabase] = None,
      Severity: Major
      Found in smok/client/client.py - About 2 hrs to fix

        Function __init__ has 23 arguments (exceeds 15 allowed). Consider refactoring.
        Open

            def __init__(self, cert: tp.Union[str, io.StringIO],
        Severity: Major
        Found in smok/client/client.py - About 1 hr to fix

          Function process_orders has a Cognitive Complexity of 56 (exceeds 50 allowed). Consider refactoring.
          Open

              def process_orders(self, orders) -> tp.List[Order]:
                  """
                  Do some orders and return those that need to be retried
                  """
                  futures_to_complete = []
          Severity: Minor
          Found in smok/threads/executor.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

          Avoid deeply nested control flow statements.
          Open

                                      if not isinstance(fut, Future):
                                          if fut is not None:
                                              pathpoint.set_new_value(time_ms(), fut)
                                      else:
                                          fut.add_done_callback(on_read_completed_factory(pathpoint))
          Severity: Major
          Found in smok/threads/executor.py - About 45 mins to fix

            Avoid too many return statements within this function.
            Open

                                    return {}
            Severity: Major
            Found in smok/client/api.py - About 30 mins to fix
              Severity
              Category
              Status
              Source
              Language