Showing 8 of 13 total issues
File adwords.py
has 514 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
Function _iter_selector
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
Open
def _iter_selector(self, service, selector, name):
"""
Yield a list of entries from `service` using `selector`
"""
offset = 0
- Read upRead up
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
Open
def _mutate_operation(self, service, operations):
tries = 0
while tries <= self.retries:
try:
- Read upRead up
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
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
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self, account_id, client_id, client_secret, refresh_token, developer_token,
Function download_report_with_awql
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def download_report_with_awql(self, path, query, report_format='CSV', skip_report_header=True,
Avoid deeply nested control flow statements. Open
Open
if self.timesleep:
time.sleep(2 ** tries)
elif error['ApiError.Type'] == 'RateExceededError':
Avoid deeply nested control flow statements. Open
Open
if self.timesleep:
time.sleep(int(error['retryAfterSeconds']))
else: