Showing 18 of 90 total issues
File metrics.py
has 570 lines of code (exceeds 250 allowed). Consider refactoring. Open
'''
Created on April 8, 2015
@author: ehenneken
'''
Consider simplifying this complex logical expression. Open
if usage_type == 'reads':
# Get all reads data and sum up the individual lists
usage_data = [
p.reads for p in data if p.reads and len(p.reads) == Nentries]
usage = [sum(sublist)
Function post
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
bibcodes = []
query = None
stime = time.time()
try:
- 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 generate_metrics
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def generate_metrics(**args):
result = {}
usage_data = None
citdata = None
citlists = None
- 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_usage_histograms
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def get_usage_histograms(identifiers, usage_type='reads', data=None):
uh = {}
# Get necessary data if nothing was provided
if not data:
data = get_usage_data(identifiers)
- 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_time_series
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_time_series(identifiers, bibcodes, data=None, usagedata=None,
tori_data=None, include_tori=True, self_cits=None):
series = {}
i10 = {}
i100 = {}
- 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_citation_stats
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_citation_stats(identifiers, bibcodes, bibcodes_ref):
data = selfcits = citdata = None
# citation stats for all publications
cs = {}
# citation stats for refereed publications
Function get_indicators
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_indicators(identifiers, data=None, usagedata=None):
ind = {}
ind_ref = {}
# Get the necessary data if we did not get any
if not data:
Function get_basic_stats
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_basic_stats(identifiers):
# basic stats for all publications
bs = {}
# basic stats for refereed publications`
bsr = {}
Function get_citation_histograms
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_citation_histograms(identifiers, data=None):
ch = {}
current_year = datetime.now().year
# Get necessary data if nothing was provided
if not data:
Function get_time_series
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def get_time_series(identifiers, bibcodes, data=None, usagedata=None,
tori_data=None, include_tori=True, self_cits=None):
series = {}
i10 = {}
i100 = {}
Function get_time_series
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_time_series(identifiers, bibcodes, data=None, usagedata=None,
Function post
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def post(self):
details = {}
details['skipped bibcodes'] = []
try:
bibcodes = list(map(str, request.json['bibcodes']))
- 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_basic_stats
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_basic_stats(identifiers):
# basic stats for all publications
bs = {}
# basic stats for refereed publications`
bsr = {}
- 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 results
Avoid too many return
statements within this function. Open
return results, 500
Avoid too many return
statements within this function. Open
return {'Error': 'Unable to get results!',
Function get_indicators
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_indicators(identifiers, data=None, usagedata=None):
ind = {}
ind_ref = {}
# Get the necessary data if we did not get any
if not data:
- 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"