BjornFJohansson/pydna

View on GitHub
src/pydna/seqrecord.py

Summary

Maintainability
D
2 days
Test Coverage

File seqrecord.py has 562 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/env python3
# -*- coding: utf-8 -*-

# Copyright 2013-2023 by Björn Johansson.  All rights reserved.
# This code is part of the Python-dna distribution and governed by its
Severity: Major
Found in src/pydna/seqrecord.py - About 1 day to fix

    SeqRecord has 40 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class SeqRecord(_SeqRecord):
        """
        A subclass of the Biopython SeqRecord class.
    
        Has a number of extra methods and uses
    Severity: Minor
    Found in src/pydna/seqrecord.py - About 5 hrs to fix

      Function add_feature has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_feature(self, x=None, y=None, seq=None, type_="misc", strand=1, *args, **kwargs):
              """Add a feature of type misc to the feature list of the sequence.
      
              Parameters
              ----------
      Severity: Minor
      Found in src/pydna/seqrecord.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 lcs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def lcs(self, other, *args, limit=25, **kwargs):
              """Return the longest common substring between the sequence.
      
              and another sequence (other). The other sequence can be a string,
              Seq, SeqRecord, Dseq or DseqRecord.
      Severity: Minor
      Found in src/pydna/seqrecord.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 add_feature has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def add_feature(self, x=None, y=None, seq=None, type_="misc", strand=1, *args, **kwargs):
      Severity: Major
      Found in src/pydna/seqrecord.py - About 50 mins to fix

        Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self, seq, *args, id="id", name="name", description="description", **kwargs):
        Severity: Minor
        Found in src/pydna/seqrecord.py - About 45 mins to fix

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

              def list_features(self):
                  """Print ASCII table with all features.
          
                  Examples
                  --------
          Severity: Minor
          Found in src/pydna/seqrecord.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

          There are no issues that match your filters.

          Category
          Status