Showing 241 of 434 total issues
Avoid deeply nested control flow statements. Open
if _user_id and _pass:
if _user_id.isdigit():
# Interpret as User ID
user = User.get_by_id(int(_user_id))
elif '@' in _user_id:
Avoid deeply nested control flow statements. Open
if author_keys:
author = authors.get(author_keys[0], {}).get('name')
archived = int(status) == 1
Avoid deeply nested control flow statements. Open
if name is not None:
author = name.text
r = Readable.CreateOrUpdate(user, isbn, title=title,
Avoid deeply nested control flow statements. Open
for tn in task_names:
task = Task.Create(self.user, tn)
tasks.append(task)
ndb.put_multi(tasks)
Avoid deeply nested control flow statements. Open
if not account_exists:
self.set_response({'error': 'user_not_found'}, status=401)
else:
self._google_return_tokens(u)
ok = True
Avoid deeply nested control flow statements. Open
if is_article:
# Treat as article
r = Readable.CreateOrUpdate(user, uid, source='evernote', url=url, title=title)
r.put()
self.success = True
Avoid deeply nested control flow statements. Open
if self.valid_atom_value(raf, val):
fields.append(search.AtomField(name=raf, value=val))
sd = search.Document(doc_id=self.get_doc_id(), fields=fields, language='en')
Function update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update(self, d):
id = self.request.get('id')
params = tools.gets(self,
strings=['source', 'content', 'link', 'location', 'date'],
lists=['tags']
- 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_request
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def _process_request(self):
'''
Populate self.reply and self.data
'''
if self.request_type == FacebookAgent.REQ_MESSAGE:
- 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 deeply nested control flow statements. Open
if r:
self.readable = r.key
return r
Avoid deeply nested control flow statements. Open
if first_image:
image_url = first_image.get('src')
if authors:
Function Update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def Update(self, **params):
if 'name' in params:
self.name = params.get('name')
if 'timezone' in params:
self.timezone = params.get('timezone')
- 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
Consider simplifying this complex logical expression. Open
if (editing_index != null) return (
<div>
<TextField floatingLabelText="Title" name="title" value={form.title||''} onChange={this.changeHandler.bind(this, 'form', 'title')} fullWidth />
<TextField floatingLabelText="Details" name="details" value={form.details||''} onChange={this.changeHandler.bind(this, 'form', 'details')} fullWidth />
<div className="row">
Function changeHandlerDropDown
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
target.prototype.changeHandlerDropDown = function(key, attr, event, index, value) {
Function onerror
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
window.onerror = function(msg, url, line, col, error) {
Function get
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
get: function(url, data, success, fail, opts) {
Function set_response
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def set_response(self, data=None, debug=False, success=None, status=None,
Function post
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
post: function(url, data, success, fail, opts) {
Function __init__
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, user, api='fitness', version='v3',
Function Recent
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def Recent(user, limit=10, offset=0, with_archived=False, project_id=None, prefetch=None):