Showing 114 of 175 total issues
File base_view.py
has 653 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Base view
"""
import uuid
import base64
File document_view.py
has 559 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Document view
"""
from biblib.utils import err, get_post_data, get_GET_params
Function post
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
def post(self, library):
"""
HTTP POST request that conducts operations at the library level.
:param library: primary 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
File library_view.py
has 502 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Library view
"""
from biblib.views import USER_ID_KEYWORD
File permission_view.py
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Perimssion view
"""
from flask import request, current_app
File notes_view.py
has 345 lines of code (exceeds 250 allowed). Consider refactoring. Open
from biblib.utils import err, get_post_data
from biblib.models import Notes
from biblib.views.base_view import BaseView
from flask import request, current_app
from flask_discoverer import advertise
Function update_notes
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def update_notes(cls, session, library, updated_list):
"""
Updates the notes based on the solr canonical bibcodes response
:param session: necessary for all the queries
:param library: library to update
- 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 operations_view.py
has 310 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Operations view
"""
from biblib.views import USER_ID_KEYWORD
from biblib.utils import err, get_post_data
BaseView
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class BaseView(Resource):
"""
A base view class to keep a single version of common functions used between
all of the views.
"""
Function get_libraries
has a Cognitive Complexity of 21 (exceeds 5 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"):
"""
Get all the libraries a user has
:param service_uid: microservice UID of the user
:param absolute_uid: unique UID of the user in the API
- 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 models.py
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
Models use to define the database
The database is not initiated here, but a pointer is created named db. This is
to be passed to the app creator within the Flask blueprint.
File user_view.py
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
"""
User view
"""
from biblib.utils import err, get_post_data, check_boolean
Function post
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def post(self, library):
"""
HTTP POST request that adds a document to a library for a given user
: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 add_permission
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def add_permission(service_uid, library_id, permission):
"""
Adds a permission for a user to a specific library
:param service_uid: the user ID within this microservice
:param library_id: the library id to update
- 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 13 (exceeds 5 allowed). Consider refactoring. Open
def post(self, library):
"""
HTTP POST request that adds a document to a library for a given user
: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 add_document_to_library
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def add_document_to_library(cls, library_id, document_data):
"""
Adds a document to a user's library
:param library_id: the library id to update
:param document_data: the meta data of the document
- 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 11 (exceeds 5 allowed). Consider refactoring. Open
def put(self, library):
"""
HTTP PUT request that updates the meta-data of the 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 solr_update_library
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def solr_update_library(cls, library_id, solr_docs, session):
"""
Updates the library based on the solr canonical bibcodes response
:param library: library_id of the library to update
:param solr_docs: solr docs from the bigquery response
- 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_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"