Showing 33 of 166 total issues
File Instruction.py
has 469 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Knitting patterns consist of instructions.
The :class:`instructions <Instruction>`. that are used in the
:class:`knitting patterns <KnittingPattern>` can be foudn in this module.
They have certain attributes in common.
Function _set_fills_in_color_layer
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def _set_fills_in_color_layer(self, svg_string, color):
"""replaces fill colors in ``<g inkscape:label="color"
inkscape:groupmode="layer">`` with :paramref:`color`
:param color: a color fill the objects in the layer with
- Read upRead up
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
TestAddAndRemoveMeshes
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
class TestAddAndRemoveMeshes(BaseTest):
"""take away and add meshes at the right and left."""
FILE = "add and remove meshes.json"
SIZES = [(1, 1)] * 17
COORDINATES = [
File Mesh.py
has 391 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""This module contains the meshes of the knit work."""
from abc import ABCMeta, abstractmethod
class Mesh(metaclass=ABCMeta):
Mesh
has 34 functions (exceeds 20 allowed). Consider refactoring. Open
class Mesh(metaclass=ABCMeta):
"""A mesh that is either consumed or produced by an instruction.
.. code:: python
InstructionInRow
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class InstructionInRow(Instruction):
"""Instructions can be placed in rows.
Then, they have additional attributes and properties.
File Layout.py
has 295 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Map ``(x, y)`` coordinates to instructions
"""
from itertools import chain
from collections import namedtuple
Parser
has 22 functions (exceeds 20 allowed). Consider refactoring. Open
class Parser(object):
"""Parses a knitting pattern set and anything in it."""
def __init__(self, specification):
File test_layout.py
has 262 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""Test the layout of knitting patterns."""
from test_convert import fixture
import os
from knittingpattern.convert.Layout import GridLayout, InstructionInGrid
from knittingpattern import load_from_relative_file
Function test_disconnected_from
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def test_disconnected_from(self, connections, meshes):
"""Test all the meshes that are disconnected from each other."""
for m1 in meshes:
assert m1 == m1
for m2 in meshes:
- Read upRead up
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 insert_defs
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def insert_defs(self, defs):
"""Adds the defs to the SVG structure.
:param defs: a list of SVG dictionaries, which contain the defs,
which should be added to the SVG structure.
- Read upRead up
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 10 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function walk
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def walk(knitting_pattern):
"""Walk the knitting pattern in a right-to-left fashion.
:return: an iterable to walk the rows
:rtype: list
- Read upRead up
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 convert_image_to_knitting_pattern
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def convert_image_to_knitting_pattern(path, colors=("white", "black")):
"""Load a image file such as a png bitmap of jpeg file and convert it
to a :ref:`knitting pattern file <FileFormatSpecification>`.
:param list colors: a list of strings that should be used as
- Read upRead up
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 construct_graph
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def construct_graph(links):
pattern = new_knitting_pattern("constructed_graph")
rows = pattern.rows
for link in links:
for row_id in link:
- Read upRead up
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 walk_connections
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def walk_connections(self, mapping=identity):
"""Iterate over connections between instructions.
:return: an iterator over :class:`connections <Connection>` between
:class:`instructions in grid <InstructionInGrid>`
- Read upRead up
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 test_replace_a_connection
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_replace_a_connection(disconnect, connect, mesh21p, mesh31c, mesh12p,
Avoid deeply nested control flow statements. Open
if style:
style = style.split(";")
processed_style = []
for style_element in style:
if style_element.startswith("fill:"):
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):
Function test_create_new_connection
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def test_create_new_connection(mesh31p, mesh12c, connect, row1, row3):