Showing 42 of 45 total issues
File abstract_retrieval.py
has 850 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import defaultdict, namedtuple
from typing import List, NamedTuple, Optional, Tuple, Union
from pybliometrics.scopus.superclasses import Retrieval
from pybliometrics.scopus.utils import chained_get, check_parameter_value,\
Function __init__
has a Cognitive Complexity of 43 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
params: Dict,
url: str,
api: str,
download: bool = True,
- 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 results
has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring. Open
def results(self) -> Optional[List[Dict[str, str]]]:
"""A list of OrderedDicts representing results of serial search. The
number of keys may vary from one search result to another depending
on the length of yearly 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"
Further reading
File author_retrieval.py
has 371 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
from warnings import warn
from typing import List, NamedTuple, Optional, Tuple, Union
from json import loads
Function __str__
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def __str__(self):
"""Return pretty text version of the document.
Assumes the document is a journal article and was loaded with
view="META_ABS" or view="FULL".
- 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 issn
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def issn(self) -> Optional[NamedTuple]:
"""Namedtuple in the form `(print electronic)`.
Note: If the source has an E-ISSN, the META view will return None.
Use FULL view instead.
"""
- 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
CitationOverview
has 27 functions (exceeds 20 allowed). Consider refactoring. Open
class CitationOverview(Retrieval):
@property
def authors(self) -> Optional[List[Optional[NamedTuple]]]:
"""A list of lists of namedtuples storing author information,
where each namedtuple corresponds to one author and each sub-list to
AffiliationRetrieval
has 24 functions (exceeds 20 allowed). Consider refactoring. Open
class AffiliationRetrieval(Retrieval):
@property
def address(self) -> Optional[str]:
"""The address of the affiliation."""
return self._json.get('address')
File abstract_citation.py
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
from datetime import datetime
from hashlib import md5
from typing import List, NamedTuple, Optional, Tuple, Union
from warnings import warn
Function results
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def results(self) -> Optional[List[NamedTuple]]:
"""A list of namedtuples representing results of subject
classifications search in the form `(code, description, detail, abbrev)`.
"""
out = []
- 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 parse_affiliation
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
def parse_affiliation(affs, view):
"""Helper function to parse list of affiliation-related information."""
order = 'id parent type relationship afdispname preferred_name '\
'parent_preferred_name country_code country address_part city '\
'state postal_code org_domain org_URL'
- 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 serial_title.py
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
from collections import namedtuple
from typing import List, NamedTuple, Optional, Tuple, Union
from pybliometrics.scopus.superclasses import Retrieval
from pybliometrics.scopus.utils import chained_get, check_parameter_value,\
Function get_content
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def get_content(url, api, params=None, **kwds):
"""Helper function to download a file and return its content.
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 references
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def references(self) -> Optional[List[NamedTuple]]:
"""List of namedtuples representing references listed in the document,
in the form `(position, id, doi, title, authors, authors_auid,
authors_affiliationid, sourcetitle, publicationyear, coverDate, volume,
issue, first, last, citedbycount, type, text, fulltext)`.
- 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 detect_id_type
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def detect_id_type(sid):
"""Method that tries to infer the type of abstract ID.
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 results
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def results(self) -> Optional[List[NamedTuple]]:
"""A list of namedtuples in the form `(eid doi pii pubmed_id title
subtype subtypeDescription creator afid affilname affiliation_city
affiliation_country author_count author_names author_ids author_afids
coverDate coverDisplayDate publicationName issn source_id eIssn
- 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 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,
Function authorgroup
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def authorgroup(self) -> Optional[List[NamedTuple]]:
"""A list of namedtuples representing the article's authors organized
by affiliation, in the form `(affiliation_id, dptid, organization,
city, postalcode, addresspart, country, collaboration, auid, orcid,
indexed_name, surname, given_name)`.
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
query: str,
refresh: Union[bool, int] = False,
view: str = None,
verbose: bool = False,
- 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 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self,