civictechro/website-alba-iulia-smart-city

View on GitHub

Showing 73 of 73 total issues

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

        array(
                'key' => 'field_5a9a5ec18d138',
                'label' => 'Furnizori',
                'name' => 'furnizori',
                'type' => 'relationship',
Severity: Major
Found in site/web/app/mu-plugins/SmartCityThemeSetup.php and 2 other locations - About 1 hr to fix
site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 878..903
site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 930..955

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

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

  finalize() {
    // JavaScript to be fired on all pages, after page specific JS is fired
    let visitedColors = [];
    $('.project-box .body').each((idx, elem) => {
      let parent = $(elem).parent();

    Method sections has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      public static function sections(): array {
        $sections = get_posts(array(
          'post_type' => \AppConstants::POST_TYPE_DESPRE,
          'posts_per_page' => 20,
        ));
    Severity: Minor
    Found in site/web/app/themes/smart-city/app/controllers/Despre.php - About 1 hr to fix

      Method proiecte has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        public static function proiecte(): array {
          $projects = get_posts(array(
            'post_type' => \AppConstants::POST_TYPE_PROJECT,
            'posts_per_page' => 4,
            'orderby' => 'rand',
      Severity: Minor
      Found in site/web/app/themes/smart-city/app/controllers/front-page.php - About 1 hr to fix

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

        <?php
        
        namespace App\Meta;
        
        final class OpenGraphMetaCategory {
        site/web/app/themes/smart-city/app/meta/constants/MetaMetaCategory.php on lines 1..27

        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

        <?php
        
        namespace App\Meta;
        
        final class MetaMetaCategory {
        site/web/app/themes/smart-city/app/meta/constants/OpenGraphMetaCategory.php on lines 1..30

        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

            def v2_runner_item_on_skipped(self, result):
                output.display_item(self, result)
                output.replace_item_with_key(self, result)
                super(CallbackModule, self).v2_runner_item_on_skipped(result)
        Severity: Major
        Found in trellis/lib/trellis/plugins/callback/output.py and 1 other location - About 1 hr to fix
        trellis/lib/trellis/plugins/callback/output.py on lines 65..68

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

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

            final public function getAll(): array {
              $all_tags = array();
        
              $custom_tags = $this->copyAllCommonTags($this->getCustomTags());
              $default_tags = $this->getDefaultTags();
        Severity: Minor
        Found in site/web/app/themes/smart-city/app/meta/MetaGenerator.php - About 1 hr 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

            def v2_runner_item_on_ok(self, result):
                output.display_item(self, result)
                output.replace_item_with_key(self, result)
                super(CallbackModule, self).v2_runner_item_on_ok(result)
        Severity: Major
        Found in trellis/lib/trellis/plugins/callback/output.py and 1 other location - About 1 hr to fix
        trellis/lib/trellis/plugins/callback/output.py on lines 76..79

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

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

          private function getContentArray(): array {
            if ($this->data) {
              return $this->data;
            }
        
        

          Method getContentArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            private function getContentArray(): array {
              if ($this->data) {
                return $this->data;
              }
          
          

            Method stiri has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              public static function stiri(): array {
                $articles = wp_get_recent_posts(array(
                  'numberposts' => 3,
                  'post_type' => 'stire',
                  'post_status' => 'publish',
            Severity: Minor
            Found in site/web/app/themes/smart-city/app/controllers/front-page.php - About 1 hr to fix

              Method filter_templates has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function filter_templates($templates)
              {
                  $paths = apply_filters('sage/filter_templates/paths', [
                      'views',
                      'resources/views'
              Severity: Minor
              Found in site/web/app/themes/smart-city/app/helpers.php - About 1 hr to fix

                Method etape has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  public static function etape(): array {
                    $statuses = get_posts(array(
                      'post_type' => \AppConstants::POST_TYPE_PROJECT_STATUS,
                      'posts_per_page' => 10,
                    ));
                Severity: Minor
                Found in site/web/app/themes/smart-city/app/controllers/Proiect.php - About 1 hr to fix

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

                      bundled_cert_path = os.path.join('{{ letsencrypt_certs_dir }}', site + '-' + letsencrypt_cert_ids[site] + '-bundled.cert')
                  Severity: Major
                  Found in trellis/roles/letsencrypt/templates/renew-certs.py and 1 other location - About 1 hr to fix
                  trellis/roles/letsencrypt/templates/renew-certs.py on lines 13..13

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

                  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

                      cert_path = os.path.join('{{ letsencrypt_certs_dir }}', site + '-' + letsencrypt_cert_ids[site] + '.cert')
                  Severity: Major
                  Found in trellis/roles/letsencrypt/templates/renew-certs.py and 1 other location - About 1 hr to fix
                  trellis/roles/letsencrypt/templates/renew-certs.py on lines 14..14

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

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

                  def system(vagrant_version=None):
                      # Get most recent Trellis CHANGELOG entry
                      changelog_msg = ''
                      ansible_path = os.getenv('ANSIBLE_CONFIG', os.getcwd())
                      changelog = os.path.join(ansible_path, 'CHANGELOG.md')
                  Severity: Minor
                  Found in trellis/lib/trellis/utils/output.py - About 45 mins 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 4 locations. Consider refactoring.
                  Open

                          array(
                                  'key' => 'field_5a9d6883de9fb',
                                  'label' => 'Valoare statistica 1',
                                  'name' => 'valoare_statistica_1',
                                  'type' => 'number',
                  Severity: Major
                  Found in site/web/app/mu-plugins/SmartCityThemeSetup.php and 3 other locations - About 45 mins to fix
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 474..494
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 495..515
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 1110..1130

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

                  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

                              array(
                                  'key' => 'field_5a9d11113de9fb',
                                  'label' => 'Număr de pagini',
                                  'name' => 'page_count',
                                  'type' => 'number',
                  Severity: Major
                  Found in site/web/app/mu-plugins/SmartCityThemeSetup.php and 3 other locations - About 45 mins to fix
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 495..515
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 1070..1090
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 1110..1130

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

                  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

                              array(
                                  'key' => 'field_5a9d222223de9fb',
                                  'label' => 'Mărime document (în Mb)',
                                  'name' => 'document_weight',
                                  'type' => 'number',
                  Severity: Major
                  Found in site/web/app/mu-plugins/SmartCityThemeSetup.php and 3 other locations - About 45 mins to fix
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 474..494
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 1070..1090
                  site/web/app/mu-plugins/SmartCityThemeSetup.php on lines 1110..1130

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

                  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