sonntagsgesicht/dcf

View on GitHub

Showing 88 of 148 total issues

Function bond has 11 arguments (exceeds 4 allowed). Consider refactoring.
Open

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

    Function __call__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def __call__(self, _=None):
            flows = list()
            for item in self.domain:
                payoff = self._flows.get(item, 0.)
                if not isinstance(payoff, (int, float)):
    Severity: Minor
    Found in dcf/cashflows/cashflow.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 get_bucketed_delta has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_bucketed_delta(cashflow_list, discount_curve, valuation_date=None,
                           delta_curve=None, delta_grid=None, shift=.0001):
        r""" list of bpv delta for partly shifted interest rate curve
    
        :param cashflow_list: list of cashflows
    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 __init__ has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, domain, data, interpolation=None):
            r"""class to build piecewise interpolation function
    
            :param list(float) domain: points $x_1 \dots x_n$
            :param list(float) data: values $y_1 \dots y_n$
    Severity: Minor
    Found in dcf/interpolation.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 10 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
    Severity: Major
    Found in dcf/cashflows/contingent.py - About 1 hr to fix

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

          def __init__(self, payment_date_list,
      Severity: Major
      Found in dcf/cashflows/contingent.py - About 1 hr to fix

        Function table has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def table(self):
                """ cashflow details as list of tuples """
                # print(tabulate(cf.table, headers='firstrow'))  # for pretty print
        
                header, table = list(), list()
        Severity: Minor
        Found in dcf/cashflows/cashflow.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 get_curve_fit has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def get_curve_fit(cashflow_list, discount_curve, valuation_date=None,
        Severity: Major
        Found in dcf/pricer.py - About 1 hr to fix

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

              def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
          Severity: Major
          Found in dcf/cashflows/contingent.py - About 1 hr to fix

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

                def __init__(self, start, end, amount=DEFAULT_AMOUNT,
            Severity: Major
            Found in dcf/cashflows/payoffs.py - About 1 hr to fix

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

                  def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
              Severity: Major
              Found in dcf/cashflows/cashflow.py - About 1 hr to fix

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

                    def add(self, foreign_currency, foreign_curve=None, fx_spot=1.0):
                        """
                        adds contents to FxShelf.
                        If curve is FxCurve or FxDict,
                        spot should turn curve.currency into self.currency,
                Severity: Minor
                Found in dcf/curves/fx.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 __setitem__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __setitem__(self, key, value):
                        if isinstance(key, tuple) and len(key) == 2:
                            d, f = key
                            if not (isinstance(d, type(self.currency))
                                    and isinstance(f, type(self.currency))
                Severity: Minor
                Found in dcf/curves/fx.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 kwargs has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def kwargs(self):
                        """returns constructor arguments as ordered dictionary
                        (under construction)
                        """
                        warn('%s().kwargs is under construction' % self.__class__.__name__)
                Severity: Minor
                Found in dcf/cashflows/cashflow.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 __getitem__ has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __getitem__(self, item):
                        if item in self:
                            return super(FxContainer, self).__getitem__(item)
                        else:
                            if not isinstance(item, type(self.currency)):
                Severity: Minor
                Found in dcf/curves/fx.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 a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def __init__(self, value=0., masterscale=None):
                        if not isinstance(masterscale, RatingClass.master_scale):
                            if isinstance(masterscale, dict):
                                masterscale = self.__class__.master_scale(masterscale)
                            elif isinstance(masterscale, (tuple, list)) or \
                Severity: Minor
                Found in dcf/ratingclass.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, domain=(), data=(), interpolation=None, origin=None,
                Severity: Major
                Found in dcf/curves/fx.py - About 50 mins to fix

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

                      def __init__(self, payment_date_list, amount_list=DEFAULT_AMOUNT,
                                   strike_list=(), is_put_list=False,
                                   fixing_offset=None, pay_offset=None,
                                   origin=None, payoff_model=None):
                          r""" list of European option payoffs
                  Severity: Minor
                  Found in dcf/cashflows/contingent.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 _get_compounding_factor has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def _get_compounding_factor(self, start, stop):
                          if start == stop:
                              return 1. if 2 * float_info.min <= self(start) else 0.
                  
                          current = start
                  Severity: Minor
                  Found in dcf/curves/creditcurve.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 a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def __init__(self, domain=(), data=(), interpolation=None, origin=None,
                                   day_count=None, forward_tenor=None):
                          # validate probabilities
                          if not isinstance(data, RateCurve):
                              data = [max(float_info.min, min(d, 1. - float_info.min)) for d in
                  Severity: Minor
                  Found in dcf/curves/creditcurve.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

                  Severity
                  Category
                  Status
                  Source
                  Language