BjornFJohansson/pydna

View on GitHub

Showing 140 of 219 total issues

File __init__.py has 273 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
# license.  Please see the LICENSE.txt file that should have been included
Severity: Minor
Found in src/pydna/__init__.py - About 2 hrs to fix

    Function gelplot_imshow has 20 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def gelplot_imshow(
    Severity: Major
    Found in scripts/gel/gel_old.py - About 2 hrs to fix

      Function run has 20 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def run(
      Severity: Major
      Found in scripts/gel/gel_old.py - About 2 hrs to fix

        Function tm_dbd has 19 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def tm_dbd(
        Severity: Major
        Found in src/pydna/tm.py - About 2 hrs to fix

          Function _all_simple_paths_graph has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

          def _all_simple_paths_graph(G, source, target, cutoff=None):
              if source not in G:
                  raise _nx.NetworkXError("source node %s not in graph" % source)
              if target not in G:
                  raise _nx.NetworkXError("target node %s not in graph" % source)
          Severity: Minor
          Found in scripts/_simple_paths8.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 T4 has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def T4(self, nucleotides=None):
                  """Fill in five prime protruding ends and chewing back
                  three prime protruding ends by a DNA polymerase providing both
                  5'-3' DNA polymerase activity and 3'-5' nuclease acitivty
                  (such as T4 DNA polymerase). This can be done in presence of any
          Severity: Minor
          Found in src/pydna/dseq.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 __init__ has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
          Open

              def __init__(
                  self,
                  record,
                  *args,
                  # linear=None,
          Severity: Minor
          Found in src/pydna/dseqrecord.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 gelplot_imshow has 54 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def gelplot_imshow(
              distances,
              bandwidths,
              intensities,
              lanes,
          Severity: Major
          Found in scripts/gel/gel_old.py - About 2 hrs to fix

            Function run has 54 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def run(
                    self,
                    field=5.0,  # V/cm
                    temperature=295.15,  # K
                    runtime=None,  # seconds
            Severity: Major
            Found in scripts/gel/gel2.py - About 2 hrs to fix

              File tm.py has 255 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
              # license.  Please see the LICENSE.txt file that should have been included
              Severity: Minor
              Found in src/pydna/tm.py - About 2 hrs to fix

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

                    def write(self, filename=None, f="gb"):
                        """Writes the Dseqrecord to a file using the format f, which must
                        be a format supported by Biopython SeqIO for writing [#]_. Default
                        is "gb" which is short for Genbank. Note that Biopython SeqIO reads
                        more formats than it writes.
                Severity: Minor
                Found in src/pydna/dseqrecord.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 shift_location has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                Open

                def shift_location(original_location, shift, lim):
                    """docstring."""
                    newparts = []
                    strand = original_location.strand
                
                
                Severity: Minor
                Found in src/pydna/utils.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 toJSON has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                def toJSON(gbkstring):
                    parsed = multipleGB.parseString(gbkstring)
                
                    jseqlist = []
                
                
                Severity: Minor
                Found in src/pydna/genbankfixer.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 download_text has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                def download_text(url):
                    cached = False
                    refresh = False
                    cache = _shelve.open(
                        _os.path.join(_os.environ["pydna_data_dir"], "web"),
                Severity: Minor
                Found in scripts/memo/download_old.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 synced has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    def synced(self, ref, limit=25):
                        """This method returns a new circular sequence (Dseqrecord object), which has been rotated
                        in such a way that there is maximum overlap between the sequence and
                        ref, which may be a string, Biopython Seq, SeqRecord object or
                        another Dseqrecord object.
                Severity: Minor
                Found in src/pydna/dseqrecord.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 __init__ has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, frags=None, limit=25, algorithm=common_sub_strings):
                        # Fragments is a string subclass with some extra properties
                        # The order of the fragments has significance
                        fragments = []
                        for f in frags:
                Severity: Minor
                Found in src/pydna/assembly.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 assign_quantitiesB has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                Open

                def assign_quantitiesB(samples, maxdef=Q_(150, "ng")):
                    """
                    Assigns quantities (masses in nanograms) to the DNA fragments without
                    corresponding quantity assuming a linear relationship between the DNA
                    length (in basepairs) and its mass. As if the fragments originated in
                Severity: Minor
                Found in scripts/gel/gel_old.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 __getitem__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __getitem__(self, i):
                        """Save indices of accessed items."""
                        if isinstance(i, slice):
                            result = self.__class__(self.data[i])
                            for ind in range(i.start, i.stop, i.step or 1):
                Severity: Minor
                Found in src/pydna/myprimers.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 __getitem__ has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __getitem__(self, sl):
                        """docstring."""
                        answer = Dseqrecord(_copy.copy(self))
                        answer.seq = self.seq.__getitem__(sl)
                        # answer.seq.alphabet = self.seq.alphabet
                Severity: Minor
                Found in src/pydna/dseqrecord.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 ferguson_to_mu0 has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                def ferguson_to_mu0(
                    field,
                    Tvals,
                    DNAvals,
                    dataset,
                Severity: Minor
                Found in scripts/gel/gel_old.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

                Severity
                Category
                Status
                Source
                Language