Showing 16 of 22 total issues
File auth.py
has 549 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Wordpress OAuth1.0a Class
"""
Function request_post_mortem
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
def request_post_mortem(self, response=None):
"""
Attempt to diagnose what went wrong in a request
"""
- 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
File helpers.py
has 334 lines of code (exceeds 250 allowed). Consider refactoring. Open
# -*- coding: utf-8 -*-
"""
Wordpress Hellper Class
"""
Function parse_login_form_error
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def parse_login_form_error(self, response, exc, **kwargs):
"""
If unable to parse login form, try to determine which error is present
"""
login_form_soup = BeautifulSoup(response.text, 'lxml')
- 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 get_verifier
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_verifier(self, request_token=None, wp_user=None, wp_pass=None):
"""
Get verifier string from access token.
Pretends to be a browser, uses the authorize auth link,
- 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 get_value_like_as_php
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def get_value_like_as_php(val):
""" Prepare value for quote """
try:
base = basestring
except NameError:
- 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 get_verifier
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_verifier(self, request_token=None, wp_user=None, wp_pass=None):
"""
Get verifier string from access token.
Pretends to be a browser, uses the authorize auth link,
Function request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def request(
self, method, url, auth=None, params=None, data=None, **kwargs
):
headers = {
"user-agent": "Wordpress API Client-Python/%s" % __version__,
- 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 request
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def request(
Function add_params_sign
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def add_params_sign(self, method, url, params, sign_key=None, **kwargs):
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(
Avoid too many return
statements within this function. Open
return ""
Function __request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __request(self, method, endpoint, data, **kwargs):
""" Do requests """
endpoint_url = self.requester.endpoint_url(endpoint)
endpoint_url = self.auth.get_auth_url(endpoint_url, method, **kwargs)
- 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 retrieve_access_creds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def retrieve_access_creds(self):
"""Retrieve access_token / access_token_secret stored locally."""
if not self.creds_store:
return
- 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 store_access_creds
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def store_access_creds(self):
""" store the access_token and access_token_secret locally. """
if not self.creds_store:
return
- 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 jsonencode
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def jsonencode(cls, data, **kwargs):
if PY2:
for encoding in filter(None, {
kwargs.get('encoding', 'utf8'),
sys.getdefaultencoding(),
- 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"