hugoruscitti/pilas

View on GitHub
pilasengine/fisica/__init__.py

Summary

Maintainability
F
4 days
Test Coverage

Fisica has 35 functions (exceeds 20 allowed). Consider refactoring.
Open

class Fisica(object):
    """Representa un simulador de mundo fisico, usando la biblioteca Box2D (version 2.1)."""

    def __init__(self, escena, pilas):
        """Inicializa el motor de física.
Severity: Minor
Found in pilasengine/fisica/__init__.py - About 4 hrs to fix

    Function Rectangulo has 12 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def Rectangulo(self, x=0, y=0, ancho=50, alto=20, dinamica=True, densidad=1.0,
    Severity: Major
    Found in pilasengine/fisica/__init__.py - About 1 hr to fix

      Function Circulo has 10 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def Circulo(self, x=0, y=0, radio=20, dinamica=True, densidad=1.0,
      Severity: Major
      Found in pilasengine/fisica/__init__.py - About 1 hr to fix

        Function _procesar_figuras_a_eliminar has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def _procesar_figuras_a_eliminar(self):
                "Elimina las figuras que han sido marcadas para quitar."
                if self.figuras_a_eliminar:
                    for x in self.figuras_a_eliminar:
                        # Solo elimina las figuras que actualmente existen.
        Severity: Minor
        Found in pilasengine/fisica/__init__.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

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

            def obtener_cuerpos_en(self, x, y):
                """Retorna una lista de cuerpos que se encuentran en la posicion (x, y) o retorna una lista vacia [].
        
                :param x: posición horizontal del punto a analizar.
                :param y: posición vertical del punto a analizar.
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 day to fix
        pilas/fisica.py on lines 294..319

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

        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

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

            def obtener_distancia_al_suelo(self, x, y, dy):
                """Obtiene la distancia hacia abajo desde el punto (x,y).
        
                El valor de 'dy' tiene que ser positivo.
        
        
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 4 hrs to fix
        pilas/fisica.py on lines 267..292

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

        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

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

            def _procesar_figuras_a_eliminar(self):
                "Elimina las figuras que han sido marcadas para quitar."
                if self.figuras_a_eliminar:
                    for x in self.figuras_a_eliminar:
                        # Solo elimina las figuras que actualmente existen.
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 2 hrs to fix
        pilas/fisica.py on lines 155..162

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

        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

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

            def eliminar_paredes(self):
                "Elimina las dos paredes del escenario."
                if self.pared_izquierda:
                    self.pared_derecha.eliminar()
                    self.pared_izquierda.eliminar()
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilas/fisica.py on lines 252..258

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

        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

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

            def reiniciar(self):
                """Elimina todos los objetos físicos y vuelve a crear el entorno."""
                lista = list(self.mundo.bodies)
        
                for x in lista:
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilas/fisica.py on lines 99..106

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

        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

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

            def crear_bordes_del_escenario(self):
                """Genera las paredes, el techo y el suelo."""
                self.crear_techo(self.area)
                self.crear_suelo(self.area)
                self.crear_paredes(self.area)
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilas/fisica.py on lines 93..97

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

        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

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

            def actualizar(self):
                """Realiza la actualización lógica del escenario.
                """
                if self.mundo:
                    self.mundo.Step(self.timeStep, 6, 3)
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilas/fisica.py on lines 136..143

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

        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

            def set_gravedad_y(self, nuevo_y):
                (x, _) = self.mundo.gravity
                self.mundo.gravity = (x, nuevo_y)
                self.despertar_a_todos()
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilasengine/fisica/__init__.py on lines 282..285

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

        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

            def set_gravedad_x(self, nuevo_x):
                (_, y) = self.mundo.gravity
                self.mundo.gravity = (nuevo_x, y)
                self.despertar_a_todos()
        Severity: Major
        Found in pilasengine/fisica/__init__.py and 1 other location - About 1 hr to fix
        pilasengine/fisica/__init__.py on lines 287..290

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

        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