Showing 17 of 21 total issues
Function matching
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def matching(klass, query, offset=0, limit=None):
"""Returns entities matching the given search query."""
# Check contents of cache.
words = tokenize(query)
- 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 automod
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def automod():
pending = itertools.chain(
model.UnapprovedListing().query(),
model.UnapprovedInquiry().query(),
)
- 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 enableModeration
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
var enableModeration = function(csrfToken) {
var buttons = document.querySelectorAll(
"[data-skip],[data-approve],[data-deny]");
var siblingWithChildren = function(x) {
Function moderation_view
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def moderation_view():
"""
Approves or denies a listing or inquiry.
"""
- 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 show_listing
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def show_listing(listing):
"""
Retrieves a listing and displays it in the interface.
"""
- 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 _send_raw_mail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def _send_raw_mail(to, subject, html, text, reply_to=None, sender=SENDER):
Function approved
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def approved(self):
"""
Ensure that listings must be manually approved.
"""
- 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 __call__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, **kwargs):
"""Renders a control with a Sign In button."""
if users.get_current_user():
kwargs["type"] = "hidden"
- 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 send_mail
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def send_mail(to, subject, html, text, reply_to=None, sender=SENDER):
Function fetchMore
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
var fetchMore = coalesce(function(complete) {
var parameterString = window.location.search.substring(1);
var continuation = "&continuation&offset=" + document.querySelectorAll(".listing").length;
- 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 send_mail
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def send_mail(to, subject, html, text, reply_to=None, sender=SENDER):
"""
Sends an email to the given principals.
"""
- 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 process_formdata
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_formdata(self, values):
"""Process an external photo value."""
for value in values:
if not value:
- 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 modify_search
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def modify_search(add=[], remove=[]):
"""Adds and removes the given words from the query, returning the new ?q."""
query = request.args.get('q', '').split()
query = [x.strip() for x in query if x.strip()]
- 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_keys
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_keys(keys):
"""
Fetch and save the given keys into memcache.
"""
- 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
Avoid too many return
statements within this function. Open
return False
Function __call__
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def __call__(self, form, field):
"""Ensure that only the given user is used for authentication."""
if not self.principal:
raise Exception("No principal specified.")
- 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 api_all_listings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def api_all_listings():
"""Display a list of listings that match the given query."""
# Parse filtering options from query.
query = request.args.get("q", "")
- 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"