spotweb/spotweb

View on GitHub

Showing 850 of 850 total issues

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

                    if(event.pageX - $(document).scrollLeft() < o.scrollSensitivity)
                        scrolled = $(document).scrollLeft($(document).scrollLeft() - o.scrollSpeed);
                    else if($(window).width() - (event.pageX - $(document).scrollLeft()) < o.scrollSensitivity)
                        scrolled = $(document).scrollLeft($(document).scrollLeft() + o.scrollSpeed);
Severity: Major
Found in templates/we1rdo/js/jquery.ui.nestedSortable.js and 1 other location - About 5 hrs to fix
templates/we1rdo/js/jquery.ui.nestedSortable.js on lines 76..79

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

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

    public function updateUserRecord($user, array $groupList, $allowEditGroupMembership)
    {
        $result = new Dto_FormResult('success');
        $spotUser = $this->getUser($user['userid']);

Severity: Minor
Found in lib/services/User/Services_User_Record.php - About 5 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 Services_Retriever_Spots.php has 412 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

class Services_Retriever_Spots extends Services_Retriever_Base
{
    /**
Severity: Minor
Found in lib/services/Retriever/Services_Retriever_Spots.php - About 5 hrs to fix

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

    <?php
        require __DIR__.'/includes/form-messages.inc.php';
    
    if (!showResults($result)) {
        ?>
    Severity: Major
    Found in templates/mobile/createuser.inc.php and 1 other location - About 5 hrs to fix
    templates/we1rdo/createuser.inc.php on lines 1..32

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

    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

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

    <?php
        require __DIR__.'/includes/form-messages.inc.php';
    
    if (!showResults($result)) {
        ?>
    Severity: Major
    Found in templates/we1rdo/createuser.inc.php and 1 other location - About 5 hrs to fix
    templates/mobile/createuser.inc.php on lines 1..32

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

    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

    File SpotStruct_pgsql.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    class SpotStruct_pgsql extends SpotStruct_abs
    {
        /*
    Severity: Minor
    Found in lib/dbstruct/SpotStruct_pgsql.php - About 5 hrs to fix

      File SpotInstall.php has 410 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      /**
       * Created by PhpStorm.
       * User: root
      Severity: Minor
      Found in lib/SpotInstall.php - About 5 hrs to fix

        Function hasUrlForSpot has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            public function hasUrlForSpot()
            {
                if ($this->alternateDownloadUrl) {
                    return true;
                }
        Severity: Minor
        Found in lib/services/Providers/Services_Providers_HttpNzb.php - About 5 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 categoryListToSql has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
        Open

            private function categoryListToSql($categoryList)
            {
                SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
                $categorySql = [];
        
        
        Severity: Minor
        Found in lib/services/Search/Services_Search_QueryParser.php - About 5 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 index.php has 404 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        <?php
        
        //error_reporting(2147483647);
        //ini_set('display_errors', 1);
        
        
        Severity: Minor
        Found in index.php - About 5 hrs to fix

          Method filterValuesToSql has 140 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              private function filterValuesToSql($filterValueList, $currentSession)
              {
                  SpotTiming::start(__CLASS__.'::'.__FUNCTION__);
          
                  // Add a list of possible text searches
          Severity: Major
          Found in lib/services/Search/Services_Search_QueryParser.php - About 5 hrs to fix

            File Dao_Base_User.php has 397 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            class Dao_Base_User implements Dao_User
            {
                protected $_conn;
            Severity: Minor
            Found in lib/dao/Base/Dao_Base_User.php - About 5 hrs to fix

              Function parseFull has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function parseFull($xmlStr)
                  {
                      // Create a template array so we always have the full fields to prevent ugly notices
                      $tpl_spot = ['category' => '', 'website' => '', 'image' => '', 'sabnzbdurl' => '', 'messageid' => '', 'searchurl' => '', 'description' => '',
                          'sub'               => '', 'filesize' => '', 'poster' => '', 'tag' => '', 'nzb' => [], 'title' => '',
              Severity: Minor
              Found in lib/services/Format/Services_Format_Parsing.php - About 5 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 drawGraph has 127 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function drawGraph(currentSpeed,interval) {
                  var numXLabels = 8;
                  var numYLabels = 5;
              
                  if($("table.sabGraphData tbody > tr").size() == 1) {
              Severity: Major
              Found in templates/we1rdo/js/sabpanel.js - About 5 hrs to fix

                Function transition has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        transition: function( toPage, triggerData, settings ) {
                            var fromPage, url, pageUrl, fileUrl,
                                active, activeIsInitialPage,
                                historyDir, pageTitle, isDialog,
                                alreadyThere, newPageTitle,
                Severity: Major
                Found in js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.js - About 5 hrs to fix

                  Function updateSabPanel has 126 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function updateSabPanel(start,limit) {
                      var baseURL = sabBaseURL();
                      var url = baseURL+'&action=getstatus';
                  
                      $.getJSON(url, function(json){
                  Severity: Major
                  Found in templates/we1rdo/js/sabpanel.js - About 5 hrs to fix

                    Function cb has 125 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            function cb(e) {
                                if (xhr.aborted || callbackProcessed) {
                                    return;
                                }
                                try {
                    Severity: Major
                    Found in js/jquery/jquery.form.js - About 5 hrs to fix

                      Consider simplifying this complex logical expression.
                      Open

                          if (
                              // iOS 4.3 and older : Platform is iPhone/Pad/Touch and Webkit version is less than 534 (ios5)
                              ( ( platform.indexOf( "iPhone" ) > -1 || platform.indexOf( "iPad" ) > -1  || platform.indexOf( "iPod" ) > -1 ) && wkversion && wkversion < 534 ) ||
                              // Opera Mini
                              ( w.operamini && ({}).toString.call( w.operamini ) === "[object OperaMini]" ) ||
                      Severity: Critical
                      Found in js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.js - About 5 hrs to fix

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

                                if ($cacheType == Dao_Cache::SpotImage) {
                                    switch ($metadata['imagetype']) {
                                        case IMAGETYPE_GIF: $filePath .= '.gif';
                                            break;
                                        case IMAGETYPE_JPEG: $filePath .= '.jpg';
                        Severity: Major
                        Found in lib/dao/Base/Dao_Base_Cache.php and 1 other location - About 5 hrs to fix
                        lib/dao/Base/Dao_Base_Cache.php on lines 216..243

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

                        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 ($cacheType == Dao_Cache::SpotImage) {
                                    switch ($metadata['imagetype']) {
                                        case IMAGETYPE_GIF: $filePath .= '.gif';
                                            break;
                                        case IMAGETYPE_JPEG: $filePath .= '.jpg';
                        Severity: Major
                        Found in lib/dao/Base/Dao_Base_Cache.php and 1 other location - About 5 hrs to fix
                        lib/dao/Base/Dao_Base_Cache.php on lines 145..172

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

                        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

                        Severity
                        Category
                        Status
                        Source
                        Language