BjornFJohansson/pydna

View on GitHub

Showing 219 of 219 total issues

Identical blocks of code found in 2 locations. Consider refactoring.
Open

    return (gamma * muL * lp * b / mu0) ** (1 / 2)
Severity: Minor
Found in scripts/gel/gel_old.py and 1 other location - About 55 mins to fix
scripts/gel/gel2.py on lines 305..305

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function wrapstring has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

def wrapstring(str_, rowstart, rowend, padfirst=True):
    """
    wraps the provided string in lines of length rowend-rowstart
    and padded on the left by rowstart.
    -> if padfirst is false the first line is not padded
Severity: Minor
Found in scripts/BioJSON-master/genbank_writer.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

    T_space = list(_np.linspace(minT.magnitude, maxT.magnitude, divsT)) * ureg(str(minT.units))
Severity: Minor
Found in scripts/gel/gel_old.py and 1 other location - About 55 mins to fix
scripts/gel/gel_old.py on lines 1756..1756

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 37.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

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 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs):
    Severity: Major
    Found in src/pydna/genbankrecord.py - About 50 mins to fix

      Function from_SeqRecord has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def from_SeqRecord(cls, record, *args, item="accession", start=None, stop=None, strand=1, **kwargs):
      Severity: Major
      Found in src/pydna/genbankrecord.py - About 50 mins to fix

        Function from_string has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def from_string(
        Severity: Major
        Found in src/pydna/genbankrecord.py - About 50 mins to fix

          Function primer_design has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def primer_design(template, fp=None, rp=None, limit=13, target_tm=55.0, tm_func=_tm_default, **kwargs):
          Severity: Major
          Found in src/pydna/design.py - About 50 mins to fix

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

                def __init__(
            Severity: Major
            Found in src/pydna/dseqrecord.py - About 50 mins to fix

              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/dseqrecord.py - About 50 mins to fix

                Function size_to_mobility has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def size_to_mobility(
                Severity: Major
                Found in scripts/gel/gel_old.py - About 50 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                          if not bckwdYstop:
                                              distYbck = Q_(pxlYbck, "px") / res
                                              bckYI = Gaussian(distYbck, maxI, distYmid, std_dev)
                                              if pxlYbck < len(rgb_arr):
                                                  rgb_arr[pxlYbck, from_x:to_x] += bckYI
                  Severity: Major
                  Found in scripts/gel/gel2.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if not forwdYstop:
                                                distYfor = Q_(pxlYfor, "px") / res
                                                forYI = Gaussian(distYfor, maxI, distYmid, std_dev)
                                                rgb_arr[pxlYfor, from_x:to_x] += forYI
                                                pxlYfor += 1
                    Severity: Major
                    Found in scripts/gel/gel2.py - About 45 mins to fix

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

                          def nucleotide(self, item: str, seq_start=None, seq_stop=None, strand=1):
                              """This method downloads a genbank nuclotide record from genbank. This method is
                              cached by default. This can be controlled by editing the **pydna_cached_funcs** environment
                              variable. The best way to do this permanently is to edit the edit the
                              `pydna.ini` file. See the documentation of :func:`pydna.open_config_folder`
                      Severity: Minor
                      Found in src/pydna/genbank.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

                      Avoid deeply nested control flow statements.
                      Open

                                              if f.location.start > len(ct) and f.location.end > len(ct):
                                                  f.location += -len(ct)
                                              elif f.location.end > len(ct):
                                                  f.location = _CompoundLocation(
                                                      (
                      Severity: Major
                      Found in src/pydna/assembly.py - About 45 mins to fix

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

                            def __init__(
                        Severity: Minor
                        Found in src/pydna/dseq.py - About 45 mins to fix

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

                              def __init__(self, record, *args, template=None, forward_primer=None, reverse_primer=None, **kwargs):
                          Severity: Minor
                          Found in src/pydna/amplicon.py - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                if k in [
                                                    "ApEinfo_label",
                                                    "ApEinfo_fwdcolor",
                                                    "ApEinfo_revcolor",
                                                    "label",
                            Severity: Major
                            Found in src/pydna/genbankfixer.py - About 45 mins to fix

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

                              def reduced_field(eta, a, mu0, E, kB, T):
                              Severity: Minor
                              Found in scripts/gel/gel_old.py - About 45 mins to fix

                                Avoid deeply nested control flow statements.
                                Open

                                                    if forYI <= Itol or pxlYfor == pxl_y:
                                                        forwdYstop = True
                                    # Background color
                                    if noise is None or noise <= 0:
                                Severity: Major
                                Found in scripts/gel/gel_old.py - About 45 mins to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language