i05nagai/mafipy

View on GitHub

Showing 207 of 448 total issues

File sabr.py has 1413 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#!/bin/python
# -*- coding: utf-8 -*-

from __future__ import division, print_function, absolute_import
import math
Severity: Major
Found in mafipy/function/sabr.py - About 3 days to fix

    File pricer_quanto_cms.py has 911 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #!/bin/python
    # -*- coding: utf-8 -*-
    
    from __future__ import division, print_function, absolute_import
    import numpy as np
    Severity: Major
    Found in mafipy/replication/pricer_quanto_cms.py - About 2 days to fix

      File test_pricer_quanto_cms.py has 756 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #!/bin/python
      # -*- coding: utf-8 -*-
      
      from __future__ import division, print_function, absolute_import
      from pytest import approx
      Severity: Major
      Found in mafipy/replication/tests/test_pricer_quanto_cms.py - About 1 day to fix

        File black_scholes.py has 643 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        from __future__ import division, print_function, absolute_import
        import math
        import numpy as np
        import scipy.special
        
        
        Severity: Major
        Found in mafipy/function/black_scholes.py - About 1 day to fix

          File test_black.py has 494 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          #!/bin/python
          # -*- coding: utf-8 -*-
          
          from __future__ import absolute_import
          from __future__ import division
          Severity: Minor
          Found in mafipy/function/tests/test_black.py - About 7 hrs to fix

            File test_black_scholes.py has 483 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            #!/bin/python
            # -*- coding: utf-8 -*-
            
            from __future__ import absolute_import
            from __future__ import division
            Severity: Minor
            Found in mafipy/function/tests/test_black_scholes.py - About 7 hrs to fix

              File test_sabr.py has 479 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              #!/bin/python
              # -*- coding: utf-8 -*-
              
              from __future__ import division, print_function, absolute_import
              from pytest import approx
              Severity: Minor
              Found in mafipy/function/tests/test_sabr.py - About 7 hrs to fix

                File test__quanto_cms_forward_fx.py has 426 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                #!/bin/python
                # -*- coding: utf-8 -*-
                
                from __future__ import division, print_function, absolute_import
                from pytest import approx
                Severity: Minor
                Found in mafipy/replication/tests/test__quanto_cms_forward_fx.py - About 6 hrs to fix

                  TestSabr has 31 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class TestSabr(object):
                  
                      # before all tests starts
                      @classmethod
                      def setup_class(cls):
                  Severity: Minor
                  Found in mafipy/function/tests/test_sabr.py - About 3 hrs to fix

                    File black.py has 323 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    #!/bin/python
                    # -*- coding: utf-8 -*-
                    
                    from __future__ import division, print_function, absolute_import
                    import numpy as np
                    Severity: Minor
                    Found in mafipy/function/black.py - About 3 hrs to fix

                      File _quanto_cms_forward_fx.py has 312 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      #!/bin/python
                      # -*- coding: utf-8 -*-
                      
                      from __future__ import division, print_function, absolute_import
                      import math
                      Severity: Minor
                      Found in mafipy/replication/_quanto_cms_forward_fx.py - About 3 hrs to fix

                        File setup.py has 311 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        #!/usr/bin/env python
                        # -*- coding: utf-8 -*-
                        
                        from setuptools import Command
                        from setuptools.command.test import test as TestCommand
                        Severity: Minor
                        Found in setup.py - About 3 hrs to fix

                          Test_SimpleQuantoCmsLinearBullSpreadHelper has 24 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Test_SimpleQuantoCmsLinearBullSpreadHelper(object):
                          
                              # before all tests starts
                              @classmethod
                              def setup_class(cls):
                          Severity: Minor
                          Found in mafipy/replication/tests/test_pricer_quanto_cms.py - About 2 hrs to fix

                            TestBlackScholes has 24 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class TestBlackScholes(object):
                            
                                # before all tests starts
                                @classmethod
                                def setup_class(cls):
                            Severity: Minor
                            Found in mafipy/function/tests/test_black_scholes.py - About 2 hrs to fix

                              Function test_black_scholes_call_value has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def test_black_scholes_call_value(
                                          self, underlying, strike, rate, maturity, vol, today):
                                      time = maturity - today
                                      if vol <= 0.0:
                                          with pytest.raises(AssertionError):
                              Severity: Minor
                              Found in mafipy/function/tests/test_black_scholes.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 sabr_implied_vol_hagan has a Cognitive Complexity of 14 (exceeds 5 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

                              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 12 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 sabr_implied_vol_hagan_fhess_by_strike has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                def sabr_implied_vol_hagan_fhess_by_strike(
                                        underlying, strike, maturity, alpha, beta, rho, nu):
                                    """sabr_implied_vol_hagan_fhess_by_strike
                                    second derivative of Hagan's SABR implied volatility formula
                                    with respect to strike.
                                Severity: Minor
                                Found in mafipy/function/sabr.py - About 1 hr to fix

                                  Function sabr_implied_vol_hagan_fhess_by_underlying has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  def sabr_implied_vol_hagan_fhess_by_underlying(
                                          underlying, strike, maturity, alpha, beta, rho, nu):
                                      """sabr_implied_vol_hagan_fhess_by_underlying
                                      second derivative of Hagan's SABR implied volatility formula
                                      with respect to underlying.
                                  Severity: Minor
                                  Found in mafipy/function/sabr.py - About 1 hr to fix

                                    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
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language