i05nagai/mafipy

View on GitHub

Showing 1,119 of 1,119 total issues

Function test_black_scholes_call_value_fhess_by_strike has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def test_black_scholes_call_value_fhess_by_strike(
Severity: Minor
Found in mafipy/function/tests/test_black_scholes.py - About 45 mins to fix

    Function calc_local_vol_model_implied_vol has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def calc_local_vol_model_implied_vol(
    Severity: Minor
    Found in mafipy/function/local_vol.py - About 45 mins to fix

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

          def finalize_options(self):
              TestCommand.finalize_options(self)
              # if cov option is specified, option is replaced.
              if self.cov:
                  self.test_args += ["--cov={0}".format(self.cov)]
      Severity: Minor
      Found in setup.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 run has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(self):
              if self.run_type is not None:
                  self.args += ["{0}".format(self.run_type)]
              if self.bench is not None:
                  self.args += ["--bench={0}".format(self.bench)]
      Severity: Minor
      Found in setup.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

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @pytest.mark.parametrize(
              "swap_rate, time, vol, corr", [
                  # vol < 0.0 raise AssertionError
                  (2.1, 1.2, -1.3, 0.1),
                  # corr < -1.0 raise AssertionError
      Severity: Major
      Found in mafipy/replication/tests/test__quanto_cms_forward_fx.py and 3 other locations - About 45 mins to fix
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 97..107
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 208..217
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 266..275

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              numerator3 = (2.0 - 3.0 * rho * rho) * nu * nu
      Severity: Major
      Found in mafipy/function/tests/test_sabr.py and 2 other locations - About 45 mins to fix
      mafipy/function/sabr.py on lines 214..214
      mafipy/function/tests/test_sabr.py on lines 113..113

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

          numerator33 = (2.0 - 3.0 * rho * rho) * nu * nu
      Severity: Major
      Found in mafipy/function/sabr.py and 2 other locations - About 45 mins to fix
      mafipy/function/tests/test_sabr.py on lines 113..113
      mafipy/function/tests/test_sabr.py on lines 144..144

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @pytest.mark.parametrize(
              "swap_rate, time, vol, corr", [
                  # vol < 0.0 raise AssertionError
                  (2.0, 1.0, -1.0, 0.1),
                  # corr < -1.0 raise AssertionError
      Severity: Major
      Found in mafipy/replication/tests/test__quanto_cms_forward_fx.py and 3 other locations - About 45 mins to fix
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 97..107
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 153..162
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 208..217

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @pytest.mark.parametrize(
              "swap_rate, time, vol, corr", [
                  # is_inverse=False
                  # vol < 0.0 raise AssertionError
                  (2.1, 1.2, -1.3, 0.1),
      Severity: Major
      Found in mafipy/replication/tests/test__quanto_cms_forward_fx.py and 3 other locations - About 45 mins to fix
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 153..162
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 208..217
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 266..275

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 3 locations. Consider refactoring.
      Open

              numerator33 = (2.0 - 3.0 * rho * rho) * nu * nu
      Severity: Major
      Found in mafipy/function/tests/test_sabr.py and 2 other locations - About 45 mins to fix
      mafipy/function/sabr.py on lines 214..214
      mafipy/function/tests/test_sabr.py on lines 144..144

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 4 locations. Consider refactoring.
      Open

          @pytest.mark.parametrize(
              "swap_rate, time, vol, corr", [
                  # vol < 0.0 raise AssertionError
                  (2.1, 1.2, -1.3, 0.1),
                  # corr < -1.0 raise AssertionError
      Severity: Major
      Found in mafipy/replication/tests/test__quanto_cms_forward_fx.py and 3 other locations - About 45 mins to fix
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 97..107
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 153..162
      mafipy/replication/tests/test__quanto_cms_forward_fx.py on lines 266..275

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 35.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Consider simplifying this complex logical expression.
      Open

          if time < 0.0 or np.isclose(time, 0.0):
              return 0.0
          elif np.isclose(underlying, 0.0):
              return math.exp(-rate * time) * max(-strike, 0.0)
          elif np.isclose(strike, 0.0) and underlying > 0.0:
      Severity: Major
      Found in mafipy/function/black_scholes.py - About 40 mins to fix

        Consider simplifying this complex logical expression.
        Open

                if time < 0.0 or np.isclose(time, 0.0):
                    expect = 0.0
                elif np.isclose(strike, 0.0) and underlying > 0.0:
                    # max(-|S|, 0)
                    expect = 0.0
        Severity: Major
        Found in mafipy/function/tests/test_black_scholes.py - About 40 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def __init__(self, **params):
                  """__init__
          
                  :param **params: strike and gearing is required as key.
                  """
          Severity: Minor
          Found in mafipy/function/payoff.py and 1 other location - About 40 mins to fix
          mafipy/function/payoff.py on lines 214..220

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          class AnnuityMappingFuncHelper(object):
              """AnnuityMappingFuncHelper
              Interface to generate annuity mapping function
              and it's first and second derivative.
              """
          Severity: Minor
          Found in mafipy/replication/replication_method.py and 1 other location - About 40 mins to fix
          mafipy/function/payoff.py on lines 193..206

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              def __init__(self, **params):
                  """__init__
          
                  :param **params: underlying and gearing is required as key.
                  """
          Severity: Minor
          Found in mafipy/function/payoff.py and 1 other location - About 40 mins to fix
          mafipy/function/payoff.py on lines 239..245

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          class PayoffHelper(object):
              """PayoffFactory
              generate payoff function as a single variable.
              derivative is with respect to the variable.
              """
          Severity: Minor
          Found in mafipy/function/payoff.py and 1 other location - About 40 mins to fix
          mafipy/replication/replication_method.py on lines 77..90

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 34.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function test_model_black_payers_swaption_vega has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def test_model_black_payers_swaption_vega(self,
          Severity: Minor
          Found in mafipy/function/tests/test_black.py - About 35 mins to fix

            Function test_black_payers_swaption_pdf has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def test_black_payers_swaption_pdf(self,
            Severity: Minor
            Found in mafipy/function/tests/test_black.py - About 35 mins to fix

              Function d_fprime_by_strike has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

              def d_fprime_by_strike(underlying, strike, rate, maturity, vol):
              Severity: Minor
              Found in mafipy/function/black_scholes.py - About 35 mins to fix
                Severity
                Category
                Status
                Source
                Language