duncanmmacleod/pip2conda

View on GitHub

Showing 9 of 9 total issues

File pip2conda.py has 549 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Copyright (C) Cardiff University (2022)
# SPDX-License-Identifier: GPL-3.0-or-later

"""Parse setup.cfg for package requirements and print out a list of
Severity: Major
Found in pip2conda/pip2conda.py - About 1 day to fix

    Function parse_all_requirements has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_all_requirements(
        project,
        python_version=None,
        extras=[],
        requirements_files=[],
    Severity: Minor
    Found in pip2conda/pip2conda.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

    Function parse_requirements_file has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_requirements_file(file, **kwargs):
        """Parse a requirements.txt-format file.
        """
        if isinstance(file, (str, os.PathLike)):
            with open(file, "r") as fileobj:
    Severity: Minor
    Found in pip2conda/pip2conda.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 pip2conda has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def pip2conda(
    Severity: Major
    Found in pip2conda/pip2conda.py - About 50 mins to fix

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

      def find_packages(requirements, use_mamba=True):
          """Run conda/mamba to resolve an environment
      
          This does not actually create an environment, but is called so
          that if it fails because packages are missing, they can be
      Severity: Minor
      Found in pip2conda/pip2conda.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 parse_all_requirements has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def parse_all_requirements(
      Severity: Minor
      Found in pip2conda/pip2conda.py - About 35 mins to fix

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

        def parse_requirements(
        Severity: Minor
        Found in pip2conda/pip2conda.py - About 35 mins to fix

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

          def parse_requirements(
              requirements,
              conda_forge_map=dict(),
              environment=None,
              extras=None,
          Severity: Minor
          Found in pip2conda/pip2conda.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 _evaluate_marker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def _evaluate_marker(marker, environment=None, extras=None):
              """Evaluate whether an environment marker matches this environment.
              """
              if not marker:  # no marker, always True
                  return True
          Severity: Minor
          Found in pip2conda/pip2conda.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