sonntagsgesicht/dcf

View on GitHub

Showing 88 of 148 total issues

File curve.py has 612 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-

# dcf
# ---
# A Python library for generating discounted cashflows.
Severity: Major
Found in dcf/curves/curve.py - About 1 day to fix

    File pricer.py has 535 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    
    # dcf
    # ---
    # A Python library for generating discounted cashflows.
    Severity: Major
    Found in dcf/pricer.py - About 1 day to fix

      File interpolation.py has 461 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      
      # dcf
      # ---
      # A Python library for generating discounted cashflows.
      Severity: Minor
      Found in dcf/interpolation.py - About 7 hrs to fix

        Function __iter__ has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
        Open

            def __iter__(self):
                if self._masterscale:
                    value = round(float(self), 7)
                    value_list = [round(x, 7) for x in list(self.masterscale.values())]
        
        
        Severity: Minor
        Found in dcf/ratingclass.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 optionpricing.py has 369 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        
        # dcf
        # ---
        # A Python library for generating discounted cashflows.
        Severity: Minor
        Found in dcf/models/optionpricing.py - About 4 hrs to fix

          File payoffs.py has 324 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          
          # dcf
          # ---
          # A Python library for generating discounted cashflows.
          Severity: Minor
          Found in dcf/cashflows/payoffs.py - About 3 hrs to fix

            File interestratecurve.py has 315 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            
            # dcf
            # ---
            # A Python library for generating discounted cashflows.
            Severity: Minor
            Found in dcf/curves/interestratecurve.py - About 3 hrs to fix

              File dev2.py has 314 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              
              # dcf
              # ---
              # A Python library for generating discounted cashflows.
              Severity: Minor
              Found in dev2.py - About 3 hrs to fix

                File cashflow.py has 283 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                
                # dcf
                # ---
                # A Python library for generating discounted cashflows.
                Severity: Minor
                Found in dcf/cashflows/cashflow.py - About 2 hrs to fix

                  Function details has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def details(self, date, strike=None):
                          """model parameter details
                  
                          :param date: option expiry date (also fixing date)
                          :param strike: option strike value
                  Severity: Minor
                  Found in dcf/models/optionpricing.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 rate_table has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                  Open

                  def rate_table(curve, x_grid=None, y_grid=None):
                      if x_grid is None:
                          if curve.origin in curve.domain:
                              x_grid = curve.domain
                          else:
                  Severity: Minor
                  Found in dcf/curves/plot.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 plot_vol has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def plot_vol(curves, x=None):
                          if not isinstance(curves, (tuple, list)):
                              curves = curves,
                  
                          fig, axs = plt.subplots(1, len(curves))
                  Severity: Minor
                  Found in dev2.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 plot_curve has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def plot_curve(curves, x=None):
                          if not isinstance(curves, (tuple, list)):
                              curves = (curves,)
                  
                          fig, axs = plt.subplots(1, len(curves))
                  Severity: Minor
                  Found in dev2.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 interest_rate_swap has 15 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def interest_rate_swap(start_date=TODAY,
                  Severity: Major
                  Found in dcf/cashflows/products.py - About 1 hr to fix

                    Function get_interest_accrued has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def get_interest_accrued(cashflow_list, valuation_date):
                        r""" calculates interest accrued for rate cashflows
                    
                        :param cashflow_list: requires a `day_count` property
                        :param valuation_date: calculation date
                    Severity: Minor
                    Found in dcf/pricer.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 make_grid has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def make_grid(curve, step=None, nums=10):
                        domain = curve.domain
                        grid = list()
                        for start, stop in zip(domain[:-1], domain[1:]):
                            grid.append(start)
                    Severity: Minor
                    Found in dcf/curves/plot.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 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def __init__(self, domain=(), data=(), interpolation=None, origin=None,
                                     day_count=None, forward_tenor=None):
                            if isinstance(domain, RateCurve):
                                # if argument is a curve add extra curve points to domain
                                # for better approximation
                    Severity: Minor
                    Found in dcf/curves/interestratecurve.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 rate_table has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def rate_table(curve, x_grid=None, y_grid=None):
                        r""" table of calculated rates
                    
                        :param curve: function $f$
                        :param x_grid: vertical date axis $x_0, \dots, x_m$
                    Severity: Minor
                    Found in dcf/curves/curve.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 details has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def details(self, forward_curve=None):
                            yf = self.day_count(self.start, self.end)
                    
                            details = {
                                'cashflow': 0.0,
                    Severity: Minor
                    Found in dcf/cashflows/payoffs.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 _interest_payment_dates has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def _interest_payment_dates(
                            start_date, end_date, period, convention, holidays):
                        if bd and isinstance(start_date, bd.BusinessDate):
                            start_date = bd.BusinessDate(start_date)
                            if bd.BusinessPeriod.is_businessperiod(end_date):
                    Severity: Minor
                    Found in dcf/cashflows/products.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

                    Severity
                    Category
                    Status
                    Source
                    Language