kiler129/TorrentGhost

View on GitHub

Showing 112 of 112 total issues

Method prepareCUrl has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private function prepareCUrl()
    {
        $this->cUrl = curl_init((string)$this->fetchRequest->getUri());
        if ($this->cUrl === false) {
            throw new \RuntimeException('Failed to initialize cURL - internal error');
Severity: Minor
Found in src/Http/FetchJob.php - About 1 hr to fix

    Function downloadLinks has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

        private function downloadLinks(array $links)
        {
            $this->logger->info('Begin downloading ' . count($links) . ' files...');
    
            foreach ($links as $name => $link) {
    Severity: Minor
    Found in src/Application.php - 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

    Method matchDownloadLinks has 27 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function matchDownloadLinks($sourceName, array $links)
        {
            $this->logger->debug("Matching links from source $sourceName against all rules");
    
            $linksToDownload = [];
    Severity: Minor
    Found in src/Application.php - About 1 hr to fix

      Method extractLink has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function extractLink($string)
          {
              $matchResult = @preg_match($this->configuration->getLinkExtractPattern(), $string, $matches);
              if ($matchResult === false) {
                  throw new RegexException(
      Severity: Minor
      Found in src/Aggregator/AbstractAggregator.php - About 1 hr to fix

        Method downloadLinks has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            private function downloadLinks(array $links)
            {
                $this->logger->info('Begin downloading ' . count($links) . ' files...');
        
                foreach ($links as $name => $link) {
        Severity: Minor
        Found in src/Application.php - About 1 hr to fix

          Function buildStreamsArrays has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              private function buildStreamsArrays(&$read, &$write)
              {
                  $currentTime = time();
          
                  foreach ($this->sources as $sourceName => $sourceObj) {
          Severity: Minor
          Found in src/Application.php - About 55 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

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

              private function calculateGcd($a, $b)
          Severity: Minor
          Found in src/Application.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 $a. Configured minimum length is 3.
          Open

              private function calculateGcd($a, $b)
          Severity: Minor
          Found in src/Application.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 $fp. Configured minimum length is 3.
          Open

                      $fp = @fopen($filePath, 'w');
          Severity: Minor
          Found in src/Application.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

          Blank line found at end of control structure
          Open

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

          Blank line found at end of control structure
          Open

          
          

          Blank line found at end of control structure
          Open

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

          Blank line found at end of control structure
          Open

          
          
          Severity: Minor
          Found in src/Http/CookiesBag.php by phpcodesniffer

          Blank line found at end of control structure
          Open

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

          Blank line found at end of control structure
          Open

          
          

          Blank line found at end of control structure
          Open

          
          

          Blank line found at end of control structure
          Open

          
          

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

              public function extractLink($string)
              {
                  $matchResult = @preg_match($this->configuration->getLinkExtractPattern(), $string, $matches);
                  if ($matchResult === false) {
                      throw new RegexException(
          Severity: Minor
          Found in src/Aggregator/AbstractAggregator.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 closing parenthesis and the opening brace of a multi-line function declaration must be on the same line
          Open

              {

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

              }
          Severity: Minor
          Found in src/Command/AppCommand.php by phpcodesniffer
          Severity
          Category
          Status
          Source
          Language