AGTGreg/runium

View on GitHub
runium/core.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function _run_task has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

def _run_task(
    fn, id, interval, times, start_in, kwargs, debug,
    on_success, on_error, on_iter, on_finished
):
    callback_result = None
Severity: Minor
Found in runium/core.py - About 2 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

Function _run_task has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _run_task(
Severity: Major
Found in runium/core.py - About 1 hr to fix

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

    def _get_results(fn, kwargs, iterations, times, debug):
    Severity: Minor
    Found in runium/core.py - About 35 mins to fix

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

          def __init__(self, task_id, fn, kwargs, executor, debug):
      Severity: Minor
      Found in runium/core.py - About 35 mins to fix

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

            def __clean_tasks_list(self):
                """
                Removes all finished tasks from the tasks list.
                Returns the cleaned tasks list.
                """
        Severity: Minor
        Found in runium/core.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 _get_results has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        def _get_results(fn, kwargs, iterations, times, debug):
            """
            Runs the task and catches any exceptions that might occur. Passes the
            runium parameter if the task accepts one.
            Returns:
        Severity: Minor
        Found in runium/core.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.
        Invalid

            if task_success is not None and on_success is not None:
                callback_result = on_success[FN](task_success)
                if on_success[UPDATES_RESULT] is True:
                    task_result = callback_result
        Severity: Major
        Found in runium/core.py and 1 other location - About 2 hrs to fix
        runium/core.py on lines 197..200

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

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

            if task_error is not None and on_error is not None:
                callback_result = on_error[FN](task_error)
                if on_error[UPDATES_RESULT] is True:
                    task_result = callback_result
        Severity: Major
        Found in runium/core.py and 1 other location - About 2 hrs to fix
        runium/core.py on lines 193..196

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

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

            if on_finished is not None:
                callback_result = on_finished[FN](task_success, task_error)
                if on_finished[UPDATES_RESULT] is True:
                    task_result = callback_result
        Severity: Major
        Found in runium/core.py and 1 other location - About 1 hr to fix
        runium/core.py on lines 178..181

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

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

                if on_iter is not None:
                    callback_result = on_iter[FN](task_success, task_error)
                    if on_iter[UPDATES_RESULT] is True:
                        task_result = callback_result
        Severity: Major
        Found in runium/core.py and 1 other location - About 1 hr to fix
        runium/core.py on lines 201..204

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

        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