hugoruscitti/pilas

View on GitHub
pilas/actores/boton.py

Summary

Maintainability
D
2 days
Test Coverage

Boton has 22 functions (exceeds 20 allowed). Consider refactoring.
Open

class Boton(Actor):
    """Representa un boton que reacciona al ser presionado.

    .. image:: images/actores/boton_normal.png

Severity: Minor
Found in pilas/actores/boton.py - About 2 hrs to fix

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

        def __init__(self, x=0, y=0,
    Severity: Minor
    Found in pilas/actores/boton.py - About 35 mins to fix

      Function ejecutar_funciones_over has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def ejecutar_funciones_over(self):
              if self.estado == True:
                  for i in self.funciones_over:
                      if i[1] == "null":
                          i[0]()
      Severity: Minor
      Found in pilas/actores/boton.py - About 35 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 ejecutar_funciones_normal has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def ejecutar_funciones_normal(self):
              if self.estado == True:
                  for i in self.funciones_normal:
                      if i[1] == "null":
                          i[0]()
      Severity: Minor
      Found in pilas/actores/boton.py - About 35 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 ejecutar_funciones_press has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def ejecutar_funciones_press(self):
              if self.estado == True:
                  for i in self.funciones_press:
                      if i[1] == "null":
                          i[0]()
      Severity: Minor
      Found in pilas/actores/boton.py - About 35 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 3 locations. Consider refactoring.
      Open

          def ejecutar_funciones_normal(self):
              if self.estado == True:
                  for i in self.funciones_normal:
                      if i[1] == "null":
                          i[0]()
      Severity: Major
      Found in pilas/actores/boton.py and 2 other locations - About 3 hrs to fix
      pilas/actores/boton.py on lines 160..166
      pilas/actores/boton.py on lines 168..174

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

      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

          def ejecutar_funciones_over(self):
              if self.estado == True:
                  for i in self.funciones_over:
                      if i[1] == "null":
                          i[0]()
      Severity: Major
      Found in pilas/actores/boton.py and 2 other locations - About 3 hrs to fix
      pilas/actores/boton.py on lines 152..158
      pilas/actores/boton.py on lines 160..166

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

      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

          def ejecutar_funciones_press(self):
              if self.estado == True:
                  for i in self.funciones_press:
                      if i[1] == "null":
                          i[0]()
      Severity: Major
      Found in pilas/actores/boton.py and 2 other locations - About 3 hrs to fix
      pilas/actores/boton.py on lines 152..158
      pilas/actores/boton.py on lines 168..174

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

      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 detection_move_mouse(self, evento):
              if self.colisiona_con_un_punto(evento.x, evento.y):
                  self.ejecutar_funciones_over()
              else:
                  self.ejecutar_funciones_normal()
      Severity: Minor
      Found in pilas/actores/boton.py and 1 other location - About 55 mins to fix
      pilasengine/actores/boton.py on lines 167..171

      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 6 locations. Consider refactoring.
      Open

          def desconectar_normal(self, funcion, arg="null"):
              """ Elimina el método indicado asociado al estado normal del botón.
      
              :param funcion: Método al que se llama cuando el botón pasa estado Normal.
              :param arg: Argumentos que se pasaban a la funcion.
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 68..81
      pilas/actores/boton.py on lines 83..96
      pilas/actores/boton.py on lines 98..111
      pilas/actores/boton.py on lines 134..141
      pilas/actores/boton.py on lines 143..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 32.

      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 6 locations. Consider refactoring.
      Open

          def conectar_sobre(self, funcion, arg="null"):
              """ Permite conectar un metodo para que sea ejecutado cuando el ratón
              pasa por encima del botón.
      
              >>> def cuando_pasa_sobre_el_boton():
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 68..81
      pilas/actores/boton.py on lines 83..96
      pilas/actores/boton.py on lines 125..132
      pilas/actores/boton.py on lines 134..141
      pilas/actores/boton.py on lines 143..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 32.

      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 6 locations. Consider refactoring.
      Open

          def desconectar_presionado(self, funcion, arg="null"):
              """ Elimina el método indicado asociado al estado presinado del botón.
      
              :param funcion: Método al que se llama cuando el botón pasa estado Presionado.
              :param arg: Argumentos que se pasaban a la funcion.
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 68..81
      pilas/actores/boton.py on lines 83..96
      pilas/actores/boton.py on lines 98..111
      pilas/actores/boton.py on lines 125..132
      pilas/actores/boton.py on lines 143..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 32.

      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 6 locations. Consider refactoring.
      Open

          def desconectar_sobre(self, funcion, arg="null"):
              """ Elimina el método indicado asociado al estado sobre del botón.
      
              :param funcion: Método al que se llama cuando el botón pasa estado Sobre.
              :param arg: Argumentos que se pasaban a la funcion.
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 68..81
      pilas/actores/boton.py on lines 83..96
      pilas/actores/boton.py on lines 98..111
      pilas/actores/boton.py on lines 125..132
      pilas/actores/boton.py on lines 134..141

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

      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 6 locations. Consider refactoring.
      Open

          def conectar_presionado(self, funcion, arg="null"):
              """ Permite conectar un metodo para que sea ejecutado cuando el botón
              se presiona.
      
              >>> def cuando_pulsan_el_boton():
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 68..81
      pilas/actores/boton.py on lines 98..111
      pilas/actores/boton.py on lines 125..132
      pilas/actores/boton.py on lines 134..141
      pilas/actores/boton.py on lines 143..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 32.

      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 6 locations. Consider refactoring.
      Open

          def conectar_normal(self, funcion, arg="null"):
              """ Permite conectar un metodo para que sea ejecutado cuando el botón
              pase al estado normal.
      
              >>> def cuando_deja_de_pulsar():
      Severity: Major
      Found in pilas/actores/boton.py and 5 other locations - About 30 mins to fix
      pilas/actores/boton.py on lines 83..96
      pilas/actores/boton.py on lines 98..111
      pilas/actores/boton.py on lines 125..132
      pilas/actores/boton.py on lines 134..141
      pilas/actores/boton.py on lines 143..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 32.

      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