Showing 207 of 1,119 total issues
Function __init__
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def __init__(self,
Function linear_annuity_bull_spread_pricer
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def linear_annuity_bull_spread_pricer(
Function test_sabr_implied_vol_hagan
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_sabr_implied_vol_hagan(
self, underlying, strike, maturity, alpha, beta, rho, nu):
one_minus_beta = 1.0 - beta
one_minus_beta2 = one_minus_beta ** 2
one_minus_beta4 = one_minus_beta ** 4
Function parse_setuppy_commands
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def parse_setuppy_commands(args):
"""Check the commands and respond appropriately. Disable broken commands.
Return a boolean value for whether or not to run the build or not (avoid
parsing Cython and template files if False).
"""
- Read upRead up
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 test_replication_bull_spread
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def test_replication_bull_spread(self):
data = util.get_real(1)
min_put_range = 1e-10
init_swap_rate = data[0]
max_call_range = 10.0
Function sabr_caibration_simple
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sabr_caibration_simple(market_vols,
Function sabr_implied_vol_hagan
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def sabr_implied_vol_hagan(
underlying, strike, maturity, alpha, beta, rho, nu):
"""sabr_implied_vol_hagan
calculate implied volatility under SABR model.
Function black_scholes_implied_vol
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def black_scholes_implied_vol(underlying,
Function _forward_fx_diffusion_fhess
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _forward_fx_diffusion_fhess(
Function sabr_receivers_swaption_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sabr_receivers_swaption_value(
Function _forward_fx_diffusion_fprime
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _forward_fx_diffusion_fprime(
Function test_sabr_payers_swaption_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def test_sabr_payers_swaption_value(
Function test_sabr_receivers_swaption_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def test_sabr_receivers_swaption_value(
Function sabr_payers_swaption_value
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sabr_payers_swaption_value(
Function black_swaption_implied_vol
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def black_swaption_implied_vol(init_swap_rate,
Function _forward_fx_diffusion
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def _forward_fx_diffusion(
Consider simplifying this complex logical expression. Open
Open
if maturity < 0 or np.isclose(maturity, 0.0):
expect = 0.0
assert expect == approx(actual)
# never below strike
elif underlying > 0.0 and strike < 0.0:
Function test_model_sabr_payers_swaption_delta
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def test_model_sabr_payers_swaption_delta(
Function sabr_payers_swaption_delta
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
def sabr_payers_swaption_delta(
Function test_black_payers_swaption_value
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
def test_black_payers_swaption_value(self,
init_swap_rate,
option_strike,
swap_annuity,
option_maturity,
- Read upRead up
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"