vanheeringen-lab/genomepy

View on GitHub

Showing 5 of 5 total issues

Function install_genome has a Cognitive Complexity of 31 (exceeds 10 allowed). Consider refactoring.
Open

def install_genome(
    name: str,
    provider: Optional[str] = None,
    genomes_dir: Optional[str] = None,
    localname: Optional[str] = None,
Severity: Minor
Found in genomepy/functions.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 __init__ has 28 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def __init__(self, name: str, genomes_dir: str = None, quiet: bool = False):
        # name and directory
        n, g = _get_name_and_dir(name, genomes_dir)
        self.name = n
        "genome name"
Severity: Minor
Found in genomepy/annotation/__init__.py - About 1 hr to fix

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

        def __init__(self, name, genomes_dir=None, *args, **kwargs):
            self.name = safe(os.path.basename(re.sub(r"\.fa(\.gz)?$", "", name)))
            "genome name"
            self.genomes_dir = get_genomes_dir(genomes_dir, check_exist=False)
            "path to the genomepy genomes directory"
    Severity: Minor
    Found in genomepy/genome/__init__.py - About 1 hr to fix

      Function gtf_dict has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring.
      Open

          def gtf_dict(
              self, key, value, string_values=True, annot: Union[str, pd.DataFrame] = "gtf"
          ):
              """
              Create a dictionary based on the columns or attribute fields in a GTF.
      Severity: Minor
      Found in genomepy/annotation/__init__.py - About 55 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 bed_to_seq has a Cognitive Complexity of 11 (exceeds 10 allowed). Consider refactoring.
      Open

      def bed_to_seq(self, vals, stranded=False, extend_up=0, extend_down=0):
          chrom, start, end = str(vals[0]), int(vals[1]), int(vals[2])
          name = f"{chrom}:{start}-{end}"
      
          # there might be more...
      Severity: Minor
      Found in genomepy/genome/sequences.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