i05nagai/mafipy

View on GitHub

Showing 207 of 448 total issues

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

def get_var_name(var, symboltable, error=None):
    """getVarName
    Return a var's name as a string.
    This funciton require a
    symboltable(returned value of globals() or locals())
Severity: Minor
Found in mafipy/function/util.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

Avoid too many return statements within this function.
Open

        return (underlying - strike) + value
Severity: Major
Found in mafipy/function/black_scholes.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

        return black_scholes_call_formula(
    Severity: Major
    Found in mafipy/function/black_scholes.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return underlying - math.exp(-rate * time) * strike
      Severity: Major
      Found in mafipy/function/black_scholes.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return 0.0
        Severity: Major
        Found in mafipy/function/black_scholes.py - About 30 mins to fix

          Function replicate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def replicate(init_swap_rate,
                        discount_factor,
                        call_pricer,
                        put_pricer,
                        payoff_type,
          Severity: Minor
          Found in mafipy/replication/pricer_quanto_cms.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

          Function black_scholes_call_value_fhess_by_strike has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

          def black_scholes_call_value_fhess_by_strike(
                  underlying, strike, rate, maturity, vol):
              """black_scholes_call_value_fhess_by_strike
              Second derivative of value of call option with respect to strike
              under black scholes model.
          Severity: Minor
          Found in mafipy/function/black_scholes.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

          Severity
          Category
          Status
          Source
          Language