CaffGeek/MBACNationals

View on GitHub

Showing 7,504 of 7,504 total issues

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

            if ( !empty($r_status) ) {
                if ( !empty($q['perm'] ) && 'editable' == $q['perm'] && !current_user_can("edit_others_{$post_type_cap}s") )
                    $statuswheres[] = "($wpdb->posts.post_author = $user_ID " .  "AND (" . join( ' OR ', $r_status ) . "))";
                else
                    $statuswheres[] = "(" . join( ' OR ', $r_status ) . ")";
Severity: Major
Found in Web.Admin/2014/wordpress/wp-includes/query.php and 1 other location - About 1 hr to fix
Web.Admin/2014/wordpress/wp-includes/query.php on lines 2107..2112

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

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( !empty( $content_struct['post_type'] ) ) {
            if( $content_struct['post_type'] == 'page' ) {
                $cap = ( $publish ) ? 'publish_pages' : 'edit_pages';
                $error_message = __( 'Sorry, you are not allowed to publish pages on this blog.' );
                $post_type = 'page';
Severity: Major
Found in Web.Admin/2014/wordpress/xmlrpc.php and 1 other location - About 1 hr to fix
Web.Admin/2014/wordpress/xmlrpc.php on lines 2026..2041

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

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

                case 'replaygain_album_peak':
                    $thisfile_replaygain['album']['peak']       = (float) str_replace(',', '.', $thisfile_ape_items_current['data'][0]); // float casting will see "0,95" as zero!
                    $thisfile_replaygain['album']['originator'] = 'unspecified';
                    if ($thisfile_replaygain['album']['peak'] <= 0) {
                        $info['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';
Web.Admin/2014/wordpress/wp-includes/ID3/module.tag.apetag.php on lines 154..160

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

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

                    xhr.onreadystatechange = function (){
                        var lkb = parseInt(xhr.getResponseHeader('X-Last-Known-Byte'), 10);

                        _this.status     = xhr.status;
                        _this.statusText = xhr.statusText;
Severity: Minor
Found in Web.Admin/z-scripts/FileAPI.js - About 1 hr to fix

    Function complete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

                    complete: function( next ) {
    
                        // toggle low quality for IE
                        if ( 'image' in active ) {
                            Utils.toggleQuality( active.image, false );
    Severity: Minor
    Found in Web.Admin/2015/js/galleria/galleria-1.4.2.js - About 1 hr to fix

      Function ajaxAdd has 48 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          ajaxAdd: function( e, s ) {
              e = $(e);
              s = s || {};
              var list = this, cls = wpList.parseClass(e,'add'), es, valid, formData;
              s = wpList.pre.call( list, e, s, 'add' );
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-includes/js/wp-lists.dev.js - About 1 hr to fix

        Function Methods has 48 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        Event.Methods = (function() {
          var isButton;
        
          if (Prototype.Browser.IE) {
            var buttonMap = { 0: 1, 1: 4, 2: 2 };
        Severity: Minor
        Found in Web.Admin/2014/wordpress/wp-includes/js/prototype.js - About 1 hr to fix

          Function Methods has 48 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          Event.Methods = (function() {
            var isButton;
          
            if (Prototype.Browser.IE) {
              var buttonMap = { 0: 1, 1: 4, 2: 2 };
          Severity: Minor
          Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/prototype.js - About 1 hr to fix

            Function KeyManager has 48 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                var KeyManager = function()/*{{{*/
                {
                    var $keymgr = $('<input type="radio" />')
                            .css({ position: 'absolute', left: '-30px' })
                            .keypress(parseKey)
            Severity: Minor
            Found in Web.Admin/2014/wordpress/wp-includes/js/jcrop/jquery.Jcrop.dev.js - About 1 hr to fix

              Function Shrink has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              Effect.Shrink = function(element) {
                element = $(element);
                var options = Object.extend({
                  direction: 'center',
                  moveTransition: Effect.Transitions.sinoidal,
              Severity: Minor
              Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/effects.js - About 1 hr to fix

                Function bindHandlers has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        bindHandlers: function() {
                            var handlers, checkCounts;
                
                            media.view.MediaFrame.Select.prototype.bindHandlers.apply( this, arguments );
                
                
                Severity: Minor
                Found in Web.Admin/2014/wordpress/wp-includes/js/media-views.js - About 1 hr to fix

                  Method privExtractFileInOutput has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function privExtractFileInOutput(&$p_entry, &$p_options)
                    {
                      $v_result=1;
                  
                      // ----- Read the file header
                  Severity: Minor
                  Found in Web.Admin/2014/wordpress/wp-admin/includes/class-pclzip.php - About 1 hr to fix

                    Function complete has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                                    complete: function( next ) {
                    
                                        // toggle low quality for IE
                                        if ( 'image' in active ) {
                                            Utils.toggleQuality( active.image, false );
                    Severity: Minor
                    Found in Web.Admin/Content/galleria/galleria-1.4.2.js - About 1 hr to fix

                      Method wp_ajax_upload_attachment has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function wp_ajax_upload_attachment() {
                          check_ajax_referer( 'media-form' );
                      
                          if ( ! current_user_can( 'upload_files' ) )
                              wp_die();
                      Severity: Minor
                      Found in Web.Admin/2014/wordpress/wp-admin/includes/ajax-actions.php - About 1 hr to fix

                        Method install_theme_info has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            function install_theme_info( $theme ) {
                                global $themes_allowedtags;
                        
                                if ( empty( $theme ) )
                                    return;

                          Method __construct has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function __construct($location, $name, $type)
                              {
                                  $this->options = array(
                                      'user' => null,
                                      'pass' => null,
                          Severity: Minor
                          Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Cache/MySQL.php - About 1 hr to fix

                            Method mod_rewrite_rules has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                function mod_rewrite_rules() {
                                    if ( ! $this->using_permalinks()) {
                                        return '';
                                    }
                            
                            
                            Severity: Minor
                            Found in Web.Admin/2014/wordpress/wp-includes/rewrite.php - About 1 hr to fix

                              Function setOpacity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                Element.Methods.setOpacity = function(element, value) {
                                  element = $(element);
                                  element.style.opacity = (value == 1 || value === '') ? '' :
                                    (value < 0.00001) ? 0 : value;
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/js/prototype.js - 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

                              Function match has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                match: function(element) {
                                  this.tokens = [];
                              
                                  var e = this.expression, ps = Selector.patterns, as = Selector.assertions;
                                  var le, p, m;
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/js/prototype.js - 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

                              Function setOpacity has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                                Element.Methods.setOpacity = function(element, value) {
                                  element = $(element);
                                  element.style.opacity = (value == 1 || value === '') ? '' :
                                    (value < 0.00001) ? 0 : value;
                              
                              
                              Severity: Minor
                              Found in Web.Admin/2014/wordpress/wp-includes/js/scriptaculous/prototype.js - 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

                              Severity
                              Category
                              Status
                              Source
                              Language