civictechro/website-alba-iulia-smart-city

View on GitHub

Showing 39 of 73 total issues

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

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

            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

            Function raw_triage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def raw_triage(self, key_string, item, patterns):
                    # process dict values
                    if isinstance(item, AnsibleMapping):
                        return AnsibleMapping(dict((key,self.raw_triage('.'.join([key_string, key]), value, patterns)) for key,value in item.iteritems()))
            
            
            Severity: Minor
            Found in trellis/lib/trellis/plugins/callback/vars.py - About 35 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

            Method which has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

            def which(cmd)
              exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
            
              paths = ENV['PATH'].split(File::PATH_SEPARATOR).flat_map do |path|
                exts.map { |ext| File.join(path, "#{cmd}#{ext}") }
            Severity: Minor
            Found in trellis/lib/trellis/vagrant.rb - About 35 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

            Function raw_vars has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def raw_vars(self, play, host, hostvars):
                    if 'raw_vars' not in hostvars:
                        return
            
                    raw_vars = Templar(variables=hostvars, loader=play._loader).template(hostvars['raw_vars'])
            Severity: Minor
            Found in trellis/lib/trellis/plugins/callback/vars.py - About 35 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

            Avoid too many return statements within this method.
            Open

                      return new AboutMetaGenerator($post);
            Severity: Major
            Found in site/web/app/themes/smart-city/app/meta/MetaGenerator.php - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                    return __('Not Found', 'sage');
              Severity: Major
              Found in site/web/app/themes/smart-city/app/controllers/app.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                    return get_the_title();
                Severity: Major
                Found in site/web/app/themes/smart-city/app/controllers/app.php - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                        return new GenericMetaGenerator($post);
                  Severity: Major
                  Found in site/web/app/themes/smart-city/app/meta/MetaGenerator.php - About 30 mins to fix

                    Function projectData has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public static function projectData(\WP_Post $project): array {
                        $verticala = get_field('verticala', $project->ID);
                        if ($verticala) {
                          $verticala = $verticala[0];
                        } else {
                    Severity: Minor
                    Found in site/web/app/themes/smart-city/app/controllers/Solutii.php - About 25 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

                    Function title has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                      public static function title() {
                        if (is_home()) {
                          if ($home = get_option('page_for_posts', true)) {
                            return get_the_title($home);
                          }
                    Severity: Minor
                    Found in site/web/app/themes/smart-city/app/controllers/app.php - About 25 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

                    Function sections has a Cognitive Complexity of 6 (exceeds 5 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 25 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

                    Function getAllTagPairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getAllTagPairs(): /* array<Pair>*/ array {
                          $flat_list = array();
                          foreach(MetaMetaCategory::getList() as $category) {
                            $pairs = $this->getTagPairs($category);
                            if (!$pairs) {
                    Severity: Minor
                    Found in site/web/app/themes/smart-city/app/meta/decorators/MetaMetaDecorator.php - About 25 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

                    Function getAllTagPairs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function getAllTagPairs(): /* array<Pair>*/ array {
                          $flat_list = array();
                          foreach(OpenGraphMetaCategory::getList() as $category) {
                            $pairs = $this->getTagPairs($category);
                            if (!$pairs) {

                    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