sosia-dev/sosia

View on GitHub

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).
Severity: Minor
Found in sosia/classes/scientist.py - About 5 hrs to fix

    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."""
    
    
    Severity: Minor
    Found in sosia/classes/scientist.py - About 3 hrs to fix

      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
          ----------
      Severity: Minor
      Found in sosia/processing/finding.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

      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."""
      Severity: Minor
      Found in sosia/classes/original.py - About 3 hrs to fix

        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.
        
        
        Severity: Minor
        Found in sosia/processing/filtering.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 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
            ----------
        Severity: Minor
        Found in sosia/processing/caching/inserting.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 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
        Severity: Minor
        Found in sosia/classes/scientist.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 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
            ----------
        Severity: Minor
        Found in sosia/processing/finding.py - About 1 hr to fix

          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
          Severity: Minor
          Found in sosia/classes/scientist.py - About 1 hr to fix

            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):
            Severity: Minor
            Found in sosia/utils/decorators.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 12 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def __init__(self, scientist, treatment_year, first_year_margin=2,
            Severity: Major
            Found in sosia/classes/original.py - About 1 hr to fix

              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
                  ----------
              Severity: Minor
              Found in sosia/processing/extracting.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 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
              Severity: Minor
              Found in sosia/processing/querying.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 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.
              Severity: Minor
              Found in sosia/classes/original.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 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
              Severity: Minor
              Found in sosia/processing/extracting.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 stacked_query has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def stacked_query(group, template, joiner, q_type, refresh, stacked, verbose):
              Severity: Major
              Found in sosia/processing/querying.py - About 50 mins to fix

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

                def filter_pub_counts(group, conn, ybefore, yupto, npapers, yfrom=None,
                Severity: Major
                Found in sosia/processing/filtering.py - About 50 mins to fix

                  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
                  Severity: Minor
                  Found in sosia/processing/utils.py - About 45 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 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(self, identifier, year, refresh=False, period=None, eids=None,
                  Severity: Minor
                  Found in sosia/classes/scientist.py - About 45 mins to fix

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

                    def base_query(q_type, query, refresh=False, view="COMPLETE", fields=None,
                    Severity: Minor
                    Found in sosia/processing/querying.py - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language