m4ce/cook-jobclient-python

View on GitHub

Showing 6 of 12 total issues

File jobclient.py has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import getpass
import json
import logging
import time
from uuid import UUID, uuid1
Severity: Minor
Found in cook/jobclient.py - About 2 hrs to fix

    Function wait has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def wait(self, jobs):
            """Wait for jobs to complete
    
            Args:
                jobs (list): List of jobs to wait for
    Severity: Minor
    Found in cook/jobclient.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 __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, url, auth='http_basic', http_user=None, http_password=None, batch_request_size=32,
    Severity: Major
    Found in cook/jobclient.py - About 1 hr to fix

      Function list has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def list(self, user=getpass.getuser(), state=['success', 'running', 'failed', 'completed', 'waiting'],
                   start_time=None, stop_time=None,
                   limit=None):
              """List jobs run by a given user over a specific time range.
      
      
      Severity: Minor
      Found in cook/jobclient.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 list has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def list(self, user=getpass.getuser(), state=['success', 'running', 'failed', 'completed', 'waiting'],
      Severity: Minor
      Found in cook/jobclient.py - About 35 mins to fix

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

            def query(self, jobs):
                """Query one or more jobs
        
                Args:
                    jobs (list): Jobs to query
        Severity: Minor
        Found in cook/jobclient.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