hugoruscitti/pilas

View on GitHub
pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py

Summary

Maintainability
F
2 wks
Test Coverage

Function analizar_pares has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
Open

    def analizar_pares(self):

        def aumentar_pares():
            self.cantidad_de_pares += 1
            self.parejas.definir(self.cantidad_de_pares)
Severity: Minor
Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py - About 4 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 pintar_boton_x has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def pintar_boton_x(self, n):
        if self.estado == True:
            if n.primera_vez_presionado == False:
            
                for c in 'abcdefghijklmnopqrstu':
Severity: Minor
Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.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 generar_array_caracteres has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def generar_array_caracteres(self):
        # lista con caracteres

        # lista con caracteres aleatorios
        caracteres_aleatorios = []
Severity: Minor
Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.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 iniciar_juego has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def iniciar_juego(self, nivel):
        pilas.actores.utils.eliminar_a_todos()
        pilas.fondos.Fondo('data/fondo.png')

        if nivel == 1:
Severity: Minor
Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.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 self.intentos[0][0] == c: 
                            boton_x = encontrar_boton_x(c)
                            boton_x2 = encontrar_boton_x(c + '2')
                            pilas.mundo.agregar_tarea_una_vez(self.tiempo, borrar_ficha_x, boton_x, boton_x2)

Severity: Major
Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py - About 45 mins to fix

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

        def iniciar_juego(self, nivel):
            pilas.actores.utils.eliminar_a_todos()
            pilas.fondos.Fondo('data/fondo.png')
    
            if nivel == 1:
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 6 days to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 26..122

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

    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 analizar_pares(self):
    
            def aumentar_pares():
                self.cantidad_de_pares += 1
                self.parejas.definir(self.cantidad_de_pares)
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 4 days to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 234..294

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

    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 configurar_botones(self):
            x = 0
    
            for i in range(self.columnas):
                for j in range(self.filas):        
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 2 days to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 296..316

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

    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 generar_array_caracteres(self):
            # lista con caracteres
    
            # lista con caracteres aleatorios
            caracteres_aleatorios = []
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 1 day to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 162..198

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

    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 pintar_boton_x(self, n):
            if self.estado == True:
                if n.primera_vez_presionado == False:
                
                    for c in 'abcdefghijklmnopqrstu':
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 1 day to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 203..217

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

    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 termino_juego(self):
            self.termino = pilas.actores.Actor("termino.png")
            self.termino.y = 300
            self.termino.y = pilas.interpolar(0, 2)
    
    
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 7 hrs to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 219..231

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

    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_puntaje(self):
            self.puntaje = pilas.actores.Puntaje()
            self.puntaje.definir(puntuacion.p)
            self.puntaje.x = -200
            self.puntaje.y = 55
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 2 hrs to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 138..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 59.

    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_nivel(self, nivel):
            self.nivel_texto = pilas.actores.Puntaje()
            self.nivel_texto.x = -200
            self.nivel_texto.y = 93
            self.nivel_texto.magnitud = 18
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 2 hrs to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 152..157

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

    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_parejas(self):
            self.parejas = pilas.actores.Puntaje()
            self.parejas.definir(0)
            self.parejas.x = -200
            self.parejas.y = 17
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 2 hrs to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 145..150

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

    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

    class boton_personalizado:
        def __init__(self, x = 0, y = 0):
    
            ruta_normal = "casilla.png"        
    
    
    Severity: Major
    Found in pilas/ejemplos/ejemplos/minijuegos/memorice/escena_juego.py and 1 other location - About 1 hr to fix
    pilasengine/ejemplos/ejemplos_a_revisar/memorice/escena_juego.py on lines 319..326

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

    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