CaffGeek/MBACNationals

View on GitHub

Showing 7,504 of 7,504 total issues

Function _rows has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent = 0, $level = 0 ) {

        $end = $start + $per_page;

        foreach ( $terms as $key => $term ) {

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

function wp_dashboard_right_now() {
    global $wp_registered_sidebars;

    $num_posts = wp_count_posts( 'post' );
    $num_pages = wp_count_posts( 'page' );
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/dashboard.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 fs_connect has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function fs_connect( $directories = array() ) {
        global $wp_filesystem;

        if ( false === ($credentials = $this->skin->request_filesystem_credentials()) )
            return false;
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-admin/includes/class-wp-upgrader.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 MPEGaudioFrameLength has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public static function MPEGaudioFrameLength(&$bitrate, &$version, &$layer, $padding, &$samplerate) {
        static $AudioFrameLengthCache = array();

        if (!isset($AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate])) {
            $AudioFrameLengthCache[$bitrate][$version][$layer][$padding][$samplerate] = false;
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/ID3/module.audio.mp3.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 get_authors has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function get_authors()
    {
        $authors = array();
        foreach ((array) $this->get_source_tags(SIMPLEPIE_NAMESPACE_ATOM_10, 'author') as $author)
        {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/SimplePie/Source.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 feed_or_html has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    public function feed_or_html()
    {
        $len = strlen($this->file->body);
        $pos = strspn($this->file->body, "\x09\x0A\x0D\x20");

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

    public function call_widget_update( $widget_id ) {
        global $wp_registered_widget_updates, $wp_registered_widget_controls;

        $this->start_capturing_option_updates();
        $parsed_id   = $this->parse_widget_id( $widget_id );
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class-wp-customize-widgets.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 wp_update_nav_menu_item has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function wp_update_nav_menu_item( $menu_id = 0, $menu_item_db_id = 0, $menu_item_data = array() ) {
    $menu_id = (int) $menu_id;
    $menu_item_db_id = (int) $menu_item_db_id;

    // make sure that we don't convert non-nav_menu_item objects into nav_menu_item objects
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/nav-menu.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 feed_or_html has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function feed_or_html()
    {
        $len = strlen($this->file->body);
        $pos = strspn($this->file->body, "\x09\x0A\x0D\x20");

Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class-simplepie.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 all_deps has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function all_deps( $handles, $recursion = false, $group = false ) {
        if ( !$handles = (array) $handles )
            return false;

        foreach ( $handles as $handle ) {
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class.wp-dependencies.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 get_option has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

function get_option( $option, $default = false ) {
    global $wpdb;

    $option = trim( $option );
    if ( empty( $option ) )
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/option.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 call has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

    function call($methodname, $args) {
        // Make sure it's in an array
        if ($args && !is_array($args)) {
            $args = array($args);
        }
Severity: Minor
Found in Web.Admin/2014/wordpress/wp-includes/class-IXR.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 buildGame has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
Open

  buildGame(aShots: string): any {
    const upperShots = aShots.toUpperCase();

    const game = { frames: [], score: 0, fouls: 0 };
    const normalizedShots = [];

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

    var dataService = function ($http, $location) {
        var url = $location.absUrl();
        var host = $location.host();
        var firstSlash = url.indexOf('/', url.indexOf(host)) + 1;
        var currentYear = url.slice(firstSlash, firstSlash + 4);
Severity: Major
Found in Web.Admin/ClientApp/Services/service.data.js - About 3 hrs to fix

    Function getFixed has 89 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function getFixed()/*{{{*/
            {
                if (!options.aspectRatio) return getRect();
                // This function could use some optimization I think...
                var aspect = options.aspectRatio,
    Severity: Major
    Found in Web.Admin/2014/wordpress/wp-includes/js/jcrop/jquery.Jcrop.dev.js - About 3 hrs to fix

      File users.php has 315 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      /**
       * Users administration panel.
       *
       * @package WordPress
      Severity: Minor
      Found in Web.Admin/2014/wordpress/wp-admin/users.php - About 3 hrs to fix

        Method wp_title has 89 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        function wp_title($sep = '&raquo;', $display = true, $seplocation = '') {
            global $wpdb, $wp_locale, $wp_query;
        
            $cat = get_query_var('cat');
            $tag = get_query_var('tag_id');
        Severity: Major
        Found in Web.Admin/2014/wordpress/wp-includes/general-template.php - About 3 hrs to fix

          Method _mime_types has 89 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function _mime_types($ext = '') {
              $mimes = array(
                'ai'    =>  'application/postscript',
                'aif'   =>  'audio/x-aiff',
                'aifc'  =>  'audio/x-aiff',
          Severity: Major
          Found in Web.Admin/2014/wordpress/wp-includes/class-phpmailer.php - About 3 hrs to fix

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

                    if ( newD.getFullYear() != aa || (1 + newD.getMonth()) != mm || newD.getDate() != jj || newD.getMinutes() != mn ) {
                        $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid');
                        return false;
                    } else {
                        $('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid');
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/comment.dev.js and 1 other location - About 3 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/post.dev.js on lines 351..356

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

            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 ( attemptedDate.getFullYear() != aa || (1 + attemptedDate.getMonth()) != mm || attemptedDate.getDate() != jj || attemptedDate.getMinutes() != mn ) {
                            $('.timestamp-wrap', '#timestampdiv').addClass('form-invalid');
                            return false;
                        } else {
                            $('.timestamp-wrap', '#timestampdiv').removeClass('form-invalid');
            Severity: Major
            Found in Web.Admin/2014/wordpress/wp-admin/js/post.dev.js and 1 other location - About 3 hrs to fix
            Web.Admin/2014/wordpress/wp-admin/js/comment.dev.js on lines 28..33

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

            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