18F/clone_army

View on GitHub

Showing 4 of 6 total issues

Function repositories has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def repositories(account, type='org', filter=None):
    for page_no in itertools.count(1):
        click.echo('Page {page_no}'.format(page_no=page_no))
        url = _REPO_LIST_URL.format(type=type,
                                    account=account,
Severity: Minor
Found in clone_army/clone_army.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 a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def main(account, type, filter, verbose, git_options, existing_only):
    """Console script for clone_army"""
    if account.startswith('-'):
        raise click.BadArgumentUsage("Options for Git should come at end.")
    if verbose:
Severity: Minor
Found in clone_army/cli.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 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def main(account, type, filter, verbose, git_options, existing_only):
Severity: Minor
Found in clone_army/cli.py - About 45 mins to fix

    Function synch_present has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def synch_present(cls, filter=None, *args):
            """
            Updates repositories already present in child directories.
            """
            for dir in os.listdir():
    Severity: Minor
    Found in clone_army/clone_army.py - About 45 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