kiler129/TorrentGhost

View on GitHub

Showing 15 of 112 total issues

Function setParametersOnInstance has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
Open

    private function setParametersOnInstance(ConfigurationInterface $instance)
    {
        $classReflection = new \ReflectionObject($instance);

        foreach ($this->instanceParameters as $paramName => $paramValue) {
Severity: Minor
Found in src/Configuration/ConfigurationFactory.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 parseFeedXml has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public function parseFeedXml($feed)
    {
        $feed = simplexml_load_string($feed);
        if ($feed === false) {
            $this->logger->error('RSS XML parsing failed in ' . $this->getName(), libxml_get_errors());
Severity: Minor
Found in src/Aggregator/RssAggregator.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 runMainLoop has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    private function runMainLoop()
    {
        $except = null;

        while (true) {
Severity: Minor
Found in src/Application.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 parseFeedXml has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function parseFeedXml($feed)
    {
        $feed = simplexml_load_string($feed);
        if ($feed === false) {
            $this->logger->error('RSS XML parsing failed in ' . $this->getName(), libxml_get_errors());
Severity: Major
Found in src/Aggregator/RssAggregator.php - About 2 hrs to fix

    Function matchDownloadLinks has a Cognitive Complexity of 14 (exceeds 5 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

    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 setParametersOnInstance has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        private function setParametersOnInstance(ConfigurationInterface $instance)
        {
            $classReflection = new \ReflectionObject($instance);
    
            foreach ($this->instanceParameters as $paramName => $paramValue) {
    Severity: Minor
    Found in src/Configuration/ConfigurationFactory.php - About 1 hr to fix

      Method runMainLoop has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function runMainLoop()
          {
              $except = null;
      
              while (true) {
      Severity: Minor
      Found in src/Application.php - About 1 hr to fix

        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

                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

                Function applyBlacklist has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function applyBlacklist(array &$entriesToFilter)
                    {
                        foreach ($this->blacklist as $key => $value) {
                            if (isset($entriesToFilter[$key]) && $entriesToFilter[$key] === $value) {
                                $this->logger->debug(
                Severity: Minor
                Found in src/Util/Blacklist.php - About 25 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

                Severity
                Category
                Status
                Source
                Language