MihaZelnik/adwordspy

View on GitHub

Showing 8 of 13 total issues

File adwords.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

import time

Severity: Major
Found in src/adwordspy/adwords.py - About 1 day to fix

    Function _iter_selector has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

        def _iter_selector(self, service, selector, name):
            """
                Yield a list of entries from `service` using `selector`
            """
            offset = 0
    Severity: Minor
    Found in src/adwordspy/adwords.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

    Function _mutate_operation has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
    Open

        def _mutate_operation(self, service, operations):
    
            tries = 0
            while tries <= self.retries:
                try:
    Severity: Minor
    Found in src/adwordspy/adwords.py - About 3 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

    AdwordsAPI has 23 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class AdwordsAPI(object):
        def __init__(self, account_id, client_id, client_secret, refresh_token, developer_token,
                     version='v201609', page_size=100, retries=3, timesleep=True):
            self.account_id = account_id
            self.client_id = client_id
    Severity: Minor
    Found in src/adwordspy/adwords.py - About 2 hrs to fix

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

          def __init__(self, account_id, client_id, client_secret, refresh_token, developer_token,
      Severity: Major
      Found in src/adwordspy/adwords.py - About 1 hr to fix

        Function download_report_with_awql has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def download_report_with_awql(self, path, query, report_format='CSV', skip_report_header=True,
        Severity: Major
        Found in src/adwordspy/adwords.py - About 50 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if self.timesleep:
                                          time.sleep(2 ** tries)
                                  elif error['ApiError.Type'] == 'RateExceededError':
          Severity: Major
          Found in src/adwordspy/adwords.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                        if self.timesleep:
                                            time.sleep(int(error['retryAfterSeconds']))
                                    else:
            Severity: Major
            Found in src/adwordspy/adwords.py - About 45 mins to fix
              Severity
              Category
              Status
              Source
              Language