pybliometrics-dev/pybliometrics

View on GitHub

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,\
Severity: Major
Found in pybliometrics/scopus/abstract_retrieval.py - About 2 days to fix

    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,
    Severity: Minor
    Found in pybliometrics/scopus/superclasses/base.py - About 6 hrs to fix

    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.
            """
    Severity: Minor
    Found in pybliometrics/scopus/serial_search.py - About 5 hrs to fix

    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
    Severity: Minor
    Found in pybliometrics/scopus/author_retrieval.py - About 4 hrs to fix

      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".
      Severity: Minor
      Found in pybliometrics/scopus/abstract_retrieval.py - About 3 hrs to fix

      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.
              """
      Severity: Minor
      Found in pybliometrics/scopus/abstract_retrieval.py - About 3 hrs to fix

      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
      Severity: Minor
      Found in pybliometrics/scopus/abstract_citation.py - About 3 hrs to fix

        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')
        Severity: Minor
        Found in pybliometrics/scopus/affiliation_retrieval.py - About 2 hrs to fix

          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
          Severity: Minor
          Found in pybliometrics/scopus/abstract_citation.py - About 2 hrs to fix

            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 = []
            Severity: Minor
            Found in pybliometrics/scopus/subject_classifications.py - About 2 hrs to fix

            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'
            Severity: Minor
            Found in pybliometrics/scopus/utils/parse_content.py - About 2 hrs to fix

            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,\
            Severity: Minor
            Found in pybliometrics/scopus/serial_title.py - About 2 hrs to fix

              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
                  ----------
              Severity: Minor
              Found in pybliometrics/scopus/utils/get_content.py - About 1 hr to fix

              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)`.
              Severity: Minor
              Found in pybliometrics/scopus/abstract_retrieval.py - About 1 hr to fix

              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
                  ----------
              Severity: Minor
              Found in pybliometrics/scopus/utils/get_content.py - About 1 hr to fix

              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
              Severity: Minor
              Found in pybliometrics/scopus/scopus_search.py - About 1 hr to fix

              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,
              Severity: Major
              Found in pybliometrics/scopus/scopus_search.py - About 1 hr to fix

                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)`.
                Severity: Minor
                Found in pybliometrics/scopus/abstract_retrieval.py - About 1 hr to fix

                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,
                Severity: Minor
                Found in pybliometrics/scopus/scopus_search.py - About 1 hr to fix

                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,
                Severity: Major
                Found in pybliometrics/scopus/author_search.py - About 1 hr to fix
                  Severity
                  Category
                  Status
                  Source
                  Language