Showing 3,246 of 4,217 total issues

Function read has a Cognitive Complexity of 95 (exceeds 5 allowed). Consider refactoring.
Open

    public function read($filename)
    {
        // split the file into lines, we'll process it line by line
        $config_file = file($filename);

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

yf_db has 99 functions (exceeds 20 allowed). Consider refactoring.
Open

class yf_db
{
    /** @var string Type of database (default) */
    public $DB_TYPE = 'mysql';
    /** @var bool Switch caching on/off */
Severity: Major
Found in plugins/db/classes/yf_db.class.php - About 1 day to fix

    File class_assets_test.Test.php has 790 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    require_once dirname(__DIR__) . '/yf_unit_tests_setup.php';
    
    class class_assets_test extends PHPUnit\Framework\TestCase
    Severity: Major
    Found in .dev/tests/unit/class_assets_test.Test.php - About 1 day to fix

      Function conf has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring.
      Open

          function conf($name = null, $new_value = null, $_arr_name = '')
          {
              $_arr_sub = null;
              if ( ! $_arr_name) {
                  $_arr_name = 'CONF';
      Severity: Minor
      Found in functions/yf_conf.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

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

      <?php
      
      /**
       * Special methods for user authentification.
       *
      Severity: Major
      Found in plugins/auth/classes/auth/yf_auth_user.class.php - About 1 day to fix

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

        <?php
        
        /**
         * YF database migrations handler.
         */
        Severity: Major
        Found in plugins/db/classes/db/yf_db_migrator.class.php - About 1 day to fix

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

          <?php
          
          class yf_manage_deposit
          {
              public $payment_api = null;
          Severity: Major
          Found in plugins/payment/admin_modules/yf_manage_deposit.class.php - About 1 day to fix

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

            <?php
            
            class yf_payment_api__currency
            {
                public $base = 'UAH';
            Severity: Major
            Found in plugins/payment/classes/yf_payment_api__currency.class.php - About 1 day to fix

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

              <?php
              
              /**
               * Locale, i18n (Internationalization) editor.
               *
              Severity: Major
              Found in plugins/locale/admin_modules/yf_locale_editor.class.php - About 1 day to fix

                yf_main has 92 functions (exceeds 20 allowed). Consider refactoring.
                Open

                class yf_main
                {
                    /**
                     * @var string Type of initialization @conf_skip
                     *    - user  (for user section)
                Severity: Major
                Found in classes/yf_main.class.php - About 1 day to fix

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

                  <?php
                  
                  /**
                   * Stadard Framework template engine.
                   *
                  Severity: Major
                  Found in plugins/tpl/classes/yf_tpl.class.php - About 1 day to fix

                    Function product_edit has a Cognitive Complexity of 86 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function product_edit()
                        {
                            $id = (int) $_GET['id'];
                            $_GET['id'] = $id;
                            if (empty($id)) {

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

                        public function load_class_file($class_name = '', $custom_path = '', $force_storage = '')
                        {
                            if (empty($class_name) || $class_name == 'main') {
                                return false;
                            }
                    Severity: Minor
                    Found in classes/yf_main.class.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

                    Function _get_modules_from_files has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function _get_modules_from_files($include_framework = true, $with_sub_modules = false)
                        {
                            $admin_modules_array = [];
                    
                            $pattern_include = '-f ~/' . preg_quote(ADMIN_MODULES_DIR, '~') . '.*' . preg_quote(YF_CLS_EXT, '~') . '$~';
                    Severity: Minor
                    Found in plugins/sys/classes/core_api/yf_core_api_admin_modules.class.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

                    File class_db_real_mysql_test.Test.php has 731 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    require_once __DIR__ . '/db_real_abstract.php';
                    
                    /**
                    Severity: Major
                    Found in .dev/tests/functional/db/class_db_real_mysql_test.Test.php - About 1 day to fix

                      yf_db_query_builder_driver has 89 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      abstract class yf_db_query_builder_driver
                      {
                          const REGEX_INLINE_CONDS = '~^([a-z0-9\(\)*_\.]+)[\s]*(=|!=|<>|<|>|>=|<=)[\s]*([a-z0-9_\.]+)$~ims';
                          const REGEX_IS_NULL = '~^([a-z0-9\(\)*_\.]+)[\s]*(is[\s]+null|is[\s]+not[\s]+null)$~ims';
                          const REGEX_AS = '~^([a-z0-9\(\)*_\.]+)[\s]+AS[\s]+([a-z0-9_]+)$~ims';
                      Severity: Major
                      Found in plugins/db/classes/db/yf_db_query_builder_driver.class.php - About 1 day to fix

                        class_db_real_utils_mysql_test has 89 functions (exceeds 20 allowed). Consider refactoring.
                        Open

                        class class_db_real_utils_mysql_test extends db_real_abstract
                        {
                            public static function _need_skip_test($name)
                            {
                                if (main()->is_hhvm()) {
                        Severity: Major
                        Found in .dev/tests/functional/db/class_db_real_utils_mysql_test.Test.php - About 1 day to fix

                          yf_validate has 89 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class yf_validate
                          {
                              /** @var int Minimal nick length */
                              public $MIN_NICK_LENGTH = 2;
                              /** @var array Allowed nick symbols (display for user) */
                          Severity: Major
                          Found in classes/yf_validate.class.php - About 1 day to fix

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

                            <?php
                            
                            /**
                             * System-wide menus editor.
                             *
                            Severity: Major
                            Found in plugins/sys/admin_modules/yf_menus_editor.class.php - About 1 day to fix

                              Function change_location has a Cognitive Complexity of 82 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  public function change_location()
                                  {
                                      if ( ! main()->USE_GEO_IP) {
                                          return false;
                                      }
                              Severity: Minor
                              Found in plugins/geo/modules/yf_geo_content.class.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

                              Severity
                              Category
                              Status
                              Source
                              Language