sonntagsgesicht/dcf

View on GitHub

Showing 88 of 148 total issues

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

def get_yield_to_maturity(cashflow_list, valuation_date=None, present_value=0.,
Severity: Minor
Found in dcf/pricer.py - About 45 mins to fix

    Function __getitem__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def __getitem__(self, item):
            if isinstance(item, (tuple, list)):
                return tuple(self[i] for i in item)
            else:
                payoff = self._flows.get(item, 0.)
    Severity: Minor
    Found in dcf/cashflows/cashflow.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, domain=(), data=(), interpolation=None, origin=None,
    Severity: Minor
    Found in dcf/curves/volatilitycurve.py - About 45 mins to fix

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

      def get_fair_rate(cashflow_list, discount_curve,
      Severity: Minor
      Found in dcf/pricer.py - About 45 mins to fix

        Function _get_cash_rate has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def _get_cash_rate(self, start, stop=None, step=None):
                if stop and step:
                    if not start + step == stop:
                        raise AssertionError(
                            "if stop and step given, start+step must meet stop.")
        Severity: Minor
        Found in dcf/curves/interestratecurve.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, valuation_date=None, forward_curve=None,
        Severity: Minor
        Found in dcf/models/displaced.py - About 45 mins to fix

          Function get_terminal_vol has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_terminal_vol(self, start, stop=None):
                  if stop is None:
                      return self(start)
                  if start == self.origin:
                      return self(stop)
          Severity: Minor
          Found in dcf/curves/volatilitycurve.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 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def __init__(self, expiry,
          Severity: Minor
          Found in dcf/cashflows/payoffs.py - About 35 mins to fix

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

            def _interest_payment_dates(
            Severity: Minor
            Found in dcf/cashflows/products.py - About 35 mins to fix

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

                  def __init__(self, valuation_date=None, forward_curve=None,
              Severity: Minor
              Found in dcf/models/optionpricing.py - About 35 mins to fix

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

                    def __init__(self, domain=(), data=(), interpolation=None,
                Severity: Minor
                Found in dcf/curves/curve.py - About 35 mins to fix

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

                  def get_basis_point_value(cashflow_list, discount_curve, valuation_date=None,
                  Severity: Minor
                  Found in dcf/pricer.py - About 35 mins to fix

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

                    def asset_swap(coupon_leg, forward_curve, spread=0.0,
                    Severity: Minor
                    Found in dcf/cashflows/products.py - About 35 mins to fix

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

                          def __init__(self, domain=(), data=(), interpolation=None, origin=None,
                                       day_count=None, yield_curve=0.0):
                              r""" curve of future asset prices i.e. asset forward prices
                      
                              :param domain: dates of given asset prices $t_1 \dots t_n$
                      Severity: Minor
                      Found in dcf/curves/curve.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 _update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _update(self, x_list=list(), y_list=list()):
                              """ _update interpolation data
                              :param list(float) x_list: x values
                              :param list(float) y_list: y values
                              """
                      Severity: Minor
                      Found in dcf/interpolation.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_cash_rate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def _get_cash_rate(self, start, stop=None, step=None):
                              if stop and step:
                                  if not start + step == stop:
                                      raise AssertionError(
                                          "if stop and step given, start+step must meet stop.")
                      Severity: Minor
                      Found in dcf/curves/interestratecurve.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 bond has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def bond(start_date=TODAY,
                               end_date=TODAY + MATURITY,
                               period=BOND_TENOR,
                               convention='mod_follow',
                               holidays=None,
                      Severity: Minor
                      Found in dcf/cashflows/products.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 details has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def details(self, model=None):
                              # works even if the model is the forward_curve
                              forward_curve = getattr(model, 'forward_curve', model)
                              details = super().details(forward_curve)
                              floorlet = caplet = 0.0
                      Severity: Minor
                      Found in dcf/cashflows/payoffs.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 _simple_bracketing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def _simple_bracketing(func, a, b, precision=1e-13):
                          """ find root by _simple_bracketing an interval
                      
                          :param callable func: function to find root
                          :param float a: lower interval boundary
                      Severity: Minor
                      Found in dcf/pricer.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 plot_cast has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def plot_cast(curve, x=None):
                              today = curve.origin
                      
                              if x is None:
                                  if curve.domain[-1] < today + '1y':
                      Severity: Minor
                      Found in dev2.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

                      Severity
                      Category
                      Status
                      Source
                      Language