spotweb/spotweb

View on GitHub

Showing 850 of 850 total issues

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

                        if (_supportsState()) {
                            _h[_opts.history ? 'pushState' : 'replaceState']({}, '',
                                _opts.state.replace(/\/$/, '') + (_value === '' ? '/' : _value));
                        } else {
                            _silent = TRUE;
Severity: Major
Found in templates/we1rdo/js/jquery.address.js and 1 other location - About 1 day to fix
templates/we1rdo/js/jquery.address.js on lines 120..145

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

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 (_supportsState()) {
                    _h.popState({}, '', _opts.state.replace(/\/$/, '') + (_value === '' ? '/' : _value));
                } else {
                    _silent = TRUE;
                    if (_webkit) {
Severity: Major
Found in templates/we1rdo/js/jquery.address.js and 1 other location - About 1 day to fix
templates/we1rdo/js/jquery.address.js on lines 522..548

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

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

    private function filterValuesToSql($filterValueList, $currentSession)
    {
        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);

        // Add a list of possible text searches
Severity: Minor
Found in lib/services/Search/Services_Search_QueryParser.php - About 1 day 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

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

<?php
    require __DIR__.'/includes/form-messages.inc.php';

    /*
     * Do we need to redirect on success? If so, perform this
Severity: Major
Found in templates/mobile/login.inc.php and 1 other location - About 7 hrs to fix
templates/we1rdo/login.inc.php on lines 1..62

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

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';

    /*
     * Do we need to redirect on success? If so, perform this
Severity: Major
Found in templates/we1rdo/login.inc.php and 1 other location - About 7 hrs to fix
templates/mobile/login.inc.php on lines 1..62

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

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

    public function updateSchema()
    {
        // Drop any older (not used anymore) FTS indexes on the spots full table
        $this->dropIndex('idx_spotsfull_fts_1', 'spotsfull');
        $this->dropIndex('idx_spotsfull_fts_2', 'spotsfull');
Severity: Minor
Found in lib/dbstruct/SpotStruct_abs.php - About 7 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 perform has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
Open

    public function perform($url, $lastModTime = null, $redirTries = 0)
    {
        SpotTiming::start(__CLASS__.'::'.__FUNCTION__);

        /*
Severity: Minor
Found in lib/services/Providers/Services_Providers_Http.php - About 7 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 _registerInternalEvents has 183 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.mobile._registerInternalEvents = function() {
        var getAjaxFormData = function( $form, calculateOnly ) {
            var url, ret = true, formData, vclickedName, method;
            if ( !$.mobile.ajaxEnabled ||
                    // test that the form is, itself, ajax false
Severity: Major
Found in js/jquery.mobile-1.4.5/jquery.mobile-1.4.5.js - About 7 hrs to fix

    Function validateUserPreferences has a Cognitive Complexity of 47 (exceeds 5 allowed). Consider refactoring.
    Open

        public function validateUserPreferences($prefs, $currentPrefs)
        {
            $result = new Dto_FormResult();
    
            // Define several arrays with valid settings
    Severity: Minor
    Found in lib/services/User/Services_User_Record.php - About 7 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 search has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function search($outputtype)
        {
            // Check users' permissions
            $this->_spotSec->fatalPermCheck(SpotSecurity::spotsec_perform_search, '');
    
    
    Severity: Major
    Found in lib/page/SpotPage_newznabapi.php - About 7 hrs to fix

      File Dao_Base_Cache.php has 454 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

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

        Function askNntpSettings has a Cognitive Complexity of 44 (exceeds 5 allowed). Consider refactoring.
        Open

            public static function askNntpSettings()
            {
                global $settings;
        
                // Loading the file directly seems to sometimes result in a weird error. GH issue #1861
        Severity: Minor
        Found in lib/SpotInstall.php - About 6 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

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

        <?php
            require_once __DIR__.'/includes/basic-html-header.inc.php';
        ?>
        <?php
                if ($currentSession['user']['userid'] == $settings->get('nonauthenticated_userid')) {
        Severity: Major
        Found in templates/mobile/permdenied.inc.php and 1 other location - About 6 hrs to fix
        templates/we1rdo/permdenied.inc.php on lines 1..61

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

        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_once __DIR__.'/includes/basic-html-header.inc.php';
        ?>
        <?php
                if ($currentSession['user']['userid'] == $settings->get('nonauthenticated_userid')) {
        Severity: Major
        Found in templates/we1rdo/permdenied.inc.php and 1 other location - About 6 hrs to fix
        templates/mobile/permdenied.inc.php on lines 1..61

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

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

        function SpotPosting() {
            this.commentForm = null;
            this.reportForm = null;
            this.uiStart = null;
            this.uiDone = null;
        Severity: Major
        Found in js/posting/posting.js - About 6 hrs to fix

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

                              if((this.overflowOffset.top + this.scrollParent[0].offsetHeight) - event.pageY < o.scrollSensitivity)
                                  this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop + o.scrollSpeed;
                              else if(event.pageY - this.overflowOffset.top < o.scrollSensitivity)
                                  this.scrollParent[0].scrollTop = scrolled = this.scrollParent[0].scrollTop - o.scrollSpeed;
          Severity: Major
          Found in templates/we1rdo/js/jquery.ui.nestedSortable.js and 1 other location - About 6 hrs to fix
          templates/we1rdo/js/jquery.ui.nestedSortable.js on lines 69..72

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

          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((this.overflowOffset.left + this.scrollParent[0].offsetWidth) - event.pageX < o.scrollSensitivity)
                                  this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft + o.scrollSpeed;
                              else if(event.pageX - this.overflowOffset.left < o.scrollSensitivity)
                                  this.scrollParent[0].scrollLeft = scrolled = this.scrollParent[0].scrollLeft - o.scrollSpeed;
          Severity: Major
          Found in templates/we1rdo/js/jquery.ui.nestedSortable.js and 1 other location - About 6 hrs to fix
          templates/we1rdo/js/jquery.ui.nestedSortable.js on lines 64..67

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

          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

          Method parseHeader has 152 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function parseHeader($subj, $from, $date, $messageid, $rsaKeys)
              {
                  // Initialize an empty array, we create a basic template in a few
                  $spot = [];
          
          
          Severity: Major
          Found in lib/services/Format/Services_Format_Parsing.php - About 6 hrs to fix

            Method showResults has 150 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function showResults($spots, $offset, $outputtype)
                {
                    $nzbhandling = $this->_currentSession['user']['prefs']['nzbhandling'];
            
                    if ($outputtype == 'json') {
            Severity: Major
            Found in lib/page/SpotPage_newznabapi.php - About 6 hrs to fix

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

                                  if(event.pageY - $(document).scrollTop() < o.scrollSensitivity)
                                      scrolled = $(document).scrollTop($(document).scrollTop() - o.scrollSpeed);
                                  else if($(window).height() - (event.pageY - $(document).scrollTop()) < o.scrollSensitivity)
                                      scrolled = $(document).scrollTop($(document).scrollTop() + 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 81..84

              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

              Severity
              Category
              Status
              Source
              Language