igorcoding/asynctnt

View on GitHub

Showing 10 of 16 total issues

File instance.py has 698 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import abc
import asyncio
import asyncio.subprocess
import functools
import logging
Severity: Major
Found in asynctnt/instance.py - About 1 day to fix

    File connection.py has 531 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import asyncio
    import enum
    import functools
    import os
    from typing import Optional, Type, Union
    Severity: Major
    Found in asynctnt/connection.py - About 1 day to fix

      File api.py has 362 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import enum
      from typing import Any, Dict, List, Optional, Union
      
      from asynctnt.iproto import protocol
      
      
      Severity: Minor
      Found in asynctnt/api.py - About 4 hrs to fix

        Function _log_reader has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def _log_reader(self):
                def check_io():
                    fds = []
                    for h in [self._process.stdout, self._process.stderr]:
                        if h is not None and not h.closed:
        Severity: Minor
        Found in asynctnt/instance.py - About 3 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

        File exceptions.py has 278 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import enum
        from typing import Optional
        
        from asynctnt.iproto.protocol import IProtoError
        
        
        Severity: Minor
        Found in asynctnt/exceptions.py - About 2 hrs to fix

          Function cythonize has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

              def cythonize(self):
                  try:
                      import Cython
                  except ImportError as e:
                      raise RuntimeError(
          Severity: Minor
          Found in setup.py - About 2 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 main has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def main():
              logging.basicConfig(level=logging.DEBUG, stream=sys.stdout)
              parser = argparse.ArgumentParser()
              parser.add_argument(
                  "-n", type=int, default=200000, help="number of executed requests"
          Severity: Minor
          Found in bench/benchmark.py - About 2 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 start has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def start(self, *, wait=True, recreate=True):
                  self._logger.info("Starting Tarantool instance (%s)", self._title)
                  initlua_path = self.prepare(recreate)
                  self._logger.info("Launching process")
          
          
          Severity: Minor
          Found in asynctnt/instance.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 _wait has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def _wait(self, timeout, wait=True):
                  if self._process:
                      if wait:
                          try:
                              self._process.wait(timeout)
          Severity: Minor
          Found in asynctnt/instance.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

          Avoid deeply nested control flow statements.
          Open

                                  if os.path.exists(cfile) and not self.cython_always:
                                      extension.sources[i] = cfile
                                  else:
                                      need_cythonize = True
          
          
          Severity: Major
          Found in setup.py - About 45 mins to fix
            Severity
            Category
            Status
            Source
            Language