hugoruscitti/pilas

View on GitHub
pilas/motores/motor_qt.py

Summary

Maintainability
F
2 wks
Test Coverage

File motor_qt.py has 940 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
# Pilas engine - A video game framework.
#
# Copyright 2010 - Hugo Ruscitti
# License: LGPLv3 (see http://www.gnu.org/licenses/lgpl.html)
Severity: Major
Found in pilas/motores/motor_qt.py - About 2 days to fix

    Motor has 30 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Motor(object):
        """Representa la ventana principal de pilas.
    
        Esta clase construirĂ¡ el objeto apuntado por el atributo
        ``pilas.motor``, asi que serĂ¡ el representante de todas
    Severity: Minor
    Found in pilas/motores/motor_qt.py - About 3 hrs to fix

      CanvasWidgetAbstracto has 21 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class CanvasWidgetAbstracto(object):
      
          def __init__(self, motor, ancho, alto, gestor_escenas, permitir_depuracion,
                       rendimiento):
              QGLWidget.__init__(self, None)
      Severity: Minor
      Found in pilas/motores/motor_qt.py - About 2 hrs to fix

        Function paintEvent has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def paintEvent(self, event):
                self.painter.begin(self)
                self.painter.scale(self.escala, self.escala)
        
                self.painter.setRenderHint(QtGui.QPainter.HighQualityAntialiasing, True)
        Severity: Minor
        Found in pilas/motores/motor_qt.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 dibujar has 9 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def dibujar(self, painter, x, y, dx=0, dy=0, escala_x=1, escala_y=1, rotacion=0, transparencia=0):
        Severity: Major
        Found in pilas/motores/motor_qt.py - About 1 hr to fix

          Function reproducir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def reproducir(self, repetir=False):
                  if not self.deshabilitado:
                      if repetir:
                          try:
                              self.sonido.finished.disconnect(self._play)
          Severity: Minor
          Found in pilas/motores/motor_qt.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 _inicializar_sistema_de_audio has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def _inicializar_sistema_de_audio(self, audio):
                  sistemas_de_sonido = ['deshabilitado', 'pygame', 'phonon', 'gst']
          
                  if audio not in sistemas_de_sonido:
                      error = "El sistema de audio '%s' es invalido" % (audio)
          Severity: Minor
          Found in pilas/motores/motor_qt.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 texto has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def texto(self, cadena, x=0, y=0, magnitud=10, fuente=None, color=colores.negro, ancho=0, vertical=False):
          Severity: Major
          Found in pilas/motores/motor_qt.py - About 1 hr to fix

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

                def limpiar_lineas_que_contengan(self, codigo, lineas_a_eliminar):
                    contenido = []
            
                    for linea_de_codigo in codigo.split("\n"):
                        agregar = True
            Severity: Minor
            Found in pilas/motores/motor_qt.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 obtener_area_de_texto has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def obtener_area_de_texto(self, cadena, magnitud=10, vertical=False, fuente=None, ancho=0):
                    pic = QtGui.QPicture()
                    p = QtGui.QPainter(pic)
            
                    if fuente:
            Severity: Minor
            Found in pilas/motores/motor_qt.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 rectangulo has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def rectangulo(self, x, y, ancho, alto, color=colores.negro, relleno=False, grosor=1):
            Severity: Major
            Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                  def linea(self, painter, x0, y0, x1, y1, color=colores.negro, grosor=1):
              Severity: Major
              Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                    def texto(self, painter, cadena, x=0, y=0, magnitud=10, fuente=None, color=colores.negro):
                Severity: Major
                Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                      def angulo(self, motor, x, y, angulo, radio, color, grosor):
                  Severity: Major
                  Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                        def rectangulo(self, painter, x, y, ancho, alto, color=colores.negro, grosor=1):
                    Severity: Major
                    Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                          def __init__(self, texto, magnitud, motor, vertical=False, fuente=None, color=pilas.colores.negro, ancho=None):
                      Severity: Major
                      Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                            def texto_absoluto(self, painter, cadena, x=0, y=0, magnitud=10, fuente=None, color=colores.negro):
                        Severity: Major
                        Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                              def pintar_parte_de_imagen(self, imagen, origen_x, origen_y, ancho, alto, x, y):
                          Severity: Major
                          Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                                def iniciar_ventana(self, ancho, alto, titulo, pantalla_completa,
                            Severity: Major
                            Found in pilas/motores/motor_qt.py - About 50 mins to fix

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

                                  def linea(self, x, y, x2, y2, color=colores.negro, grosor=1):
                              Severity: Minor
                              Found in pilas/motores/motor_qt.py - About 45 mins to fix

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

                                    def __init__(self, motor, ancho, alto, gestor_escenas, permitir_depuracion,
                                Severity: Minor
                                Found in pilas/motores/motor_qt.py - About 45 mins to fix

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

                                      def circulo(self, x, y, radio, color=colores.negro, relleno=False, grosor=1):
                                  Severity: Minor
                                  Found in pilas/motores/motor_qt.py - About 45 mins to fix

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

                                        def obtener_texto(self, texto, magnitud, vertical=False, fuente=None, color=pilas.colores.negro, ancho=None):
                                    Severity: Minor
                                    Found in pilas/motores/motor_qt.py - About 45 mins to fix

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

                                          def circulo(self, painter, x, y, radio, color=colores.negro, grosor=1):
                                      Severity: Minor
                                      Found in pilas/motores/motor_qt.py - About 45 mins to fix

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

                                            def poligono(self, motor, puntos, color=colores.negro, grosor=1, cerrado=False):
                                        Severity: Minor
                                        Found in pilas/motores/motor_qt.py - About 35 mins to fix

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

                                              def obtener_area_de_texto(self, cadena, magnitud=10, vertical=False, fuente=None, ancho=0):
                                          Severity: Minor
                                          Found in pilas/motores/motor_qt.py - About 35 mins to fix

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

                                                def cruz(self, painter, x, y, color=colores.negro, grosor=1):
                                            Severity: Minor
                                            Found in pilas/motores/motor_qt.py - About 35 mins to fix

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

                                                  def texto(self, cadena, x=0, y=0, magnitud=10, fuente=None, color=colores.negro, ancho=0, vertical=False):
                                                      self.canvas.begin(self._imagen)
                                                      r, g, b, a = color.obtener_componentes()
                                                      self.canvas.setPen(QtGui.QColor(r, g, b))
                                                      dx = x
                                              Severity: Minor
                                              Found in pilas/motores/motor_qt.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                                              Open

                                                  def __init__(self, ruta):
                                                      self.ruta_original = ruta
                                              
                                                      if isinstance(ruta, QtGui.QPixmap):
                                                          self._imagen = ruta
                                              Severity: Minor
                                              Found in pilas/motores/motor_qt.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

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

                                                      teclas = {
                                                          QtCore.Qt.Key_Left: simbolos.IZQUIERDA,
                                                          QtCore.Qt.Key_Right: simbolos.DERECHA,
                                                          QtCore.Qt.Key_Up: simbolos.ARRIBA,
                                                          QtCore.Qt.Key_Down: simbolos.ABAJO,
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 3 days to fix
                                              pilasengine/controles/__init__.py on lines 14..63

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

                                              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 obtener_area_de_texto(self, cadena, magnitud=10, vertical=False, fuente=None, ancho=0):
                                                      pic = QtGui.QPicture()
                                                      p = QtGui.QPainter(pic)
                                              
                                                      if fuente:
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 2 days to fix
                                              pilasengine/imagenes/texto.py on lines 29..63

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

                                              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 circulo(self, x, y, radio, color=colores.negro, relleno=False, grosor=1):
                                                      self.canvas.begin(self._imagen)
                                              
                                                      r, g, b, a = color.obtener_componentes()
                                                      color = QtGui.QColor(r, g, b)
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 day to fix
                                              pilasengine/imagenes/superficie.py on lines 80..93

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

                                              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 mouseReleaseEvent(self, e):
                                                      escala = self.escala
                                                      x, y = utils.convertir_de_posicion_fisica_relativa(e.pos().x()/escala, e.pos().y()/escala)
                                                      boton_pulsado = e.button()
                                              
                                              
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 day to fix
                                              pilas/motores/motor_qt.py on lines 235..243

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

                                              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 mousePressEvent(self, e):
                                                      escala = self.escala
                                                      x, y = utils.convertir_de_posicion_fisica_relativa(e.pos().x()/escala, e.pos().y()/escala)
                                                      boton_pulsado = e.button()
                                              
                                              
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 day to fix
                                              pilas/motores/motor_qt.py on lines 245..253

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

                                              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 linea(self, x, y, x2, y2, color=colores.negro, grosor=1):
                                                      self.canvas.begin(self._imagen)
                                              
                                                      r, g, b, a = color.obtener_componentes()
                                                      color = QtGui.QColor(r, g, b)
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 6 hrs to fix
                                              pilasengine/imagenes/superficie.py on lines 110..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 103.

                                              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 poligono(self, puntos, color, grosor, cerrado=False):
                                                      x, y = puntos[0]
                                              
                                                      if cerrado:
                                                          puntos.append((x, y))
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 5 hrs to fix
                                              pilasengine/imagenes/superficie.py on lines 121..130

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

                                              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

                                                      if not ancho:
                                                          flags = QtCore.Qt.AlignLeft | QtCore.Qt.AlignTop
                                                          ancho = self._imagen.width()
                                                      else:
                                                          flags = QtCore.Qt.AlignLeft | QtCore.Qt.TextWordWrap | QtCore.Qt.AlignTop
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 3 hrs to fix
                                              pilasengine/imagenes/superficie.py on lines 59..63

                                              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

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

                                                  def pintar_parte_de_imagen(self, imagen, origen_x, origen_y, ancho, alto, x, y):
                                                      self.canvas.begin(self._imagen)
                                                      self.canvas.drawPixmap(x, y, imagen._imagen, origen_x, origen_y, ancho, alto)
                                                      self.canvas.end()
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 2 hrs to fix
                                              pilasengine/imagenes/superficie.py on lines 32..37

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

                                              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

                                                      for line in lineas:
                                                          r = QtCore.QRect(dx, dy, ancho, 2000)
                                                          rect = self.canvas.drawText(r, flags, line)
                                                          dy += rect.height()
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 hr to fix
                                              pilasengine/imagenes/superficie.py on lines 73..76

                                              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

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

                                                  def reproducir(self, repetir=False):
                                                      if not self.deshabilitado:
                                                          if repetir:
                                                              self.sonido.play(-1)
                                                          else:
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 hr to fix
                                              pilasengine/sonidos/sonido.py on lines 21..26

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

                                              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(self, color):
                                                      r, g, b, a = color.obtener_componentes()
                                                      self._imagen.fill(QtGui.QColor(r, g, b, a))
                                              Severity: Major
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 1 hr to fix
                                              pilasengine/imagenes/superficie.py on lines 28..30

                                              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

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

                                                  def centro(self):
                                                      "Retorna una tupla con la coordenada del punto medio del la imagen."
                                                      return (self.ancho()/2, self.alto()/2)
                                              Severity: Minor
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 45 mins to fix
                                              pilasengine/imagenes/imagen.py on lines 37..39

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

                                              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_imagen(self, imagen, x=0, y=0):
                                                      self.pintar_parte_de_imagen(imagen, 0, 0, imagen.ancho(), imagen.alto(), x, y)
                                              Severity: Minor
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 45 mins to fix
                                              pilasengine/imagenes/superficie.py on lines 39..41

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

                                              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 dibujarse_sobre_una_pizarra(self, pizarra, x, y):
                                                      pizarra.pintar_parte_de_imagen(self, self.dx, self.dy, self.cuadro_ancho, self.cuadro_alto, x, y)
                                              Severity: Minor
                                              Found in pilas/motores/motor_qt.py and 1 other location - About 30 mins to fix
                                              pilasengine/imagenes/grilla.py on lines 72..75

                                              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