spotweb/spotweb

View on GitHub

Showing 850 of 850 total issues

Function tokenize has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function tokenize($nowtag = [])
    {
        $curcnt = 0;
        $tagcfg = null;
        $contents[$curcnt] = $this->newcontent();
Severity: Minor
Found in lib/ubb/SpotUbb_parser.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 validateSettings has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    public function validateSettings($settings)
    {
        $result = new Dto_FormResult();

        // Define arrays with valid settings
Severity: Minor
Found in lib/services/Settings/Services_Settings_Base.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

Services_NzbHandler_abs has 33 functions (exceeds 20 allowed). Consider refactoring.
Open

abstract class Services_NzbHandler_abs
{
    protected $_name = 'Abstract';
    protected $_nameShort = 'Abstract';

Severity: Minor
Found in lib/services/NzbHandler/Services_NzbHandler_abs.php - About 4 hrs to fix

    Dao_Base_Cache has 33 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Dao_Base_Cache implements Dao_Cache
    {
        private $_cachePath = '';
        protected $_conn;
    
    
    Severity: Minor
    Found in lib/dao/Base/Dao_Base_Cache.php - About 4 hrs to fix

      Method validateUserPreferences has 103 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function validateUserPreferences($prefs, $currentPrefs)
          {
              $result = new Dto_FormResult();
      
              // Define several arrays with valid settings
      Severity: Major
      Found in lib/services/User/Services_User_Record.php - About 4 hrs to fix

        File editsettings.inc.php has 337 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        require __DIR__.'/includes/header.inc.php';
        require __DIR__.'/includes/form-messages.inc.php';
        
        
        Severity: Minor
        Found in templates/we1rdo/editsettings.inc.php - About 4 hrs to fix

          Function fetchSpotComments has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              public function fetchSpotComments($msgId, $prevMsgids, $userId, $start, $length)
              {
                  /*
                   * Calculate the total amount of comments we want to retrieve
                   */
          Severity: Minor
          Found in lib/services/Providers/Services_Providers_Comments.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 parseParameters has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
          Open

              private static function parseParameters($noopt = [])
              {
                  $result = [];
                  if (!isset($GLOBALS['argv'])) {
                      return $result;
          Severity: Minor
          Found in lib/SpotCommandline.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

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

                if (nextItem != null) {
                  while (nextItem[0].nodeName.toLowerCase() != 'li' || nextItem[0] == this.currentItem[0] || nextItem[0] == this.helper[0]) {
                    if (nextItem[0].nextSibling) {
                      nextItem = $(nextItem[0].nextSibling);
                    } else {
          Severity: Major
          Found in templates/we1rdo/js/jquery.ui.nestedSortable.js and 1 other location - About 4 hrs to fix
          templates/we1rdo/js/jquery.ui.nestedSortable.js on lines 144..153

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

          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

                      if (previousItem != null) {
                          while (previousItem[0].nodeName.toLowerCase() != 'li' || previousItem[0] == this.currentItem[0] || previousItem[0] == this.helper[0]) {
                              if (previousItem[0].previousSibling) {
                                  previousItem = $(previousItem[0].previousSibling);
                              } else {
          Severity: Major
          Found in templates/we1rdo/js/jquery.ui.nestedSortable.js and 1 other location - About 4 hrs to fix
          templates/we1rdo/js/jquery.ui.nestedSortable.js on lines 157..166

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

          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

              } else if (direction == 'next' && next.size() == 1) {
                  current.removeClass('active');
                  next.addClass('active');
                  if($("#overlay").is(':visible')) {
                      $("div.container").removeClass("hidden").addClass("visible");
          Severity: Major
          Found in templates/we1rdo/js/scripts.js and 1 other location - About 4 hrs to fix
          templates/we1rdo/js/scripts.js on lines 447..463

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

          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

              if (direction == 'prev' && prev.size() == 1) {
                  current.removeClass('active');
                  prev.addClass('active');
                  if($("#overlay").is(':visible')) {
                      $("div.container").removeClass("hidden").addClass("visible");
          Severity: Major
          Found in templates/we1rdo/js/scripts.js and 1 other location - About 4 hrs to fix
          templates/we1rdo/js/scripts.js on lines 455..463

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

          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

          Services_NzbHandler_NZBVortex has 32 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Services_NzbHandler_NZBVortex extends Services_NzbHandler_abs
          {
              private $_host = null;
              private $_url = null;
              private $_apikey = null;
          Severity: Minor
          Found in lib/services/NzbHandler/Services_NzbHandler_NZBVortex.php - About 4 hrs to fix

            Method updateExternalList has 98 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function updateExternalList($newlist, $idtype)
                {
                    $updatelist = [];
                    $updskipped = 0;
                    $countnewlistspotterid = 0;
            Severity: Major
            Found in lib/dao/Base/Dao_Base_BlackWhiteList.php - About 3 hrs to fix

              Function openDialog has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

              function openDialog(divid, title, url, buttonClick, successAction, closeCb, openCb) {
                  var $dialdiv = $("#" + divid);
              
                  /*
                   * Test whether we need to 'dialog'-ify the
              Severity: Minor
              Found in templates/we1rdo/js/spotdialogs.js - 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 filtersToXml has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function filtersToXml($filterList)
                  {
                      $svcSearchQP = new Services_Search_QueryParser($this->_daoFactory->getConnection());
              
                      // create the XML document
              Severity: Minor
              Found in lib/services/User/Services_User_Filters.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 prepareFilterValues has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function prepareFilterValues($search)
                  {
                      SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                      $filterValueList = [];
              
              
              Severity: Minor
              Found in lib/services/Search/Services_Search_QueryParser.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 parse has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
              Open

                  private function parse($locale, $domain)
                  {
                      $this->translationTable[$locale][$domain] = [];
                      $mofile = sprintf('%s/%s/LC_MESSAGES/%s.mo', $this->dir, $locale, $domain);
                      $cachefile = sprintf('%s/%s/LC_MESSAGES/%s.ser', $this->dir, $locale, $domain);
              Severity: Minor
              Found in lib/gettext/Gettext_PHP.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

              File filters.inc.php has 329 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
                  SpotTiming::start('tpl:filters');
              
                  // We definieeren hier een aantal settings zodat we niet steeds dezelfde check hoeven uit te voeren
                  $count_newspots = ($currentSession['user']['prefs']['count_newspots']);
              Severity: Minor
              Found in templates/we1rdo/includes/filters.inc.php - About 3 hrs to fix

                Method categoriesToJson has 97 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function categoriesToJson()
                    {
                        /*
                         * Don't allow the tree to be cached, it contains the current state of the
                         * tree
                Severity: Major
                Found in lib/page/SpotPage_catsjson.php - About 3 hrs to fix
                  Severity
                  Category
                  Status
                  Source
                  Language