sosia-dev/sosia

View on GitHub
sosia/classes/original.py

Summary

Maintainability
B
5 hrs
Test Coverage

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 __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 __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 inform_matches has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def inform_matches(self, fields=None, verbose=False, refresh=False):
              """Add information to matches to aid in selection process.
      
              Parameters
              ----------
      Severity: Minor
      Found in sosia/classes/original.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

      There are no issues that match your filters.

      Category
      Status