pybliometrics-dev/pybliometrics

View on GitHub

Showing 42 of 45 total issues

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

    Function __init__ has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self,
    Severity: Major
    Found in pybliometrics/scopus/affiliation_search.py - About 1 hr to fix

      Function __str__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def __str__(self):
              """Print a summary string."""
              date = self.get_cache_file_mdate().split()[0]
              areas = [e.area for e in self.subject_area]
              if len(areas) == 1:
      Severity: Minor
      Found in pybliometrics/scopus/serial_title.py - About 55 mins 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 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def __init__(self,
      Severity: Major
      Found in pybliometrics/scopus/superclasses/search.py - About 50 mins to fix

        Function __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def __init__(self,
        Severity: Major
        Found in pybliometrics/scopus/superclasses/base.py - About 50 mins to fix

          Function _get_all_refs has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def _get_all_refs(url: str, params: dict, verbose: bool, resp: dict, *args, **kwds) -> dict:
          Severity: Minor
          Found in pybliometrics/scopus/superclasses/base.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                    if n not in container:
                                        container[n] = [p for p in parts if p != container[o]]
                            else:
            Severity: Major
            Found in pybliometrics/scopus/abstract_retrieval.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                      if cursor_exists:
                                          cursor = res['search-results']['cursor']['@next']
                                          params.update({'cursor': cursor})
                                      else:
                                          start += params["count"]
              Severity: Major
              Found in pybliometrics/scopus/superclasses/base.py - About 45 mins to fix

                Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def __init__(self,
                Severity: Minor
                Found in pybliometrics/scopus/serial_title.py - About 35 mins to fix

                  Function __init__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self,
                  Severity: Minor
                  Found in pybliometrics/scopus/abstract_retrieval.py - About 35 mins to fix

                    Function get_coauthors has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_coauthors(self) -> Optional[List[NamedTuple]]:
                            """Retrieves basic information about co-authors as a list of
                            namedtuples in the form
                            `(surname, given_name, id, areas, affiliation_id, name, city, country)`,
                            where areas is a list of subject area codes joined by `"; "`.
                    Severity: Minor
                    Found in pybliometrics/scopus/author_retrieval.py - About 35 mins 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 citescoreyearinfolist has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def citescoreyearinfolist(self) -> Optional[List[NamedTuple]]:
                            """A list of named tuples of the form: `(year citescoare)` or (when
                            `view="CITESCORE"`) `(year citescore status documentcount citationcount
                            percentcited rank)`.  `rank` is `None` or a named tuple of the form
                            `(subjectcode rank percentile)`.
                    Severity: Minor
                    Found in pybliometrics/scopus/serial_title.py - About 35 mins 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 create_config has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def create_config(config_dir: Optional[str] = None,
                                      keys: Optional[List[str]] = None,
                                      insttoken: Optional[str] = None
                                      ):
                        """Initiates process to generate configuration file.
                    Severity: Minor
                    Found in pybliometrics/scopus/utils/create_config.py - About 35 mins 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 get_html has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_html(self) -> str:
                            """Bibliographic entry in html format."""
                            # Author links
                            au_link = ('<a href="https://www.scopus.com/authid/detail.url'
                                       '?origin=AuthorProfile&authorId={0}">{1}</a>')
                    Severity: Minor
                    Found in pybliometrics/scopus/abstract_retrieval.py - About 35 mins 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 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __init__(self,
                                     query: Dict,
                                     refresh: Union[bool, int] = False,
                                     fields: Union[List[str], Tuple[str, ...]] = None,
                                     **kwds: str
                    Severity: Minor
                    Found in pybliometrics/scopus/subject_classifications.py - About 25 mins 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 get_latex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_latex(self) -> str:
                            """Bibliographic entry in LaTeX format."""
                            if len(self.authors) > 1:
                                authors = _list_authors(self.authors)
                            else:
                    Severity: Minor
                    Found in pybliometrics/scopus/abstract_retrieval.py - About 25 mins 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 chemicals has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def chemicals(self) -> Optional[List[NamedTuple]]:
                            """List of namedtuples representing chemical entities in the form
                            `(source, chemical_name, cas_registry_number)`.  In case multiple
                            numbers given, they are joined on `";"`.
                            """
                    Severity: Minor
                    Found in pybliometrics/scopus/abstract_retrieval.py - About 25 mins 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 indexed_name has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def indexed_name(self) -> Optional[str]:
                            """Author's name as indexed by Scopus."""
                            if self._view in ('STANDARD', 'ENHANCED'):
                                indexed_name = html_unescape(chained_get(self._profile, ['preferred-name', 'indexed-name']))
                            elif self._view == 'LIGHT':
                    Severity: Minor
                    Found in pybliometrics/scopus/author_retrieval.py - About 25 mins 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 _retrieve_yearly_data has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _retrieve_yearly_data(yearly_data):
                        """Auxiliary function to collect yearly data.
                    
                        Returns list of lists in the form `[mergedstatname, stat]`, where
                        `mergedstatname` - dictionary key joined with associated period.
                    Severity: Minor
                    Found in pybliometrics/scopus/serial_search.py - About 25 mins 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 publication_range has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def publication_range(self) -> Optional[Tuple[int, int]]:
                            """Tuple containing years of first and last publication."""        
                            if self._view in ('STANDARD', 'ENHANCED', 'LIGHT'):
                                if self._view in ('STANDARD', 'ENHANCED'):
                                    r = self._profile.get('publication-range')
                    Severity: Minor
                    Found in pybliometrics/scopus/author_retrieval.py - About 25 mins 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

                    Severity
                    Category
                    Status
                    Source
                    Language