i05nagai/mafipy

View on GitHub
mafipy/function/tests/test_black_scholes.py

Summary

Maintainability
F
6 days
Test Coverage

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

    Cyclomatic complexity is too high in method test_black_scholes_call_value. (24)
    Open

        @pytest.mark.parametrize(
            "underlying, strike, rate, maturity, vol, today",
            [
                # maturity < 0
                (1.0, 1.0, 1.0, -1.0, 1.0, 0.0),

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    Cyclomatic complexity is too high in method test_black_scholes_put_value. (12)
    Open

        @pytest.mark.parametrize(

    Cyclomatic Complexity

    Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

    Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

    Construct Effect on CC Reasoning
    if +1 An if statement is a single decision.
    elif +1 The elif statement adds another decision.
    else +0 The else statement does not cause a new decision. The decision is at the if.
    for +1 There is a decision at the start of the loop.
    while +1 There is a decision at the while statement.
    except +1 Each except branch adds a new conditional path of execution.
    finally +0 The finally block is unconditionally executed.
    with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
    assert +1 The assert statement internally roughly equals a conditional statement.
    Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
    Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

    Source: http://radon.readthedocs.org/en/latest/intro.html

    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

      Cyclomatic complexity is too high in method test_black_scholes_call_delta. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol, today",
              [
                  # vol < 0 raise AssertionError
                  (1.1, 1.2, 0.2, 1.3, -0.1, 0.0),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method test_black_scholes_call_value_third_by_strike. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol, today",
              [
                  # underlying > strike
                  (2.0, 1.0, 1.0, 1.0, 0.1, 0.0),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method test_black_scholes_call_volga. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol",
              [
                  # vol < 0 raise AssertionError
                  (1.1, 1.2, 0.3, 1.4, -0.1),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method test_black_scholes_call_vega. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol, today",
              [
                  # vol < 0 raise AssertionError
                  (1.1, 1.2, 0.3, 1.4, -0.1, 0.0),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method test_black_scholes_call_vega_fprime_by_strike. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol",
              [
                  # vol < 0 raise AssertionError
                  (1.1, 1.2, 0.3, 1.4, -0.1),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Cyclomatic complexity is too high in method test_black_scholes_call_value_fhess_by_strike. (6)
      Open

          @pytest.mark.parametrize(
              "underlying, strike, rate, maturity, vol, today",
              [
                  # vol <= 0 raise AssertionError
                  (1.0, 2.0, 1.0, 1.0, -0.1, 0.0),

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      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

      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_black_scholes_call_value_third_by_strike has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

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

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

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

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

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

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

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

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

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

                  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 test_black_scholes_call_rho has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

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

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

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

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

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

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

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

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

                                def test_black_scholes_call_theta(
                            Severity: Minor
                            Found in mafipy/function/tests/test_black_scholes.py - About 45 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

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

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

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

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

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

                                        def test_func_d1(self, underlying, strike, rate, maturity, vol):
                                    Severity: Minor
                                    Found in mafipy/function/tests/test_black_scholes.py - About 35 mins to fix

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

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

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

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

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

                                              def test_func_d2(self, underlying, strike, rate, maturity, vol):
                                          Severity: Minor
                                          Found in mafipy/function/tests/test_black_scholes.py - About 35 mins to fix

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

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

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

                                                  def test_black_scholes_put_value(
                                                          self, underlying, strike, rate, maturity, vol, today):
                                                      time = maturity - today
                                                      call_value = target.black_scholes_call_value(
                                                          underlying, strike, rate, maturity, vol, today)
                                              Severity: Minor
                                              Found in mafipy/function/tests/test_black_scholes.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

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

                                                      if vol < 0.0:
                                                          with pytest.raises(AssertionError):
                                                              actual = target.black_scholes_call_gamma(
                                                                  underlying, strike, rate, maturity, vol)
                                                      else:
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 2 other locations - About 6 hrs to fix
                                              mafipy/function/tests/test_black.py on lines 337..362
                                              mafipy/function/tests/test_black_scholes.py on lines 406..420

                                              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 99.

                                              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

                                                      elif maturity < 0.0:
                                                          actual = target.black_scholes_call_delta(
                                                              underlying, strike, rate, maturity, vol)
                                                          assert 0.0 == approx(actual)
                                                      else:
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 2 other locations - About 6 hrs to fix
                                              mafipy/function/tests/test_black.py on lines 337..362
                                              mafipy/function/tests/test_black_scholes.py on lines 436..450

                                              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 99.

                                              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

                                                      elif maturity <= 0.0:
                                                          expect = 0
                                                          actual = target.black_scholes_call_vega_fprime_by_strike(
                                                              underlying, strike, rate, maturity, vol)
                                                          assert expect == approx(actual)
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 1 other location - About 6 hrs to fix
                                              mafipy/function/tests/test_black.py on lines 493..518

                                              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 99.

                                              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

                                                  @pytest.mark.parametrize(
                                                      "underlying, strike, rate, maturity, vol, today",
                                                      [
                                                          # vol <= 0 raise AssertionError
                                                          (1.0, 2.0, 1.0, 1.0, -0.1, 0.0),
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 2 other locations - About 2 hrs to fix
                                              mafipy/function/tests/test_black_scholes.py on lines 253..265
                                              mafipy/function/tests/test_black_scholes.py on lines 335..347

                                              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 51.

                                              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

                                                  @pytest.mark.parametrize(
                                                      "underlying, strike, rate, maturity, vol, today",
                                                      [
                                                          # underlying > strike
                                                          (2.0, 1.0, 1.0, 1.0, 0.1, 0.0),
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 2 other locations - About 2 hrs to fix
                                              mafipy/function/tests/test_black_scholes.py on lines 293..305
                                              mafipy/function/tests/test_black_scholes.py on lines 335..347

                                              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 51.

                                              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

                                                  @pytest.mark.parametrize(
                                                      "underlying, strike, rate, maturity, vol, today",
                                                      [
                                                          # underlying > strike
                                                          (2.0, 1.0, 1.0, 1.0, 0.1, 0.0),
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 2 other locations - About 2 hrs to fix
                                              mafipy/function/tests/test_black_scholes.py on lines 253..265
                                              mafipy/function/tests/test_black_scholes.py on lines 293..305

                                              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 51.

                                              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

                                                      expect_numerator = (math.log(underlying / strike)
                                                                          + (rate - vol * vol * 0.5) * maturity)
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 1 other location - About 1 hr to fix
                                              mafipy/function/black_scholes.py on lines 64..65

                                              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 47.

                                              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

                                                      expect_numerator = (math.log(underlying / strike)
                                                                          + (rate + vol * vol * 0.5) * maturity)
                                              Severity: Major
                                              Found in mafipy/function/tests/test_black_scholes.py and 1 other location - About 1 hr to fix
                                              mafipy/function/black_scholes.py on lines 42..43

                                              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 47.

                                              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

                                              There are no issues that match your filters.

                                              Category
                                              Status