freqtrade/freqtrade

View on GitHub
freqtrade/resolvers/iresolver.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function _search_all_objects has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    def _search_all_objects(
            cls, directory: Path, enum_failed: bool, recursive: bool = False,
            basedir: Optional[Path] = None) -> List[Dict[str, Any]]:
        """
        Searches a directory for valid objects
Severity: Minor
Found in freqtrade/resolvers/iresolver.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 _search_object has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _search_object(cls, directory: Path, *, object_name: str, add_source: bool = False
                       ) -> Union[Tuple[Any, Path], Tuple[None, None]]:
        """
        Search for the objectname in the given directory
        :param directory: relative or absolute directory path
Severity: Minor
Found in freqtrade/resolvers/iresolver.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 load_object has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def load_object(cls, object_name: str, config: Config, *, kwargs: dict,
Severity: Minor
Found in freqtrade/resolvers/iresolver.py - About 45 mins to fix

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

        def _search_all_objects(
    Severity: Minor
    Found in freqtrade/resolvers/iresolver.py - About 35 mins to fix

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

          def _load_object(cls, paths: List[Path], *, object_name: str, add_source: bool = False,
      Severity: Minor
      Found in freqtrade/resolvers/iresolver.py - About 35 mins to fix

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

            def _get_valid_object(cls, module_path: Path, object_name: Optional[str],
                                  enum_failed: bool = False) -> Iterator[Any]:
                """
                Generator returning objects with matching object_type and object_name in the path given.
                :param module_path: absolute path to the module
        Severity: Minor
        Found in freqtrade/resolvers/iresolver.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 build_search_paths has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def build_search_paths(cls, config: Config, user_subdir: Optional[str] = None,
                                   extra_dirs: Optional[List[str]] = None) -> List[Path]:
        
                abs_paths: List[Path] = []
                if cls.initial_search_path:
        Severity: Minor
        Found in freqtrade/resolvers/iresolver.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

        There are no issues that match your filters.

        Category
        Status