KarrLab/pkg_utils

View on GitHub

Showing 14 of 22 total issues

File core.py has 385 lines of code (exceeds 250 allowed). Consider refactoring.
Open

""" Utilities for linking setuptools with package version metadata, 
GitHub README.md files, requirements.txt files, and restoring overridden
entry points during for editable installations.

:Author: Jonathan Karr <jonrkarr@gmail.com>
Severity: Minor
Found in pkg_utils/core.py - About 5 hrs to fix

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

    def parse_requirement_line(line, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
        """ Parse lines from a requirements.txt file into list of requirements and dependency links
    
        Args:
            line (:obj:`str`): line from a requirements.txt file
    Severity: Minor
    Found in pkg_utils/core.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_optional_requirements_file has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
    Open

    def parse_optional_requirements_file(filename, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
        """ Parse a requirements.optional.txt file into list of requirements and dependency links
    
        Args:
            filename (:obj:`str`): path to requirements.txt file
    Severity: Minor
    Found in pkg_utils/core.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 expand_package_data_filename_patterns has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def expand_package_data_filename_patterns(dirname, package_data_filename_patterns=None):
        """ Expand the package data filenames
    
        Args:
            :obj:`dict`: package data
    Severity: Minor
    Found in pkg_utils/core.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 get_dependencies has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    def get_dependencies(dirname, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
        """ Parse required and optional dependencies from requirements.txt files
    
        Args:
            dirname (:obj:`str`): path to the package
    Severity: Minor
    Found in pkg_utils/core.py - About 1 hr to fix

      Avoid deeply nested control flow statements.
      Open

                          if not match:
                              raise ValueError(
                                  'Could not parse optional dependency: {}'.format(line))
                          option = match.group(1)
      Severity: Major
      Found in pkg_utils/core.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                            if option not in extras_require:
                                extras_require[option] = []
                            extras_require[option] += tmp1
        Severity: Major
        Found in pkg_utils/core.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                              if option is None:
                                  raise ValueError(
                                      "Required dependencies should not be placed in an optional dependencies file: {}".format(line))
                              tmp1, tmp2 = parse_requirement_lines([line],
          Severity: Major
          Found in pkg_utils/core.py - About 45 mins to fix

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

            def get_dependencies(dirname, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
            Severity: Minor
            Found in pkg_utils/core.py - About 35 mins to fix

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

              def parse_requirement_lines(lines, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
              Severity: Minor
              Found in pkg_utils/core.py - About 35 mins to fix

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

                def parse_optional_requirements_file(filename, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
                Severity: Minor
                Found in pkg_utils/core.py - About 35 mins to fix

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

                  def parse_requirement_line(line, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
                  Severity: Minor
                  Found in pkg_utils/core.py - About 35 mins to fix

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

                    def parse_requirements_file(filename, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
                    Severity: Minor
                    Found in pkg_utils/core.py - About 35 mins to fix

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

                      def get_dependencies(dirname, include_uri=False, include_extras=True, include_specs=True, include_markers=True):
                          """ Parse required and optional dependencies from requirements.txt files
                      
                          Args:
                              dirname (:obj:`str`): path to the package
                      Severity: Minor
                      Found in pkg_utils/core.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

                      Severity
                      Category
                      Status
                      Source
                      Language