Showing 4,217 of 4,217 total issues

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

    public function edit()
    {
        $a = db()->query_fetch('SELECT * FROM ' . db('cities') . ' WHERE id=' . (int) ($_GET['id']));
        if ( ! $a['id']) {
            return _e('No id!');
Severity: Major
Found in plugins/geo/admin_modules/yf_manage_cities.class.php and 1 other location - About 7 hrs to fix
plugins/geo/admin_modules/yf_manage_regions.class.php on lines 34..56

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

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 edit()
    {
        $a = db()->query_fetch('SELECT * FROM ' . db('regions') . ' WHERE id=' . (int) ($_GET['id']));
        if ( ! $a['id']) {
            return _e('No id!');
Severity: Major
Found in plugins/geo/admin_modules/yf_manage_regions.class.php and 1 other location - About 7 hrs to fix
plugins/geo/admin_modules/yf_manage_cities.class.php on lines 30..52

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

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

yf_model has 53 functions (exceeds 20 allowed). Consider refactoring.
Open

class yf_model
{
    const CREATED_AT = 'created_at';
    const UPDATED_AT = 'updated_at';

Severity: Major
Found in plugins/sys/classes/yf_model.class.php - About 7 hrs to fix

    yf_utils has 53 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class yf_utils
    {
        /**
         * Catch missing method call.
         * @param mixed $name
    Severity: Major
    Found in classes/yf_utils.class.php - About 7 hrs to fix

      sample_html has 53 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class sample_html
      {
          /***/
          public function _init()
          {
      Severity: Major
      Found in .dev/samples/classes/sample_html.class.php - About 7 hrs to fix

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

            public $method_allow = [
                'order' => [
                    'payin' => [
                        'bitpay',
                    ],
        plugins/payment/classes/yf_payment_api__provider_bitcoin.class.php on lines 25..104

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

        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 $method_allow = [
                'order' => [
                    'payin' => [
                        'blockchain',
                    ],
        plugins/payment/classes/yf_payment_api__provider_bitpay.class.php on lines 36..100

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

        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

        Method load_class_file has 186 lines of code (exceeds 25 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: Major
        Found in classes/yf_main.class.php - About 7 hrs to fix

          Function split_sql has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              public function split_sql($sql)
              {
                  $out = [];
                  // do not trim
                  $sql = rtrim($sql, "\n\r");
          Severity: Minor
          Found in plugins/db/classes/db/yf_db_utils_driver.class.php - About 7 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

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

                  foreach ((array) $files as $from => $to) {
                      if (is_numeric($from)) {
                          $from = $to;
                      }
                      $to_path = rtrim($target_dir, '/') . '/' . ltrim($to, '/');
          Severity: Major
          Found in plugins/assets/classes/yf_assets.class.php and 1 other location - About 7 hrs to fix
          plugins/assets/classes/yf_assets.class.php on lines 775..790

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

          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

                  foreach ((array) $files as $from => $to) {
                      if (is_numeric($from)) {
                          $from = $to;
                      }
                      $to_path = rtrim($target_dir, '/') . '/' . ltrim($to, '/');
          Severity: Major
          Found in plugins/assets/classes/yf_assets.class.php and 1 other location - About 7 hrs to fix
          plugins/assets/classes/yf_assets.class.php on lines 732..747

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

          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

          yf_debug has 52 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class yf_debug
          {
              public $SHOW_DB_QUERY_LOG = true;
              public $SHOW_DB_STATS = false;
              public $SHOW_DB_EXPLAIN_QUERY = true;
          Severity: Major
          Found in classes/yf_debug.class.php - About 7 hrs to fix

            File city.data.php has 471 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            return [
                0 => [
                    'city_id' => '14',
            Severity: Minor
            Found in .dev/tests/functional/model/fixtures/city.data.php - About 7 hrs to fix

              Method _url has 182 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function _url($params = [], $host = '', $url_str = '', $for_section = null)
                  {
                      if (DEBUG_MODE && ! $this->FORCE_NO_DEBUG) {
                          $time_start = microtime(true);
                      }
              Severity: Major
              Found in plugins/rewrite/classes/yf_rewrite.class.php - About 7 hrs to fix

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

                    public function test_obj2arr()
                    {
                        $a = [
                            'key1' => 'val1',
                            'key2' => 'val2',
                Severity: Major
                Found in .dev/tests/unit/functions/function_obj2arr_test.Test.php and 1 other location - About 7 hrs to fix
                .dev/tests/unit/functions/function_obj2arr_test.Test.php on lines 25..42

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

                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_object_to_array()
                    {
                        $a = [
                            'key1' => 'val1',
                            'key2' => 'val2',
                Severity: Major
                Found in .dev/tests/unit/functions/function_obj2arr_test.Test.php and 1 other location - About 7 hrs to fix
                .dev/tests/unit/functions/function_obj2arr_test.Test.php on lines 7..24

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

                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

                function get_themes_twbs4()
                {
                    global $themes_twbs4_file, $twbs_v4;
                    $gh_api_url = 'https://api.github.com/repos/thomaspark/bootswatch/contents/dist?ref=v' . $twbs_v4;
                    $themes = [];
                Severity: Major
                Found in .dev/scripts/assets/assets_cache_sync.php and 1 other location - About 7 hrs to fix
                .dev/scripts/assets/assets_cache_sync.php on lines 199..221

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

                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 ($is_cloneable_item) {
                                if ($auto_type == 'php_item') {
                                    if (strlen($info['code'])) {
                                        $content = eval('<?' . 'php ' . $info['code']);
                                    } elseif ($info['method_name']) {
                Severity: Major
                Found in plugins/common/classes/common/yf_dashboards.class.php and 1 other location - About 7 hrs to fix
                plugins/dashboards/admin_modules/yf_manage_dashboards.class.php on lines 297..315

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

                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 ($is_cloneable_item) {
                                if ($auto_type == 'php_item') {
                                    if (strlen($info['code'])) {
                                        $content = eval('<?' . 'php ' . $info['code']);
                                    } elseif ($info['method_name']) {
                plugins/common/classes/common/yf_dashboards.class.php on lines 166..184

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

                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

                function get_themes_twbs5()
                {
                    global $themes_twbs5_file, $twbs_v5;
                    $gh_api_url = 'https://api.github.com/repos/thomaspark/bootswatch/contents/dist?ref=v' . $twbs_v5;
                    $themes = [];
                Severity: Major
                Found in .dev/scripts/assets/assets_cache_sync.php and 1 other location - About 7 hrs to fix
                .dev/scripts/assets/assets_cache_sync.php on lines 165..187

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

                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