madrisan/dynamic-systems-and-chaos

View on GitHub
dynamic-systems-and-chaos/lelib.py

Summary

Maintainability
D
2 days
Test Coverage

File lelib.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/usr/bin/python3

# Logistic Equation Library
# Copyright (C) 2016-2018 Davide Madrisan <davide.madrisan@gmail.com>
# SPDX-License-Identifier: Apache-2.0
Severity: Minor
Found in dynamic-systems-and-chaos/lelib.py - About 2 hrs to fix

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

        def __init__(self, r, n, x0, x1, s=0, mapname="logistic"):
    Severity: Minor
    Found in dynamic-systems-and-chaos/lelib.py - About 45 mins to fix

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

          def __init__(self, r, n=1000, x0=0.5, s=2000, mapname="logistic"):
      Severity: Minor
      Found in dynamic-systems-and-chaos/lelib.py - About 35 mins to fix

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

            def __init__(self, r, n, x0, s=0, mapname="logistic"):
        Severity: Minor
        Found in dynamic-systems-and-chaos/lelib.py - About 35 mins to fix

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

              def __init__(self, r, y, n=100, s=200, mapname="logistic"):
          Severity: Minor
          Found in dynamic-systems-and-chaos/lelib.py - About 35 mins to fix

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

                    self.ensure(
                        y[0] >= self.map_ymin and y[0] < y[1] and y[1] <= self.map_ymax,
                        (
                            "The parameters [y0, y1] must be between %g and %g, "
                            "and in ascending order."
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 1 other location - About 3 hrs to fix
            dynamic-systems-and-chaos/lelib.py on lines 288..295

            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 68.

            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

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

                    self.ensure(
                        r[0] >= self.map_rmin and r[0] < r[1] and r[1] <= self.map_rmax,
                        (
                            "The parameters [r0, r1] must be between %g and %g, "
                            "and in ascending order."
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 1 other location - About 3 hrs to fix
            dynamic-systems-and-chaos/lelib.py on lines 298..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 68.

            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

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

                    for t in self.x[1:]:
                        self.y1[t] = self.map(self.r, self.y1[t - 1])
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 1 other location - About 2 hrs to fix
            dynamic-systems-and-chaos/lelib.py on lines 238..239

            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 50.

            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

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

                    for t in self.x[1:]:
                        self.y2[t] = self.map(self.r, self.y2[t - 1])
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 1 other location - About 2 hrs to fix
            dynamic-systems-and-chaos/lelib.py on lines 118..119

            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 50.

            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

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

                    self.ensure(
                        x0 >= self.map_ymin and x0 <= self.map_ymax,
                        "The initial condition x0 should be in [%g, %g].",
                        self.map_ymin,
                        self.map_ymax,
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 2 other locations - About 55 mins to fix
            dynamic-systems-and-chaos/lelib.py on lines 53..57
            dynamic-systems-and-chaos/lelib.py on lines 216..220

            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

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

                    self.ensure(
                        x1 >= self.map_ymin and x1 <= self.map_ymax,
                        "The initial condition x1 should be in [%g, %g].",
                        self.map_ymin,
                        self.map_ymax,
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 2 other locations - About 55 mins to fix
            dynamic-systems-and-chaos/lelib.py on lines 53..57
            dynamic-systems-and-chaos/lelib.py on lines 78..82

            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

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

                    self.ensure(
                        (r >= self.map_rmin and r <= self.map_rmax),
                        "The growth parameter r must be between %g and %g",
                        self.map_rmin,
                        self.map_rmax,
            Severity: Major
            Found in dynamic-systems-and-chaos/lelib.py and 2 other locations - About 55 mins to fix
            dynamic-systems-and-chaos/lelib.py on lines 78..82
            dynamic-systems-and-chaos/lelib.py on lines 216..220

            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

            There are no issues that match your filters.

            Category
            Status