Showing 4,217 of 4,217 total issues

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

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

          public function test_is_natural()
          {
              $this->assertFalse(_class('validate')->is_natural(''));
              $this->assertFalse(_class('validate')->is_natural(null));
              $this->assertFalse(_class('validate')->is_natural(false));
      Severity: Major
      Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_validate_test.Test.php on lines 568..589

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

      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

          public function test_is_natural_no_zero()
          {
              $this->assertFalse(_class('validate')->is_natural_no_zero(''));
              $this->assertFalse(_class('validate')->is_natural_no_zero(null));
              $this->assertFalse(_class('validate')->is_natural_no_zero(false));
      Severity: Major
      Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_validate_test.Test.php on lines 546..567

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

      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 4 locations. Consider refactoring.
      Open

          public function test_min()
          {
              if ($this->_need_skip_test(__FUNCTION__)) {
                  return;
              }
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1161..1195
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1231..1265
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1266..1300

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

      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 4 locations. Consider refactoring.
      Open

          public function test_avg()
          {
              if ($this->_need_skip_test(__FUNCTION__)) {
                  return;
              }
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1196..1230
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1231..1265
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1266..1300

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

      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 4 locations. Consider refactoring.
      Open

          public function test_sum()
          {
              if ($this->_need_skip_test(__FUNCTION__)) {
                  return;
              }
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1161..1195
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1196..1230
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1231..1265

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

      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 4 locations. Consider refactoring.
      Open

          public function test_max()
          {
              if ($this->_need_skip_test(__FUNCTION__)) {
                  return;
              }
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1161..1195
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1196..1230
      .dev/tests/unit/db/class_db_offline_query_builder_test.Test.php on lines 1266..1300

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

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

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

          public function test_alpha_numeric_spaces()
          {
              $this->assertFalse(_class('validate')->alpha_numeric_spaces(''));
              $this->assertFalse(_class('validate')->alpha_numeric_spaces(null));
              $this->assertFalse(_class('validate')->alpha_numeric_spaces(false));
      Severity: Major
      Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_validate_test.Test.php on lines 360..381

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

      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

          public function test_unicode_alpha()
          {
              $this->assertFalse(_class('validate')->unicode_alpha(''));
              $this->assertFalse(_class('validate')->unicode_alpha(null));
              $this->assertFalse(_class('validate')->unicode_alpha(false));
      Severity: Major
      Found in .dev/tests/unit/class_validate_test.Test.php and 1 other location - About 1 day to fix
      .dev/tests/unit/class_validate_test.Test.php on lines 320..341

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

      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 _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

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

                <?php
                
                return [
                    'form_validate_active_url' => 'The %field field must contain a valid working URL.',
                    'form_validate_after_date' => 'The %field field must contain date after %param.',
                Severity: Major
                Found in langs/ru/form_validate_ru.php and 1 other location - About 1 day to fix
                langs/en/form_validate_en.php on lines 1..74

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

                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

                <?php
                
                return [
                    'form_validate_active_url' => 'The %field field must contain a valid working URL.',
                    'form_validate_after_date' => 'The %field field must contain date after %param.',
                Severity: Major
                Found in langs/en/form_validate_en.php and 1 other location - About 1 day to fix
                langs/ru/form_validate_ru.php on lines 1..74

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

                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