i05nagai/mafipy

View on GitHub

Showing 207 of 1,119 total issues

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

    def __init__(self,
Severity: Major
Found in mafipy/replication/pricer_quanto_cms.py - About 1 hr to fix

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

    def linear_annuity_bull_spread_pricer(
    Severity: Major
    Found in benchmarks/benchmarks/bull_spread_qunato_cms.py - About 1 hr to fix

      Function test_sabr_implied_vol_hagan has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      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
      Severity: Minor
      Found in mafipy/function/tests/test_sabr.py - About 1 hr to fix

        Function parse_setuppy_commands has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        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).
            """
        Severity: Minor
        Found in setup.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 test_replication_bull_spread has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        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
        Severity: Minor
        Found in mafipy/replication/tests/test_replication_method.py - About 1 hr to fix

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

          def sabr_caibration_simple(market_vols,
          Severity: Major
          Found in mafipy/calibrator/sabr.py - About 1 hr to fix

            Function sabr_implied_vol_hagan has 27 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            def sabr_implied_vol_hagan(
                    underlying, strike, maturity, alpha, beta, rho, nu):
                """sabr_implied_vol_hagan
                calculate implied volatility under SABR model.
            
            
            Severity: Minor
            Found in mafipy/function/sabr.py - About 1 hr to fix

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

              def black_scholes_implied_vol(underlying,
              Severity: Major
              Found in mafipy/calibrator/implied_vol.py - About 1 hr to fix

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

                def _forward_fx_diffusion_fhess(
                Severity: Major
                Found in mafipy/replication/_quanto_cms_forward_fx.py - About 1 hr to fix

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

                  def sabr_receivers_swaption_value(
                  Severity: Major
                  Found in mafipy/function/sabr.py - About 1 hr to fix

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

                    def _forward_fx_diffusion_fprime(
                    Severity: Major
                    Found in mafipy/replication/_quanto_cms_forward_fx.py - About 1 hr to fix

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

                          def test_sabr_payers_swaption_value(
                      Severity: Major
                      Found in mafipy/function/tests/test_sabr.py - About 1 hr to fix

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

                            def test_sabr_receivers_swaption_value(
                        Severity: Major
                        Found in mafipy/function/tests/test_sabr.py - About 1 hr to fix

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

                          def sabr_payers_swaption_value(
                          Severity: Major
                          Found in mafipy/function/sabr.py - About 1 hr to fix

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

                            def black_swaption_implied_vol(init_swap_rate,
                            Severity: Major
                            Found in mafipy/calibrator/implied_vol.py - About 1 hr to fix

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

                              def _forward_fx_diffusion(
                              Severity: Major
                              Found in mafipy/replication/_quanto_cms_forward_fx.py - About 1 hr to fix

                                Consider simplifying this complex logical expression.
                                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:
                                Severity: Major
                                Found in mafipy/function/tests/test_black_scholes.py - About 1 hr to fix

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

                                      def test_model_sabr_payers_swaption_delta(
                                  Severity: Major
                                  Found in mafipy/function/tests/test_sabr.py - About 1 hr to fix

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

                                    def sabr_payers_swaption_delta(
                                    Severity: Major
                                    Found in mafipy/function/sabr.py - About 1 hr to fix

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

                                          def test_black_payers_swaption_value(self,
                                                                               init_swap_rate,
                                                                               option_strike,
                                                                               swap_annuity,
                                                                               option_maturity,
                                      Severity: Minor
                                      Found in mafipy/function/tests/test_black.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

                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language