robotomize/fujes

View on GitHub

Showing 145 of 145 total issues

Method __construct has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

        $urlName,
        $matchString,
        $depth = 1,
        $jsonEncode = true,
        $multipleResult = false,
Severity: Major
Found in src/robotomize/Fujes/SearchEngine.php - About 50 mins to fix

    Avoid variables with short names like $tt. Configured minimum length is 3.
    Open

            $tt = new SearchFacade(
    Severity: Minor
    Found in tests/FacadeTest.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Avoid variables with short names like $ex. Configured minimum length is 3.
    Open

            $ex = new \Exception($exceptionString);

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Avoid variables with short names like $tt. Configured minimum length is 3.
    Open

            $tt = new SearchFacade(self::$prefix . self::$testUrlName[0], self::$testMatchString[4], 1, false, true);
    Severity: Minor
    Found in tests/FacadeTest.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

    Avoid variables with short names like $tt. Configured minimum length is 3.
    Open

            $tt = new SearchFacade(self::$prefix . self::$testUrlName[0], self::$testMatchString[4], 1, false, true);
    Severity: Minor
    Found in tests/FacadeTest.php by phpmd

    ShortVariable

    Since: 0.2

    Detects when a field, local, or parameter has a very short name.

    Example

    class Something {
        private $q = 15; // VIOLATION - Field
        public static function main( array $as ) { // VIOLATION - Formal
            $r = 20 + $this->q; // VIOLATION - Local
            for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                $r += $this->q;
            }
        }
    }

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

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

        private function outputInfo()
        {
            if ($this->jsonEncode) {
                if (empty($this->moreJsonTreesOnString)) {
                    $this->logger->pushFlashMsg('error');
    Severity: Minor
    Found in src/robotomize/Fujes/SearchEngine.php - 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

    Method __construct has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

            $inputArray,
            $matchString,
            $multipleResult = false,
            $quality = 1,
            $versionType = 'master'
    Severity: Minor
    Found in src/robotomize/Fujes/SearchLevenshteinCompare.php - About 35 mins to fix

      Blank line found at end of control structure
      Open

      
      
      Severity: Minor
      Found in src/example.php by phpcodesniffer

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

          private function parseJsonToArray()
          {
              if (file_exists($this->urlName)) {
                  $this->jsonData = file_get_contents($this->urlName);
              } else {
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.php - 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

      Function closing brace must go on the next line following the body; found 1 blank lines before brace
      Open

          }
      Severity: Minor
      Found in tests/FacadeTest.php by phpcodesniffer

      Function closing brace must go on the next line following the body; found 1 blank lines before brace
      Open

          }

      Function closing brace must go on the next line following the body; found 2 blank lines before brace
      Open

          }
      Severity: Minor
      Found in tests/FactoryTest.php by phpcodesniffer

      Blank line found at end of control structure
      Open

      
      
      Severity: Minor
      Found in src/robotomize/Utils/Log.php by phpcodesniffer

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

          private function createResultArray($relevantArray)
          {
              if (0 === count($relevantArray)) {
                  $relevantArray = $this->relevantTree;
              }
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.php - 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

      The method __construct has a boolean flag argument $jsonEncode, which is a certain sign of a Single Responsibility Principle violation.
      Open

              $jsonEncode = true,
      Severity: Minor
      Found in src/robotomize/Fujes/SearchEngine.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method __construct has a boolean flag argument $multipleResult, which is a certain sign of a Single Responsibility Principle violation.
      Open

              $multipleResult = false,

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method find has a boolean flag argument $jsonEncode, which is a certain sign of a Single Responsibility Principle violation.
      Open

              $jsonEncode = true,

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Missing class import via use statement (line '46', column '23').
      Open

                  throw new \InvalidArgumentException;

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      The method jsonEncode has a boolean flag argument $encodeFlag, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public static function jsonEncode($needleBranch, $relevantTree, $encodeFlag = true)
      Severity: Minor
      Found in src/robotomize/Utils/Json.php by phpmd

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      The method __construct has a boolean flag argument $multipleResult, which is a certain sign of a Single Responsibility Principle violation.
      Open

          public function __construct($inputArray, $matchString, $multipleResult = false, $quality = 1)

      BooleanArgumentFlag

      Since: 1.4.0

      A boolean flag argument is a reliable indicator for a violation of the Single Responsibility Principle (SRP). You can fix this problem by extracting the logic in the boolean flag into its own class or method.

      Example

      class Foo {
          public function bar($flag = true) {
          }
      }

      Source https://phpmd.org/rules/cleancode.html#booleanargumentflag

      Severity
      Category
      Status
      Source
      Language