AllYarnsAreBeautiful/knittingpattern

View on GitHub

Showing 166 of 166 total issues

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

    def dump_to_string(file):
        file.write(STRING[:1])
        file.write(STRING[1:])
Severity: Minor
Found in knittingpattern/test/test_dumper.py and 1 other location - About 50 mins to fix
knittingpattern/test/test_dumper.py on lines 21..23

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

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

    @property
    def index_of_last_consumed_mesh_in_row(self):
        """The index of the last consumed mesh of this instruction in its row.

        Same as :attr:`index_of_last_produced_mesh_in_row`
Severity: Minor
Found in knittingpattern/Instruction.py and 1 other location - About 45 mins to fix
knittingpattern/Instruction.py on lines 440..456

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

Avoid deeply nested control flow statements.
Open

                        if style:
                            style = style.split(";")
                            processed_style = []
                            for style_element in style:
                                if style_element.startswith("fill:"):
Severity: Major
Found in knittingpattern/convert/InstructionToSVG.py - About 45 mins to fix

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

    def coordinates(layout):
        """The coordinates of the layout."""
        return list(layout.walk_instructions(lambda point: (point.x, point.y)))
    Severity: Minor
    Found in knittingpattern/convert/test/test_layout.py and 1 other location - About 45 mins to fix
    knittingpattern/convert/test/test_layout.py on lines 14..16

    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

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

    def sizes(layout):
        """The sizes of the instructions of the layout."""
        return list(layout.walk_instructions(lambda p: (p.width, p.height)))
    Severity: Minor
    Found in knittingpattern/convert/test/test_layout.py and 1 other location - About 45 mins to fix
    knittingpattern/convert/test/test_layout.py on lines 9..11

    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

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

        @property
        def index_of_last_produced_mesh_in_row(self):
            """Index of the last mesh produced by this instruction in its row.
    
            :return: an index of the last produced mesh of rows produced meshes
    Severity: Minor
    Found in knittingpattern/Instruction.py and 1 other location - About 45 mins to fix
    knittingpattern/Instruction.py on lines 474..482

    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

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

        def test_last_instruction(self, a1):
            for row in a1.rows:
                assert row.last_instruction == row.instructions[-1]
    Severity: Minor
    Found in knittingpattern/test/test_row_instructions.py and 1 other location - About 40 mins to fix
    knittingpattern/test/test_row_instructions.py on lines 255..257

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

    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 assert_consumed_index(mesh, instruction_index, index_in_instruction=0):
        assert mesh.consuming_instruction.index_in_row == instruction_index
        assert mesh.index_in_consuming_instruction == index_in_instruction
    Severity: Minor
    Found in knittingpattern/test/test_row_meshes.py and 1 other location - About 40 mins to fix
    knittingpattern/test/test_row_meshes.py on lines 15..17

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

    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

        @property
        def produced_meshes(self):
            """The meshes that this row produces with its instructions.
    
            :return: a collection of :class:`meshes <knittingpattern.Mesh.Mesh>`
    Severity: Minor
    Found in knittingpattern/Row.py and 1 other location - About 40 mins to fix
    knittingpattern/Row.py on lines 115..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 34.

    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 test_first_instruction(self, a1):
            for row in a1.rows:
                assert row.first_instruction == row.instructions[0]
    Severity: Minor
    Found in knittingpattern/test/test_row_instructions.py and 1 other location - About 40 mins to fix
    knittingpattern/test/test_row_instructions.py on lines 259..261

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

    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

        @property
        def consumed_meshes(self):
            """Same as :attr:`produced_meshes` but for consumed meshes."""
            return list(chain(*(instruction.consumed_meshes
                                for instruction in self.instructions)))
    Severity: Minor
    Found in knittingpattern/Row.py and 1 other location - About 40 mins to fix
    knittingpattern/Row.py on lines 104..113

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

    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 assert_produced_index(mesh, instruction_index, index_in_instruction=0):
        assert mesh.producing_instruction.index_in_row == instruction_index
        assert mesh.index_in_producing_instruction == index_in_instruction
    Severity: Minor
    Found in knittingpattern/test/test_row_meshes.py and 1 other location - About 40 mins to fix
    knittingpattern/test/test_row_meshes.py on lines 10..12

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

    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

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

        def place_svg_dict(self, x, y, svg_dict, layer_id, group=None):
    Severity: Minor
    Found in knittingpattern/convert/SVGBuilder.py - About 35 mins to fix

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

      def test_create_new_connection(mesh31p, mesh12c, connect, row1, row3):
      Severity: Minor
      Found in knittingpattern/test/test_change_row_mapping.py - About 35 mins to fix

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

        def test_remove_a_connection(row1, row2, mesh11p, mesh21c, disconnect):
        Severity: Minor
        Found in knittingpattern/test/test_change_row_mapping.py - About 35 mins to fix

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

              def place_svg_use_coords(self, x, y, symbol_id, layer_id, group=None):
          Severity: Minor
          Found in knittingpattern/convert/SVGBuilder.py - About 35 mins to fix

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

                def __init__(self, min_x, min_y, max_x, max_y,
            Severity: Minor
            Found in knittingpattern/convert/AYABPNGBuilder.py - About 35 mins to fix

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

                  def __init__(self, type_, version, patterns, parser, comment=None):
              Severity: Minor
              Found in knittingpattern/KnittingPatternSet.py - About 35 mins to fix

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

                    def __init__(self, knittingpattern, layout, instruction_to_svg, builder,
                Severity: Minor
                Found in knittingpattern/convert/KnittingPatternToSVG.py - About 35 mins to fix

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

                  def test_connect_to_a_connected_location_with_connected_mesh(
                  Severity: Minor
                  Found in knittingpattern/test/test_change_row_mapping.py - About 35 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language