chippyash/Math-Matrix

View on GitHub

Showing 183 of 183 total issues

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

<?php
/**
 * Math-Matrix
 *
 * @author Ashley Kitson
Severity: Major
Found in src/Chippyash/Math/Matrix/Special/Cauchy.php and 1 other location - About 3 days to fix
src/Chippyash/Math/Matrix/Special/Chebspec.php on lines 1..138

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

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

<?php
/**
 * Math-Matrix
 *
 * @author Ashley Kitson
Severity: Major
Found in src/Chippyash/Math/Matrix/Special/Chebspec.php and 1 other location - About 3 days to fix
src/Chippyash/Math/Matrix/Special/Cauchy.php on lines 1..120

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

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

<?php
/**
 * Math-Matrix
 *
 * @author Ashley Kitson
Severity: Major
Found in src/Chippyash/Math/Matrix/Special/Zeros.php and 1 other location - About 2 days to fix
src/Chippyash/Math/Matrix/Special/Ones.php on lines 1..86

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

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

<?php
/**
 * Math-Matrix
 *
 * @author Ashley Kitson
Severity: Major
Found in src/Chippyash/Math/Matrix/Special/Ones.php and 1 other location - About 2 days to fix
src/Chippyash/Math/Matrix/Special/Zeros.php on lines 1..86

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

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

<?php
/*
 * Math-Matrix library
 *
 * @author Ashley Kitson <akitson@zf4.biz>
Severity: Major
Found in src/Chippyash/Math/Matrix/Computation/Add/Scalar.php and 2 other locations - About 5 hrs to fix
src/Chippyash/Math/Matrix/Computation/Mul/Scalar.php on lines 1..63
src/Chippyash/Math/Matrix/Computation/Sub/Scalar.php on lines 1..63

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

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

<?php
/*
 * Math-Matrix library
 *
 * @author Ashley Kitson <akitson@zf4.biz>
Severity: Major
Found in src/Chippyash/Math/Matrix/Computation/Sub/Scalar.php and 2 other locations - About 5 hrs to fix
src/Chippyash/Math/Matrix/Computation/Add/Scalar.php on lines 1..59
src/Chippyash/Math/Matrix/Computation/Mul/Scalar.php on lines 1..63

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

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

<?php
/*
 * Math-Matrix library
 *
 * @author Ashley Kitson <akitson@zf4.biz>
Severity: Major
Found in src/Chippyash/Math/Matrix/Computation/Mul/Scalar.php and 2 other locations - About 5 hrs to fix
src/Chippyash/Math/Matrix/Computation/Add/Scalar.php on lines 1..59
src/Chippyash/Math/Matrix/Computation/Sub/Scalar.php on lines 1..63

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

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 decompose has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    public function decompose(NumericMatrix $mA, $extra = null)
    {
        $this->assertParameterIsMatrix($extra, 'Parameter extra is not a matrix')
                ->assertMatrixIsNumeric($extra, 'Parameter extra is not a numeric matrix')
                ->assertMatrixIsSquare($mA,
Severity: Minor
Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 4 hrs 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 createCorrectScalarType has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
Open

    protected function createCorrectScalarType(NumericMatrix $originalMatrix , $scalar)
    {
        if ($scalar instanceof NumericTypeInterface) {
            if ($originalMatrix instanceof RationalMatrix) {
                return $scalar->asRational();
Severity: Minor
Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 3 hrs 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 LUDecomposition has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    protected function LUDecomposition(NumericMatrix $mA)
    {
        // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
        $LU = $mA->toArray();
        $m = $this->rows = $mA->rows();
Severity: Minor
Found in src/Chippyash/Math/Matrix/Decomposition/Lu.php - About 3 hrs 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 createRational has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createRational(array $data)
    {
        foreach ($data as &$row) {
            foreach ($row as &$item) {
                if (!$item instanceof RationalType) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/MatrixFactory.php - About 2 hrs 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 checkEntryEquality has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    protected function checkEntryEquality(Matrix $mB, $strict)
    {
        if ($strict) {
            if (get_class($this) !== get_class($mB)) {
                return false;
Severity: Minor
Found in src/Chippyash/Math/Matrix/NumericMatrix.php - About 2 hrs 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 createComplex has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
Open

    public static function createComplex(array $data)
    {
        foreach ($data as &$row) {
            foreach ($row as &$item) {
                if (!$item instanceof ComplexType) {
Severity: Minor
Found in src/Chippyash/Math/Matrix/MatrixFactory.php - About 2 hrs 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

Method decompose has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function decompose(NumericMatrix $mA, $extra = null)
    {
        $this->assertParameterIsMatrix($extra, 'Parameter extra is not a matrix')
                ->assertMatrixIsNumeric($extra, 'Parameter extra is not a numeric matrix')
                ->assertMatrixIsSquare($mA,
Severity: Major
Found in src/Chippyash/Math/Matrix/Decomposition/GaussJordanElimination.php - About 2 hrs to fix

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

    <?php
    /*
     * Math-Matrix library
     *
     * @author Ashley Kitson <akitson@zf4.biz>
    src/Chippyash/Math/Matrix/Derivative/AbstractDerivative.php on lines 1..59

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

    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

    <?php
    /*
     * Math-Matrix library
     *
     * @author Ashley Kitson <akitson@zf4.biz>
    Severity: Major
    Found in src/Chippyash/Math/Matrix/Derivative/AbstractDerivative.php and 1 other location - About 2 hrs to fix
    src/Chippyash/Math/Matrix/Computation/AbstractComputation.php on lines 1..61

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

    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

    Method format has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function format(Matrix $mA, array $options = array())
        {
            if (!$mA instanceof NumericMatrix) {
                throw new \InvalidArgumentException('Matrix is not NumericMatrix');
            }
    Severity: Major
    Found in src/Chippyash/Math/Matrix/Formatter/DirectedGraph.php - About 2 hrs to fix

      Method LUDecomposition has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          protected function LUDecomposition(NumericMatrix $mA)
          {
              // Use a "left-looking", dot-product, Crout/Doolittle algorithm.
              $LU = $mA->toArray();
              $m = $this->rows = $mA->rows();
      Severity: Minor
      Found in src/Chippyash/Math/Matrix/Decomposition/Lu.php - About 2 hrs to fix

        Method createCorrectScalarType has 47 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function createCorrectScalarType(NumericMatrix $originalMatrix , $scalar)
            {
                if ($scalar instanceof NumericTypeInterface) {
                    if ($originalMatrix instanceof RationalMatrix) {
                        return $scalar->asRational();
        Severity: Minor
        Found in src/Chippyash/Math/Matrix/Traits/CreateCorrectScalarType.php - About 1 hr to fix

          Avoid using short method names like IsNumeric::is(). The configured minimum method name length is 3.
          Open

              public function is(Matrix $mA)
              {
                  return ($mA instanceof NumericMatrix);
              }

          ShortMethodName

          Since: 0.2

          Detects when very short method names are used.

          Example

          class ShortMethod {
              public function a( $index ) { // Violation
              }
          }

          Source https://phpmd.org/rules/naming.html#shortmethodname

          Severity
          Category
          Status
          Source
          Language