michalc/threaded-buffered-pipeline

View on GitHub

Showing 10 of 10 total issues

Function buffered_pipeline has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
Open

def buffered_pipeline():
    threads = []

    # The regular queue.Queue doesn't have a function to wait for space in the queue without also
    # immediately putting an item into it, which would mean effective minimum buffer_size is 2: an
Severity: Minor
Found in threaded_buffered_pipeline.py - About 6 hrs 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

File test.py has 253 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import threading
import time
from unittest import (
    TestCase,
)
Severity: Minor
Found in test.py - About 2 hrs to fix

    Function test_exception_propagates_slow_previous_iterable has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_exception_propagates_slow_previous_iterable(self):
            num_gen = 0
    
            class MyException(Exception):
                pass
    Severity: Minor
    Found in test.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 test_exception_propagates_after_first_yield has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_exception_propagates_after_first_yield(self):
            num_gen = 0
    
            class MyException(Exception):
                pass
    Severity: Minor
    Found in test.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 test_exception_propagates_before_first_yield has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_exception_propagates_before_first_yield(self):
            num_gen = 0
    
            class MyException(Exception):
                pass
    Severity: Minor
    Found in test.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 test_exception_propagates_before_first_iter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_exception_propagates_before_first_iter(self):
            num_gen = 0
    
            class MyException(Exception):
                pass
    Severity: Minor
    Found in test.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 test_num_threads has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_num_threads(self):
            def gen_1():
                for value in range(0, 10):
                    yield
    
    
    Severity: Minor
    Found in test.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 test_chain_parallel has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_chain_parallel(self):
            num_gen_1 = 0
            num_gen_2 = 0
            num_gen_3 = 0
    
    
    Severity: Minor
    Found in test.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 test_chain_all_buffered has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_chain_all_buffered(self):
            def gen_1():
                for value in range(0, 10):
                    yield value
    
    
    Severity: Minor
    Found in test.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

    Function test_chain_some_buffered has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def test_chain_some_buffered(self):
            def gen_1():
                for value in range(0, 10):
                    yield value
    
    
    Severity: Minor
    Found in test.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

    Severity
    Category
    Status
    Source
    Language