Showing 3,246 of 4,217 total issues

Function _get_available_widgets_hooks has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function _get_available_widgets_hooks($for_section = 'admin')
    {
        if ( ! in_array($for_section, ['user', 'admin'])) {
            $for_section = 'admin';
        }
Severity: Minor
Found in plugins/dashboards/admin_modules/yf_manage_dashboards.class.php - About 2 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 test_load_fixtures has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    public function test_load_fixtures()
    {
        if ($this->_need_skip_test(__FUNCTION__)) {
            return;
        }
Severity: Minor
Found in .dev/tests/functional/model/class_model_sakila_test.Test.php - About 2 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 user_stats.sql_php.php has 288 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

return [
    'fields' => [
        'user_id' => [
Severity: Minor
Found in plugins/sys/share/db/sql_php/user_stats.sql_php.php - About 2 hrs to fix

    File yf_sphinxsearch.class.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    /**
     * Sphinx search querying.
     */
    Severity: Minor
    Found in plugins/search/classes/yf_sphinxsearch.class.php - About 2 hrs to fix

      Method edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function edit()
          {
              $a = $this->_get_info();
              if ( ! $a) {
                  return _404();
      Severity: Major
      Found in plugins/static_pages/admin_modules/yf_static_pages.class.php - About 2 hrs to fix

        Method _tree_items has 72 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function _tree_items(&$data, $extra = [])
            {
                if ($extra['show_controls'] && ! is_callable($extra['show_controls'])) {
                    $r = [
                        'edit_link' => isset($extra['edit_link']) ? $extra['edit_link'] : url('/@object/edit_item/%d/@page'),
        Severity: Major
        Found in plugins/html/classes/html/yf_html_tree.class.php - About 2 hrs to fix

          Method var_edit has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function var_edit()
              {
                  $a = $this->_get_var_info($_GET['id']);
                  if ( ! $a) {
                      return _e('Wrong var id');
          Severity: Major
          Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 2 hrs to fix

            Method operation has 72 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function operation($options = null)
                {
                    $_ = &$options;
                    $is_no_count = &$_['no_count'];
                    $is_sql = &$_['sql'];
            Severity: Major
            Found in plugins/payment/classes/yf_payment_api.class.php - About 2 hrs to fix

              Method _get_methods has 72 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _get_methods($params = [])
                  {
                      $ONLY_PRIVATE_METHODS = [];
                      if (isset($params['private'])) {
                          $ONLY_PRIVATE_METHODS = $params['private'];
              Severity: Major
              Found in plugins/sys/classes/core_api/yf_core_api_user_modules.class.php - About 2 hrs to fix

                Method deposition has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function deposition($options)
                    {
                        if ( ! $this->ENABLE) {
                            return  null;
                        }
                Severity: Major
                Found in plugins/payment/classes/yf_payment_api__provider_bitaps.class.php - About 2 hrs to fix

                  Method _db_change_if_ok has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function _db_change_if_ok($table, $fields, $type, $extra = [])
                      {
                          $func = function ($table, $fields, $type, $extra, $form) {
                              if ( ! $table || ! $type || empty($_POST)) {
                                  return $form;
                  Severity: Major
                  Found in plugins/form2/classes/yf_form2.class.php - About 2 hrs to fix

                    Method user has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function user($name = '', $extra = [])
                        {
                            if (is_array($name)) {
                                $extra = (array) $extra + $name;
                                $name = '';
                    Severity: Major
                    Found in plugins/table2/classes/yf_table2.class.php - About 2 hrs to fix

                      File yf_docs.class.php has 286 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      class yf_docs
                      {
                          private $whats_new = [
                      Severity: Minor
                      Found in plugins/docs/modules/yf_docs.class.php - About 2 hrs to fix

                        Method send has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function send(array $params = [], &$error_message = '')
                            {
                                require_php_lib('phpmailer');
                        
                                $mail = new PHPMailer(true); // defaults to using php 'mail()'
                        Severity: Major
                        Found in plugins/email/classes/mail/yf_mail_driver_phpmailer.class.php - About 2 hrs to fix

                          Method go has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function go($sql = '', $url_path = '', $render_type = '', $records_on_page = 0, $num_records = 0, $tpls_path = '', $add_get_vars = 1, $extra = [])
                              {
                                  if (is_array($url_path)) {
                                      $extra = $url_path;
                                      $url_path = '';
                          Severity: Major
                          Found in plugins/common/classes/common/yf_divide_pages.class.php - About 2 hrs to fix

                            Method test_where_in has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function test_where_in()
                                {
                                    if ($this->_need_skip_test(__FUNCTION__)) {
                                        return;
                                    }
                            Severity: Major
                            Found in .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php - About 2 hrs to fix

                              yf_auth_user has 25 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class yf_auth_user
                              {
                                  /** @var bool Online users vars */
                                  public $STORE_ONLINE_USERS = false;// Use db table to store online users or not
                                  /** @var int Online TTL if inactive */
                              Severity: Minor
                              Found in plugins/auth/classes/auth/yf_auth_user.class.php - About 2 hrs to fix

                                yf_db_utils_pgsql has 25 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class yf_db_utils_pgsql extends yf_db_utils_driver
                                {
                                    public function _get_supported_field_types()
                                    {
                                        // TODO
                                Severity: Minor
                                Found in plugins/db/classes/db/yf_db_utils_pgsql.class.php - About 2 hrs to fix

                                  yf_dynamic has 25 functions (exceeds 20 allowed). Consider refactoring.
                                  Open

                                  class yf_dynamic
                                  {
                                      /** @var bool */
                                      public $ERROR_IMAGE_INTERNAL = false;
                                      /** @var bool */
                                  Severity: Minor
                                  Found in plugins/dynamic/modules/yf_dynamic.class.php - About 2 hrs to fix

                                    class_db_real_query_builder_mysql_test has 25 functions (exceeds 20 allowed). Consider refactoring.
                                    Open

                                    class class_db_real_query_builder_mysql_test extends db_real_abstract
                                    {
                                        public static function _need_skip_test($name)
                                        {
                                            if (defined('HHVM_VERSION') && getenv('TRAVIS') && getenv('CONTINUOUS_INTEGRATION')) {
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language