hugoruscitti/pilas

View on GitHub
pilasengine/imagenes/superficie.py

Summary

Maintainability
F
4 days
Test Coverage

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

    def texto(self, cadena, x=0, y=0, magnitud=10, fuente=None,
Severity: Major
Found in pilasengine/imagenes/superficie.py - About 1 hr to fix

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

        def rectangulo(self, x, y, ancho, alto, color=colores.negro,
    Severity: Major
    Found in pilasengine/imagenes/superficie.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,
      Severity: Major
      Found in pilasengine/imagenes/superficie.py - About 50 mins to fix

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

            def circulo(self, x, y, radio, color=colores.negro,
        Severity: Minor
        Found in pilasengine/imagenes/superficie.py - About 45 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 pilasengine/imagenes/superficie.py - About 45 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)
                    color = colores.generar_color_desde_texto(color)
                    r, g, b, _ = color.obtener_componentes()
            Severity: Minor
            Found in pilasengine/imagenes/superficie.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 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, _ = color.obtener_componentes()
            Severity: Major
            Found in pilasengine/imagenes/superficie.py and 1 other location - About 1 day to fix
            pilas/motores/motor_qt.py on lines 661..673

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

            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 pilasengine/imagenes/superficie.py and 1 other location - About 5 hrs to fix
            pilas/motores/motor_qt.py on lines 700..709

            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 pilasengine/imagenes/superficie.py and 1 other location - About 3 hrs to fix
            pilas/motores/motor_qt.py on lines 638..642

            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)
            Severity: Major
            Found in pilasengine/imagenes/superficie.py and 1 other location - About 2 hrs to fix
            pilas/motores/motor_qt.py on lines 618..621

            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 pilasengine/imagenes/superficie.py and 1 other location - About 1 hr to fix
            pilas/motores/motor_qt.py on lines 654..657

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 46.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

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

                def pintar(self, color):
                    r, g, b, a = color.obtener_componentes()
                    self._imagen.fill(QtGui.QColor(r, g, b, a))
            Severity: Major
            Found in pilasengine/imagenes/superficie.py and 1 other location - About 1 hr to fix
            pilas/motores/motor_qt.py on lines 614..616

            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 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 pilasengine/imagenes/superficie.py and 1 other location - About 45 mins to fix
            pilas/motores/motor_qt.py on lines 623..624

            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

            There are no issues that match your filters.

            Category
            Status