kangasta/pullnrun

View on GitHub

Showing 9 of 9 total issues

Function execute_task has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

def execute_task(task_data, plan_settings, env):
    console = JsonStreams(plan_settings.log_to_console)

    task = parse_task(task_data, env, plan_settings)
    task_progress = f' {task.index}' if task.index else ''
Severity: Minor
Found in pullnrun/execute.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 main has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def main(plan, report, env_tags=None, execdir=None):
    try:
        validate_plan(plan)
    except Exception as e:
        print(f'Failed to validate plan: {str(e)}')
Severity: Minor
Found in pullnrun/main.py - About 1 hr to fix

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

    def pull_http(
    Severity: Minor
    Found in pullnrun/builtin/_pull.py - About 45 mins to fix

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

          def __init__(self, meta, function_name, parameters, settings, error=None):
      Severity: Minor
      Found in pullnrun/utils/task.py - About 35 mins to fix

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

        def push_http(
        Severity: Minor
        Found in pullnrun/builtin/_push.py - About 35 mins to fix

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

          def pull_git(url, target=None, branch=None, settings=DEFAULT_SETTINGS):
              console = JsonStreams(settings.log_to_console)
              console.input(f'# Pull repository from {url}')
          
              if not target:
          Severity: Minor
          Found in pullnrun/builtin/_pull.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

          Avoid too many return statements within this function.
          Open

              return task.result(console, result, )
          Severity: Major
          Found in pullnrun/execute.py - About 30 mins to fix

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

            def entrypoint():
                args = get_args()
                if args.version:
                    print(f'pullnrun {__version__}')
                    return
            Severity: Minor
            Found in pullnrun/main.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 push has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
            Open

                def push(self, stream_name=None, timestamp=None, text=None):
                    if not (stream_name and text):
                        raise ValueError(
                            'Cannot push data without both stream_name and text.')
            
            
            Severity: Minor
            Found in pullnrun/utils/console.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