Showing 37 of 58 total issues
File query.py
has 1004 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulexistdb/query.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
File db.py
has 634 lines of code (exceeds 250 allowed). Consider refactoring. Open
# file eulexistdb/db.py
#
# Copyright 2010,2011 Emory University Libraries
#
# Licensed under the Apache License, Version 2.0 (the "License");
Function getQuery
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
def getQuery(self):
"""
Generate and return xquery based on configured filters, sorting, return fields.
Returns xpath or FLOWR XQuery if required based on sorting and 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 handle
has a Cognitive Complexity of 33 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
if not len(args) or args[0] == 'help':
print self.help
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 _create_return_class
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def _create_return_class(baseclass, override_fields, xpath_prefix=None,
override_xpaths=None):
"""
Define a new return class which extends the specified baseclass and
overrides the specified fields.
- 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
ExistDB
has 31 functions (exceeds 20 allowed). Consider refactoring. Open
class ExistDB(object):
"""Connect to an eXist database, and manipulate and query it.
Construction doesn't initiate server communication, only store
information about where the server is, to be used in later
Function add_filter
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def add_filter(self, xpath, type, value, mode=None):
"""
Add a filter to the xpath. Takes xpath, type of filter, and value.
Filter types currently implemented:
* contains
- 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 filter
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def filter(self, combine='AND', **kwargs):
"""Filter the QuerySet to return a subset of the documents.
Arguments take the form ``lookuptype`` or ``field__lookuptype``,
where ``field`` is the name of a field in the QuerySet's :attr:`model`
- 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
QuerySet
has 29 functions (exceeds 20 allowed). Consider refactoring. Open
class QuerySet(object):
"""Lazy eXist database lookup for a set of objects.
:param model: the type of object to return from :meth:`__getitem__`. If
Function __init__
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, server_url=None, username=None, password=None,
resultType=None, encoding='UTF-8', verbose=False,
keep_alive=None, timeout=DEFAULT_TIMEOUT):
self.resultType = resultType or QueryResult
- 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 prep_xpath
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def prep_xpath(self, xpath, context=None, return_field=False):
"""Prepare an xpath for use in an xquery.
:param xpath: xpath as string or parsed by :meth:`eulxml.xpath.parse`
:param context: optional context to add to xpaths; by default, the current
- 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 _fixture_setup
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _fixture_setup(self):
if hasattr(self, 'exist_fixtures'):
db = ExistDB()
# load index
if 'index' in self.exist_fixtures:
- 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 query
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def query(self, xquery=None, start=1, how_many=10, cache=False, session=None,
release=None, result_type=None):
"""Execute an XQuery query, returning the results directly.
:param xquery: a string XQuery 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 _fixture_teardown
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _fixture_teardown(self):
if hasattr(self, 'exist_fixtures'):
db = ExistDB()
if 'index' in self.exist_fixtures:
db.removeCollectionIndex(settings.EXISTDB_ROOT_COLLECTION)
- 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 _constructReturn
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def _constructReturn(self):
"""Construct the return portion of a FLOWR xquery."""
if self.return_fields or self.additional_return_fields:
# constructed return result with partial or additional content
- 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 set_limits
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def set_limits(self, low=None, high=None):
"""
Adjusts the limits on the results to be retrieved.
Any limits passed in here are applied relative to the existing
- 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_xquery_info
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def _store_xquery_info(self, sender, name=None, time_taken=0,
Function __init__
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, server_url=None, username=None, password=None,
Function __getitem__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __getitem__(self, k):
"""Return a single result or slice of results from the query."""
if not isinstance(k, (slice, int, long)):
raise TypeError
- 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 query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def query(self, xquery=None, start=1, how_many=10, cache=False, session=None,