Showing 30 of 30 total issues
Scientist
has 42 functions (exceeds 20 allowed). Consider refactoring. Open
class Scientist(object):
@property
def active_year(self):
"""The scientist's most recent year with publication(s) before
provided year (which may be the same).
File scientist.py
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Michael E. Rose <michael.ernst.rose@gmail.com>
"""Super class to represent a scientist."""
Function find_matches
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def find_matches(original, stacked, verbose, refresh):
"""Find matches within the search group.
Parameters
----------
- 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 original.py
has 297 lines of code (exceeds 250 allowed). Consider refactoring. Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Authors: Michael E. Rose <michael.ernst.rose@gmail.com>
# Stefano H. Baruffaldi <ste.baruffaldi@gmail.com>
"""Main class for sosia."""
Function filter_pub_counts
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def filter_pub_counts(group, conn, ybefore, yupto, npapers, yfrom=None,
verbose=False):
"""Filter authors based on restrictions in the number of
publications in different periods, searched by query_size.
- 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 insert_data
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def insert_data(data, conn, table):
"""Insert new information in SQL database.
Parameters
----------
- 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 __init__
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, identifier, year, refresh=False, period=None, eids=None,
sql_fname=None):
"""Class to represent a scientist.
Parameters
- 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 find_matches
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def find_matches(original, stacked, verbose, refresh):
"""Find matches within the search group.
Parameters
----------
Function __init__
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, identifier, year, refresh=False, period=None, eids=None,
sql_fname=None):
"""Class to represent a scientist.
Parameters
Function accepts
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def accepts(*classinfo_args):
"""Decorator to check types of property."""
def isinstance_decorator_wrapper(old_fn):
def new_fn(self, *args, **kwargs):
for i, classinfo in enumerate(classinfo_args):
- 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 __init__
has 12 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, scientist, treatment_year, first_year_margin=2,
Function inform_matches
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def inform_matches(self, keywords, verbose, refresh):
"""Add match-specific information to all matches.
Parameters
----------
- 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 base_query
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def base_query(q_type, query, refresh=False, view="COMPLETE", fields=None,
size_only=False):
"""Wrapper function to perform a particular search query.
Parameters
- 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 __init__
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self, scientist, treatment_year, first_year_margin=2,
pub_margin=0.2, cits_margin=0.2, coauth_margin=0.2,
affiliations=None, period=None, first_year_search="ID",
eids=None, refresh=False, sql_fname=None):
"""Representation of a scientist for whom to find a control scientist.
- 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 find_main_affiliation
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def find_main_affiliation(auth_ids, pubs, year):
"""Find the most common affiliation ID of a scientist on publications
with valid information of the most recent year.
Parameters
- 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 stacked_query
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def stacked_query(group, template, joiner, q_type, refresh, stacked, verbose):
Function filter_pub_counts
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
def filter_pub_counts(group, conn, ybefore, yupto, npapers, yfrom=None,
Function build_dict
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def build_dict(results, chunk):
"""Create dictionary assigning publication information to authors we
are looking for.
"""
from math import inf
- 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 __init__
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, identifier, year, refresh=False, period=None, eids=None,
Function base_query
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def base_query(q_type, query, refresh=False, view="COMPLETE", fields=None,