ikuseiGmbH/Goldencobra

View on GitHub

Showing 81 of 5,976 total issues

File article.rb has 653 lines of code (exceeds 250 allowed). Consider refactoring.
Open

include Goldencobra::ApplicationHelper
require "open-uri"

module Goldencobra
  class Article < ActiveRecord::Base
Severity: Major
Found in app/models/goldencobra/article.rb - About 1 day to fix

    Class Article has 66 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Article < ActiveRecord::Base
        include Goldencobra::ArticleConcerns::MetaTag
    
        # extend FriendlyId
        LiquidParser = {}
    Severity: Major
    Found in app/models/goldencobra/article.rb - About 1 day to fix

      Method show_subtree_of_item has a Cognitive Complexity of 35 (exceeds 5 allowed). Consider refactoring.
      Open

            def show_subtree_of_item(item)
              li do
                div class: "tree_item" do
                  div class: "tree_item_title" do
                    if @title.present?
      Severity: Minor
      Found in app/models/active_admin/views/index_as_tree.rb - About 5 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

      Method index_articles has a Cognitive Complexity of 34 (exceeds 5 allowed). Consider refactoring.
      Open

          def index_articles(current_operator=nil, user_frontend_tags=nil)
            return Goldencobra::Article.none unless display_index_articles
      
            if self.article_for_index_id.blank?
              # Index aller Artikel anzeigen
      Severity: Minor
      Found in app/models/goldencobra/article.rb - About 5 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

      Method navigation_menu_helper has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring.
      Open

          def navigation_menu_helper(child, options, subtree_menues, current_depth)
            if @current_client && @current_client.url_prefix.present?
              child_target_link = @current_client.url_prefix + child.target.gsub("\"",'')
            else
              child_target_link = child.target.gsub("\"",'')
      Severity: Minor
      Found in app/helpers/goldencobra/navigation_helper.rb - About 4 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

      File articles.rb has 339 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      ActiveAdmin.register Goldencobra::Article, as: "Article" do
        menu parent: I18n.t("active_admin.articles.parent"), label: I18n.t("active_admin.articles.as"), if: proc{can?(:update, Goldencobra::Article)}, priority: 2
      
        # Alle Filteroptionen in der rechten Seitenleiste
        filter :parent_ids_in, as: :select, collection: -> { Goldencobra::Article.all.map { |a| [a.parent_path, a.id] }.sort }, label: I18n.t("filter_parent", scope: [:goldencobra, :filter], default: I18n.t("active_admin.articles.filter.default1"))
      Severity: Minor
      Found in admin/articles.rb - About 4 hrs to fix

        Class ArticletypePresenter has 32 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class ArticletypePresenter
            def initialize(f, articletype)
              @f = f
              @articletype = articletype
            end
        Severity: Minor
        Found in app/presenters/goldencobra/articletype_presenter.rb - About 4 hrs to fix

          Method navigation_menu has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
          Open

              def navigation_menu(menue_id, options={})
                return "id can't be blank" if menue_id.blank?
                depth = options[:depth] || 9999
                offset = options[:offset] || 0
                class_name = options[:class] || ""
          Severity: Minor
          Found in app/helpers/goldencobra/navigation_helper.rb - About 3 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

          Class ArticlesController has 28 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class ArticlesController < Goldencobra::ApplicationController
          
              layout "application"
              before_filter :get_redirectors, only: [:show]
              before_filter :get_article, only: [:show, :convert_to_pdf]
          Severity: Minor
          Found in app/controllers/goldencobra/articles_controller.rb - About 3 hrs to fix

            Method render_article_widgets has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                def render_article_widgets(options={})
                  custom_css = options[:class] || ""
                  tags = options[:tagged_with] || ""
            
                  #include default widgets?
            Severity: Minor
            Found in app/helpers/goldencobra/articles_helper.rb - About 3 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

            File articles_controller.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            module Goldencobra
              class ArticlesController < Goldencobra::ApplicationController
            
                layout "application"
                before_filter :get_redirectors, only: [:show]
            Severity: Minor
            Found in app/controllers/goldencobra/articles_controller.rb - About 2 hrs to fix

              Method index_articles has 66 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def index_articles(current_operator=nil, user_frontend_tags=nil)
                    return Goldencobra::Article.none unless display_index_articles
              
                    if self.article_for_index_id.blank?
                      # Index aller Artikel anzeigen
              Severity: Major
              Found in app/models/goldencobra/article.rb - About 2 hrs to fix

                Method initialize has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                Open

                  def initialize(operator=nil,current_domain=nil)
                    can :read, Goldencobra::Article
                    can :read, Goldencobra::Menue
                    can :read, Goldencobra::Widget
                
                
                Severity: Minor
                Found in app/models/ability.rb - About 2 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

                Method navigation_menu has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def navigation_menu(menue_id, options={})
                      return "id can't be blank" if menue_id.blank?
                      depth = options[:depth] || 9999
                      offset = options[:offset] || 0
                      class_name = options[:class] || ""
                Severity: Major
                Found in app/helpers/goldencobra/navigation_helper.rb - About 2 hrs to fix

                  Function render has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render: function () {
                      var depth;
                      if (this.props.depth !== undefined) {
                        depth = parseInt(this.props.depth);
                      } else {
                  Severity: Major
                  Found in app/assets/javascripts/goldencobra/components/navigation_menu.js - About 2 hrs to fix

                    Method geocode_ip_address has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def geocode_ip_address
                          if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
                            if Goldencobra::Setting.for_key("goldencobra.geocode_ip_address") == "true"
                              if session[:user_location].blank?
                                #Geokit::Geocoders::MultiGeocoder.geocode("194.39.218.11") schlägt fehl (Completed 500 Internal Server Error) daher...
                    Severity: Minor
                    Found in app/controllers/goldencobra/articles_controller.rb - About 2 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

                    Method show_cache_path has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def show_cache_path
                          current_client_id = @current_client.try(:id).to_s
                          geo_cache = Goldencobra::Setting.for_key("goldencobra.geocode_ip_address") == "true" && session[:user_location].present? && session[:user_location].city.present? ? session[:user_location].city.parameterize.underscore : "no_geo"
                          date_cache = Goldencobra::Setting.for_key("goldencobra.article.max_cache_24h") == "true" ? Date.today.strftime("%Y%m%d") : "no_date"
                          art_cache = @article ? @article.cache_key : "no_art"
                    Severity: Minor
                    Found in app/controllers/goldencobra/articles_controller.rb - About 2 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

                    Method simple_search has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def self.simple_search(q)
                          active.search(title_or_subtitle_or_url_name_or_content_or_summary_or_teaser_contains: q).relation.map do |article|
                            {
                              id: article.id,
                              absolute_public_url: article.absolute_public_url,
                    Severity: Minor
                    Found in app/models/goldencobra/article.rb - About 2 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

                    Method show has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def show
                          ActiveSupport::Notifications.instrument("goldencobra.article.show", params: params)
                          before_init # possible callbacks on start
                          params[:session] = session.clone
                          params[:session].delete(:user_location)
                    Severity: Minor
                    Found in app/controllers/goldencobra/articles_controller.rb - About 1 hr to fix

                      Method show_subtree_of_item has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                            def show_subtree_of_item(item)
                              li do
                                div class: "tree_item" do
                                  div class: "tree_item_title" do
                                    if @title.present?
                      Severity: Minor
                      Found in app/models/active_admin/views/index_as_tree.rb - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language