Showing 114 of 175 total issues
Function get_post_data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def get_post_data(request, types={}):
"""
Attempt to coerce POST json data from the request, falling
back to the raw data if json could not be coerced.
:param request: flask.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
Function post
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def post(self, library):
"""
HTTP POST request that modifies the permissions of a library
:param library: library ID
- 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 has_permission
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def has_permission(service_uid_editor,
service_uid_modify,
library_id):
"""
Check if the user wanting to change the library has the correct
- 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_solr
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def process_solr(self, library, start, rows, sort, fl, session, add_sort):
"""
Processes the request to solr big query
:param library: <string> <library ID>
:param start: <int> used to delimit the start of pagination
- 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 post
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def post(self, library, document_id):
"""
HTTP POST request that adds a note to the library
:param library: library ID
:param document_id: bibcode
- 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 setops_libraries
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def setops_libraries(cls, library_id, document_data, operation='union'):
"""
Takes the union of two or more libraries
:param library_id: the primary library ID
:param document_data: dict containing the list 'libraries' that holds the secondary library IDs
- 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_solr
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def process_solr(self, library, start, rows, sort, fl, session, add_sort):
Function get_libraries
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_libraries(cls, service_uid, absolute_uid, start=0, rows=None, sort_col="date_created", sort_order="desc", access_type="all"):
Function get_user_libraries
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_user_libraries(cls, session, service_uid, sort_col, sort_order, access_type, start=0, rows=None):
Function create_library
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_library(cls, service_uid, library_data):
"""
Creates a library for a user
:param service_uid: the user ID within this microservice
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get(self, library, document_id):
"""
HTTP GET request that gets a note from the library
:param library: library ID
:param document_id: bibcode
- 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_library_data
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def get_library_data(self, data):
"""
Processes the get request for the library and assembles a response
:param data: <dict> containing user, service_uid, library_id, start, rows, sort, fl,
raw_library, notes and session.
- 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 delete
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def delete(self, library):
"""
HTTP DELETE request that deletes a library defined by the number passed
:param library: library ID
- 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 put
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def put(self, library, document_id):
"""
HTTP PUT request that updates a note of the library
:param library: library ID
:param document_id: bibcode
- 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
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get(self, library):
"""
HTTP GET request that returns all the documents inside a given
user's library
:param library: library slug
- 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_solr_big_query
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_solr_big_query(
bibcodes,
start=0,
rows=20,
sort='date desc',
- 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 err(NO_PERMISSION_ERROR)
Avoid too many return
statements within this function. Open
return err(NO_PERMISSION_ERROR)
Avoid too many return
statements within this function. Open
return err(WRONG_TYPE_ERROR)
Avoid too many return
statements within this function. Open
return library_dict, 200