ikuseiGmbH/Goldencobra

View on GitHub
app/models/goldencobra/article.rb

Summary

Maintainability
F
5 days
Test Coverage

Class has too many lines. [647/100]
Open

  class Article < ActiveRecord::Base
    include Goldencobra::ArticleConcerns::MetaTag

    # extend FriendlyId
    LiquidParser = {}
Severity: Minor
Found in app/models/goldencobra/article.rb by rubocop

This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Complex method Goldencobra::Article#index_articles (193.5)
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 by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Assignment Branch Condition size for index_articles is too high. [107.4/15]
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 by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

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 has too many lines. [66/10]
      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 by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Complex method Goldencobra::Article::init_image_methods (81.8)
      Open

          def self.init_image_methods
            if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
              Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                define_method "image_#{image_type.underscore}" do
                  image(image_type, "original")
      Severity: Minor
      Found in app/models/goldencobra/article.rb by flog

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      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

      Assignment Branch Condition size for init_image_methods is too high. [35.52/15]
      Open

          def self.init_image_methods
            if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
              Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                define_method "image_#{image_type.underscore}" do
                  image(image_type, "original")
      Severity: Minor
      Found in app/models/goldencobra/article.rb by rubocop

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Perceived complexity for index_articles is too high. [23/7]
      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 by rubocop

      This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

      Example:

      def my_method                   # 1
        if cond                       # 1
          case var                    # 2 (0.8 + 4 * 0.2, rounded)
          when 1 then func_one
          when 2 then func_two
          when 3 then func_three
          when 4..10 then func_other
          end
        else                          # 1
          do_something until a && b   # 2
        end                           # ===
      end                             # 7 complexity points

      Cyclomatic complexity for index_articles is too high. [20/6]
      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 by rubocop

      This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

      An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

      Assignment Branch Condition size for set_redirection_step_2 is too high. [28.11/15]
      Open

          def set_redirection_step_2
            if self.create_redirection.present? && self.create_redirection.to_i > 0
              #Suche Redirector nur mit source und vervollständige ihn
              Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
              r = Goldencobra::Redirector.find_by_id(self.create_redirection)
      Severity: Minor
      Found in app/models/goldencobra/article.rb by rubocop

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Assignment Branch Condition size for set_redirection_step_1 is too high. [28.76/15]
      Open

          def set_redirection_step_1
            #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
            modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
            if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
              #Erstelle Redirector nur mit source
      Severity: Minor
      Found in app/models/goldencobra/article.rb by rubocop

      This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

      Method has too many lines. [21/10]
      Open

          def set_redirection_step_2
            if self.create_redirection.present? && self.create_redirection.to_i > 0
              #Suche Redirector nur mit source und vervollständige ihn
              Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
              r = Goldencobra::Redirector.find_by_id(self.create_redirection)
      Severity: Minor
      Found in app/models/goldencobra/article.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Method has too many lines. [19/10]
      Open

          def self.init_image_methods
            if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
              Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                define_method "image_#{image_type.underscore}" do
                  image(image_type, "original")
      Severity: Minor
      Found in app/models/goldencobra/article.rb by rubocop

      This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      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

        Assignment Branch Condition size for verify_existence_of_opengraph_image is too high. [23.73/15]
        Open

            def verify_existence_of_opengraph_image
              if self.metatag_open_graph_image.blank?
                if self.article_images.any? && self.article_images.first.present? &&
                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [17/10]
        Open

            def self.articletype_for_index(current_article)
              # Wenn alle Artikeltypen angezeigt werden sollen
              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Complex method Goldencobra::Article#set_redirection_step_2 (45.3)
        Open

            def set_redirection_step_2
              if self.create_redirection.present? && self.create_redirection.to_i > 0
                #Suche Redirector nur mit source und vervollständige ihn
                Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Assignment Branch Condition size for article_types_for_select is too high. [21/15]
        Open

            def self.article_types_for_select
              results = []
              path_to_articletypes = File.join(::Rails.root, "app", "views", "articletypes")
              if Dir.exist?(path_to_articletypes)
                Dir.foreach(path_to_articletypes) do |name|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [15/10]
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Assignment Branch Condition size for articletype_for_index is too high. [20.62/15]
        Open

            def self.articletype_for_index(current_article)
              # Wenn alle Artikeltypen angezeigt werden sollen
              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [15/10]
        Open

            def set_redirection_step_1
              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Perceived complexity for public_url is too high. [12/7]
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

        Example:

        def my_method                   # 1
          if cond                       # 1
            case var                    # 2 (0.8 + 4 * 0.2, rounded)
            when 1 then func_one
            when 2 then func_two
            when 3 then func_three
            when 4..10 then func_other
            end
          else                          # 1
            do_something until a && b   # 2
          end                           # ===
        end                             # 7 complexity points

        Assignment Branch Condition size for date_of_last_modified_child is too high. [20.1/15]
        Open

            def date_of_last_modified_child
              if self.children.length > 0
                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for render_html is too high. [20.02/15]
        Open

            def render_html(layoutfile="application", localparams={})
              av = ActionView::Base.new(ActionController::Base.view_paths + ["#{::Goldencobra::Engine.root}/app/views/goldencobra/articles/"])
              av.request = ActionDispatch::Request.new(Rack::MockRequest.env_for(self.public_url))
              av.request["format"] = "text/html"
              av.controller = Goldencobra::ArticlesController.new
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [14/10]
        Open

            def self.article_types_for_select
              results = []
              path_to_articletypes = File.join(::Rails.root, "app", "views", "articletypes")
              if Dir.exist?(path_to_articletypes)
                Dir.foreach(path_to_articletypes) do |name|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Complex method Goldencobra::Article#set_redirection_step_1 (41.0)
        Open

            def set_redirection_step_1
              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        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

        Complex method Goldencobra::Article#verify_existence_of_opengraph_image (40.6)
        Open

            def verify_existence_of_opengraph_image
              if self.metatag_open_graph_image.blank?
                if self.article_images.any? && self.article_images.first.present? &&
                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Cyclomatic complexity for public_url is too high. [9/6]
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        Assignment Branch Condition size for published_at is too high. [18.71/15]
        Open

            def published_at
              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
                if related_object && related_object.respond_to?(:published_at)
                  related_object.published_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for method_missing is too high. [18.11/15]
        Open

            def method_missing(meth, *args, &block)
              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Assignment Branch Condition size for uniqify_url_name is too high. [18.28/15]
        Open

            def uniqify_url_name
              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
              if similar_names.count > 1
                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
                self.url_name = [self.url_name, last_used_number + 1].join("--")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method article_types_for_select has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.article_types_for_select
              results = []
              path_to_articletypes = File.join(::Rails.root, "app", "views", "articletypes")
              if Dir.exist?(path_to_articletypes)
                Dir.foreach(path_to_articletypes) do |name|
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Cyclomatic complexity for set_redirection_step_1 is too high. [8/6]
        Open

            def set_redirection_step_1
              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        Assignment Branch Condition size for simple_search is too high. [17.72/15]
        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 by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Perceived complexity for set_redirection_step_1 is too high. [9/7]
        Open

            def set_redirection_step_1
              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

        Example:

        def my_method                   # 1
          if cond                       # 1
            case var                    # 2 (0.8 + 4 * 0.2, rounded)
            when 1 then func_one
            when 2 then func_two
            when 3 then func_three
            when 4..10 then func_other
            end
          else                          # 1
            do_something until a && b   # 2
          end                           # ===
        end                             # 7 complexity points

        Method has too many lines. [12/10]
        Open

            def filter_with_permissions(list, current_operator)
              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
                return list
              else
                a = Ability.new(current_operator)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Perceived complexity for articletype_for_index is too high. [9/7]
        Open

            def self.articletype_for_index(current_article)
              # Wenn alle Artikeltypen angezeigt werden sollen
              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

        Example:

        def my_method                   # 1
          if cond                       # 1
            case var                    # 2 (0.8 + 4 * 0.2, rounded)
            when 1 then func_one
            when 2 then func_two
            when 3 then func_three
            when 4..10 then func_other
            end
          else                          # 1
            do_something until a && b   # 2
          end                           # ===
        end                             # 7 complexity points

        Assignment Branch Condition size for public_url is too high. [17.12/15]
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Method has too many lines. [12/10]
        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 by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Method has too many lines. [11/10]
        Open

            def render_html(layoutfile="application", localparams={})
              av = ActionView::Base.new(ActionController::Base.view_paths + ["#{::Goldencobra::Engine.root}/app/views/goldencobra/articles/"])
              av.request = ActionDispatch::Request.new(Rack::MockRequest.env_for(self.public_url))
              av.request["format"] = "text/html"
              av.controller = Goldencobra::ArticlesController.new
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

        Cyclomatic complexity for init_image_methods is too high. [7/6]
        Open

            def self.init_image_methods
              if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
                Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                  define_method "image_#{image_type.underscore}" do
                    image(image_type, "original")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

        An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

        Perceived complexity for published_at is too high. [8/7]
        Open

            def published_at
              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
                if related_object && related_object.respond_to?(:published_at)
                  related_object.published_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

        Example:

        def my_method                   # 1
          if cond                       # 1
            case var                    # 2 (0.8 + 4 * 0.2, rounded)
            when 1 then func_one
            when 2 then func_two
            when 3 then func_three
            when 4..10 then func_other
            end
          else                          # 1
            do_something until a && b   # 2
          end                           # ===
        end                             # 7 complexity points

        Assignment Branch Condition size for set_descendants_status is too high. [15.81/15]
        Open

            def set_descendants_status
              if !self.new_record? && self.active_changed? && self.descendants.any?
                # Save without callbacks
                if Rails::VERSION::MAJOR == 3
                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

        Complex method Goldencobra::Article::article_types_for_select (34.5)
        Open

            def self.article_types_for_select
              results = []
              path_to_articletypes = File.join(::Rails.root, "app", "views", "articletypes")
              if Dir.exist?(path_to_articletypes)
                Dir.foreach(path_to_articletypes) do |name|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method set_redirection_step_2 has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_redirection_step_2
              if self.create_redirection.present? && self.create_redirection.to_i > 0
                #Suche Redirector nur mit source und vervollständige ihn
                Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Complex method Goldencobra::Article#date_of_last_modified_child (31.1)
        Open

            def date_of_last_modified_child
              if self.children.length > 0
                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Goldencobra::Article#published_at (31.0)
        Open

            def published_at
              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
                if related_object && related_object.respond_to?(:published_at)
                  related_object.published_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method public_url has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Complex method Goldencobra::Article#method_missing (30.2)
        Open

            def method_missing(meth, *args, &block)
              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method init_image_methods has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.init_image_methods
              if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
                Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                  define_method "image_#{image_type.underscore}" do
                    image(image_type, "original")
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Complex method Goldencobra::Article#uniqify_url_name (28.5)
        Open

            def uniqify_url_name
              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
              if similar_names.count > 1
                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
                self.url_name = [self.url_name, last_used_number + 1].join("--")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Goldencobra::Article::articletype_for_index (28.4)
        Open

            def self.articletype_for_index(current_article)
              # Wenn alle Artikeltypen angezeigt werden sollen
              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method set_redirection_step_1 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_redirection_step_1
              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb - About 55 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

        Complex method Goldencobra::Article#public_url (26.3)
        Open

            def public_url(with_prefix = true)
              if self.startpage
                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Goldencobra::Article#public_url has boolean parameter 'with_prefix'
        Open

            def public_url(with_prefix = true)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Boolean Parameter is a special case of Control Couple, where a method parameter is defaulted to true or false. A Boolean Parameter effectively permits a method's caller to decide which execution path to take. This is a case of bad cohesion. You're creating a dependency between methods that is not really necessary, thus increasing coupling.

        Example

        Given

        class Dummy
          def hit_the_switch(switch = true)
            if switch
              puts 'Hitting the switch'
              # do other things...
            else
              puts 'Not hitting the switch'
              # do other things...
            end
          end
        end

        Reek would emit the following warning:

        test.rb -- 3 warnings:
          [1]:Dummy#hit_the_switch has boolean parameter 'switch' (BooleanParameter)
          [2]:Dummy#hit_the_switch is controlled by argument switch (ControlParameter)

        Note that both smells are reported, Boolean Parameter and Control Parameter.

        Getting rid of the smell

        This is highly dependent on your exact architecture, but looking at the example above what you could do is:

        • Move everything in the if branch into a separate method
        • Move everything in the else branch into a separate method
        • Get rid of the hit_the_switch method alltogether
        • Make the decision what method to call in the initial caller of hit_the_switch

        Goldencobra::Article#render_html refers to 'av' more than self (maybe move it to another class?)
        Open

              av.request = ActionDispatch::Request.new(Rack::MockRequest.env_for(self.public_url))
              av.request["format"] = "text/html"
              av.controller = Goldencobra::ArticlesController.new
              av.controller.request = av.request
              if localparams.present? && localparams[:params].present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Feature Envy occurs when a code fragment references another object more often than it references itself, or when several clients do the same series of manipulations on a particular type of object.

        Feature Envy reduces the code's ability to communicate intent: code that "belongs" on one class but which is located in another can be hard to find, and may upset the "System of Names" in the host class.

        Feature Envy also affects the design's flexibility: A code fragment that is in the wrong class creates couplings that may not be natural within the application's domain, and creates a loss of cohesion in the unwilling host class.

        Feature Envy often arises because it must manipulate other objects (usually its arguments) to get them into a useful form, and one force preventing them (the arguments) doing this themselves is that the common knowledge lives outside the arguments, or the arguments are of too basic a type to justify extending that type. Therefore there must be something which 'knows' about the contents or purposes of the arguments. That thing would have to be more than just a basic type, because the basic types are either containers which don't know about their contents, or they are single objects which can't capture their relationship with their fellows of the same type. So, this thing with the extra knowledge should be reified into a class, and the utility method will most likely belong there.

        Example

        Running Reek on:

        class Warehouse
          def sale_price(item)
            (item.price - item.rebate) * @vat
          end
        end

        would report:

        Warehouse#total_price refers to item more than self (FeatureEnvy)

        since this:

        (item.price - item.rebate)

        belongs to the Item class, not the Warehouse.

        Goldencobra::Article#render_html has approx 9 statements
        Open

            def render_html(layoutfile="application", localparams={})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#public_url is controlled by argument 'with_prefix'
        Open

                if with_prefix
                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
                  return "/"
                end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Control Parameter is a special case of Control Couple

        Example

        A simple example would be the "quoted" parameter in the following method:

        def write(quoted)
          if quoted
            write_quoted @value
          else
            write_unquoted @value
          end
        end

        Fixing those problems is out of the scope of this document but an easy solution could be to remove the "write" method alltogether and to move the calls to "writequoted" / "writeunquoted" in the initial caller of "write".

        Goldencobra::Article#index_articles has approx 33 statements
        Open

            def index_articles(current_operator=nil, user_frontend_tags=nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#self.search_by_url has approx 6 statements
        Open

            def self.search_by_url(url)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#link_checker refers to 'lc' more than self (maybe move it to another class?)
        Open

                old_result[lc.target_link] = { "response_code"  => lc.response_code,
                                               "response_time"  => lc.response_time,
                                               "response_error" => lc.response_error,
                                               "position"       => lc.position }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Feature Envy occurs when a code fragment references another object more often than it references itself, or when several clients do the same series of manipulations on a particular type of object.

        Feature Envy reduces the code's ability to communicate intent: code that "belongs" on one class but which is located in another can be hard to find, and may upset the "System of Names" in the host class.

        Feature Envy also affects the design's flexibility: A code fragment that is in the wrong class creates couplings that may not be natural within the application's domain, and creates a loss of cohesion in the unwilling host class.

        Feature Envy often arises because it must manipulate other objects (usually its arguments) to get them into a useful form, and one force preventing them (the arguments) doing this themselves is that the common knowledge lives outside the arguments, or the arguments are of too basic a type to justify extending that type. Therefore there must be something which 'knows' about the contents or purposes of the arguments. That thing would have to be more than just a basic type, because the basic types are either containers which don't know about their contents, or they are single objects which can't capture their relationship with their fellows of the same type. So, this thing with the extra knowledge should be reified into a class, and the utility method will most likely belong there.

        Example

        Running Reek on:

        class Warehouse
          def sale_price(item)
            (item.price - item.rebate) * @vat
          end
        end

        would report:

        Warehouse#total_price refers to item more than self (FeatureEnvy)

        since this:

        (item.price - item.rebate)

        belongs to the Item class, not the Warehouse.

        Goldencobra::Article#filter_with_permissions has approx 7 statements
        Open

            def filter_with_permissions(list, current_operator)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article has at least 54 methods
        Open

          class Article < ActiveRecord::Base
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Too Many Methods is a special case of LargeClass.

        Example

        Given this configuration

        TooManyMethods:
          max_methods: 3

        and this code:

        class TooManyMethods
          def one; end
          def two; end
          def three; end
          def four; end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [1]:TooManyMethods has at least 4 methods (TooManyMethods)

        Goldencobra::Article#set_redirection_step_2 has approx 11 statements
        Open

            def set_redirection_step_2
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#image refers to 'selected_images' more than self (maybe move it to another class?)
        Open

              if selected_images.any? && selected_images.first.image && selected_images.first.image.image
                return selected_images.first.image.image.url(size.to_sym)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Feature Envy occurs when a code fragment references another object more often than it references itself, or when several clients do the same series of manipulations on a particular type of object.

        Feature Envy reduces the code's ability to communicate intent: code that "belongs" on one class but which is located in another can be hard to find, and may upset the "System of Names" in the host class.

        Feature Envy also affects the design's flexibility: A code fragment that is in the wrong class creates couplings that may not be natural within the application's domain, and creates a loss of cohesion in the unwilling host class.

        Feature Envy often arises because it must manipulate other objects (usually its arguments) to get them into a useful form, and one force preventing them (the arguments) doing this themselves is that the common knowledge lives outside the arguments, or the arguments are of too basic a type to justify extending that type. Therefore there must be something which 'knows' about the contents or purposes of the arguments. That thing would have to be more than just a basic type, because the basic types are either containers which don't know about their contents, or they are single objects which can't capture their relationship with their fellows of the same type. So, this thing with the extra knowledge should be reified into a class, and the utility method will most likely belong there.

        Example

        Running Reek on:

        class Warehouse
          def sale_price(item)
            (item.price - item.rebate) * @vat
          end
        end

        would report:

        Warehouse#total_price refers to item more than self (FeatureEnvy)

        since this:

        (item.price - item.rebate)

        belongs to the Item class, not the Warehouse.

        Goldencobra::Article#self.article_types_for_select contains iterators nested 2 deep
        Open

                    Dir.foreach(file_name_path) do |sub_name|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A Nested Iterator occurs when a block contains another block.

        Example

        Given

        class Duck
          class << self
            def duck_names
              %i!tick trick track!.each do |surname|
                %i!duck!.each do |last_name|
                  puts "full name is #{surname} #{last_name}"
                end
              end
            end
          end
        end

        Reek would report the following warning:

        test.rb -- 1 warning:
          [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

        Goldencobra::Article#self.article_types_for_select has approx 8 statements
        Open

            def self.article_types_for_select
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#self.init_image_methods has approx 10 statements
        Open

            def self.init_image_methods
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#self.simple_search has approx 7 statements
        Open

            def self.simple_search(q)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#self.articletype_for_index has approx 6 statements
        Open

            def self.articletype_for_index(current_article)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#public_url has approx 7 statements
        Open

            def public_url(with_prefix = true)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#set_redirection_step_1 has approx 8 statements
        Open

            def set_redirection_step_1
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A method with Too Many Statements is any method that has a large number of lines.

        Too Many Statements warns about any method that has more than 5 statements. Reek's smell detector for Too Many Statements counts +1 for every simple statement in a method and +1 for every statement within a control structure (if, else, case, when, for, while, until, begin, rescue) but it doesn't count the control structure itself.

        So the following method would score +6 in Reek's statement-counting algorithm:

        def parse(arg, argv, &error)
          if !(val = arg) and (argv.empty? or /\A-/ =~ (val = argv[0]))
            return nil, block, nil                                         # +1
          end
          opt = (val = parse_arg(val, &error))[1]                          # +2
          val = conv_arg(*val)                                             # +3
          if opt and !arg
            argv.shift                                                     # +4
          else
            val[0] = nil                                                   # +5
          end
          val                                                              # +6
        end

        (You might argue that the two assigments within the first @if@ should count as statements, and that perhaps the nested assignment should count as +2.)

        Goldencobra::Article#self.init_image_methods contains iterators nested 2 deep
        Open

                      define_method "image_#{image_type.underscore}_#{style_name}" do
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A Nested Iterator occurs when a block contains another block.

        Example

        Given

        class Duck
          class << self
            def duck_names
              %i!tick trick track!.each do |surname|
                %i!duck!.each do |last_name|
                  puts "full name is #{surname} #{last_name}"
                end
              end
            end
          end
        end

        Reek would report the following warning:

        test.rb -- 1 warning:
          [5]:Duck#duck_names contains iterators nested 2 deep (NestedIterators)

        Complex method Goldencobra::Article#render_html (25.4)
        Open

            def render_html(layoutfile="application", localparams={})
              av = ActionView::Base.new(ActionController::Base.view_paths + ["#{::Goldencobra::Engine.root}/app/views/goldencobra/articles/"])
              av.request = ActionDispatch::Request.new(Rack::MockRequest.env_for(self.public_url))
              av.request["format"] = "text/html"
              av.controller = Goldencobra::ArticlesController.new
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Method articletype_for_index has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def self.articletype_for_index(current_article)
              # Wenn alle Artikeltypen angezeigt werden sollen
              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Method set_standard_application_template has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_standard_application_template
              if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") && ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
                if self.template_file.blank?
                  if self.articletype.present? && self.articletype.default_template_file.present?
                    self.template_file = self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Complex method Goldencobra::Article#get_related_object (24.5)
        Open

            def get_related_object
              if self.article_type.present? && self.article_type_form_file.present? &&
                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        
                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Goldencobra::Article tests 'self.article_type.present?' at least 3 times
        Open

              if self.article_type.present?
                self.article_type.split(" ")[0..-2].join("")
              end
            end
        
        
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Repeated Conditional is a special case of Simulated Polymorphism. Basically it means you are checking the same value throughout a single class and take decisions based on this.

        Example

        Given

        class RepeatedConditionals
          attr_accessor :switch
        
          def repeat_1
            puts "Repeat 1!" if switch
          end
        
          def repeat_2
            puts "Repeat 2!" if switch
          end
        
          def repeat_3
            puts "Repeat 3!" if switch
          end
        end

        Reek would emit the following warning:

        test.rb -- 4 warnings:
          [5, 9, 13]:RepeatedConditionals tests switch at least 3 times (RepeatedConditional)

        If you get this warning then you are probably not using the right abstraction or even more probable, missing an additional abstraction.

        Complex method Goldencobra::Article::simple_search (23.6)
        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 by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Complex method Goldencobra::Article#set_descendants_status (23.6)
        Open

            def set_descendants_status
              if !self.new_record? && self.active_changed? && self.descendants.any?
                # Save without callbacks
                if Rails::VERSION::MAJOR == 3
                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Goldencobra::Article#active? calls 'self.active_since.present?' 2 times
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#article_type_for_search calls 'self.article_type' 2 times
        Open

              if self.article_type.present?
                self.article_type.split(" ")[0..-2].join("")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'Goldencobra::Article.active' 2 times
        Open

                @list_of_articles = Goldencobra::Article.active.articletype_for_index(self)
              else
                # Index aller Artikel anzeigen, die Kinder sind von einem Bestimmten artikel
                parent_article = Goldencobra::Article.where(id: self.article_for_index_id).select(:id, :ancestry).first
                if parent_article.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.article_type_form_file' 2 times
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.article_type_form_file.underscore.parameterize.downcase' 2 times
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#breadcrumb_name calls 'self.breadcrumb' 2 times
        Open

              if self.breadcrumb.present?
                return self.breadcrumb
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls '@list_of_articles.flatten.sort_by' 3 times
        Open

                  @list_of_articles = @list_of_articles.flatten.sort_by do |article|
                    [article.title.downcase, article.title]
                  end
                elsif sort_order == "GlobalSortID"
                  @list_of_articles = @list_of_articles.flatten.sort_by do |article|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'a.respond_to_all?(sorter)' 2 times
        Open

                  @unsortable = @list_of_articles.flatten.select { |a| !a.respond_to_all?(sorter) }
                  @list_of_articles = @list_of_articles.flatten.delete_if { |a| !a.respond_to_all?(sorter) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.article_for_index_id' 2 times
        Open

              if self.article_for_index_id.blank?
                # Index aller Artikel anzeigen
                @list_of_articles = Goldencobra::Article.active.articletype_for_index(self)
              else
                # Index aller Artikel anzeigen, die Kinder sind von einem Bestimmten artikel
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_teaser calls 'self.teaser' 4 times
        Open

              return self.teaser if self.teaser.present?
              return self.summary if self.teaser.blank? && self.summary.present?
              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_url calls 'Goldencobra::Domain.current.try(:url_prefix)' 2 times
        Open

                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
                  return "/"
                end
              else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_2 calls 'self.create_redirection' 3 times
        Open

              if self.create_redirection.present? && self.create_redirection.to_i > 0
                #Suche Redirector nur mit source und vervollständige ihn
                Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_2 calls 'self.id' 2 times
        Open

                  custom_children = Goldencobra::Article.where(ancestry: "#{self.ancestry}/#{self.id}")
                  if custom_children.any?
                    if custom_children.count < 30
                      # wenn es nur wenige Kinderartikel gibt, dann gleich direkt machen
                      custom_children.each do |d|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_standard_application_template calls 'self.articletype' 3 times
        Open

                  if self.articletype.present? && self.articletype.default_template_file.present?
                    self.template_file = self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article has no descriptive comment
        Open

          class Article < ActiveRecord::Base
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Classes and modules are the units of reuse and release. It is therefore considered good practice to annotate every class and module with a brief comment outlining its responsibilities.

        Example

        Given

        class Dummy
          # Do things...
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [1]:Dummy has no descriptive comment (IrresponsibleModule)

        Fixing this is simple - just an explaining comment:

        # The Dummy class is responsible for ...
        class Dummy
          # Do things...
        end

        Goldencobra::Article#get_related_object manually dispatches method call
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#searchable_in_article_type manually dispatches method call
        Open

                if related_object && related_object.respond_to?(:fulltext_searchable_text)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#active? calls 'Time.now' 2 times
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.children' 3 times
        Open

              if self.children.length > 0
                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.children.order("updated_at DESC")' 2 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.init_image_methods calls 'selected_images.first' 3 times
        Open

                    return "" if selected_images.none? || selected_images.first.image.blank?
                    selected_images.first.image.alt_text || selected_images.first.image.image_file_name
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.init_image_methods calls 'selected_images.first.image' 3 times
        Open

                    return "" if selected_images.none? || selected_images.first.image.blank?
                    selected_images.first.image.alt_text || selected_images.first.image.image_file_name
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_1 calls 'Goldencobra::Domain.current' 2 times
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
                else
                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#verify_existence_of_opengraph_image calls 'self.article_images' 5 times
        Open

                if self.article_images.any? && self.article_images.first.present? &&
                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_url calls 'Goldencobra::Domain.current' 2 times
        Open

                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
                else
                  return "/"
                end
              else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#published_at calls 'self.article_type_form_file.underscore.parameterize' 2 times
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.simple_search calls 'article.parent' 3 times
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_index_article_id calls 'self.id' 2 times
        Open

                self.update_column(:article_for_index_id, self.id)
              elsif Rails::VERSION::MAJOR > 3
                self.update_columns(article_for_index_id: self.id)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_1 calls 'Goldencobra::Domain.current.try(:url_prefix)' 2 times
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
                else
                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_title_from_breadcrumb calls 'self.breadcrumb' 2 times
        Open

              if self.title.blank? && self.breadcrumb.present?
                self.title = self.breadcrumb
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.children.order("updated_at DESC").first.updated_at' 2 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'article.title' 2 times
        Open

                    [article.title.downcase, article.title]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.index_of_articles_descendents_depth' 2 times
        Open

                  unless self.index_of_articles_descendents_depth == "all"
                    current_depth = parent_article.depth
                    @list_of_articles = @list_of_articles.to_depth(current_depth + self.index_of_articles_descendents_depth.to_i)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#kind_of_article_type calls 'self.article_type' 2 times
        Open

              self.article_type.present? ? self.article_type.split(" ").last : ""
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#selected_layout calls 'self.template_file' 2 times
        Open

              if self.template_file.blank?
                if self.articletype.present? && self.articletype.default_template_file.present?
                  self.articletype.default_template_file
                else
                  "application"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.articletype_for_index calls 'current_article.display_index_types == "index"' 2 times
        Open

                elsif current_article.display_index_types == "index"
                  where("article_type LIKE '% Index' ")
                else
                  where("article_type LIKE '% Show' OR article_type LIKE '% Index' ")
                end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_descendants_status calls 'self.active' 2 times
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
                elsif Rails::VERSION::MAJOR > 3
                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_1 calls 'self.absolute_base_url' 2 times
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
                else
                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#filter_with_permissions manually dispatches method call
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#get_related_object calls 'self.article_type_form_file' 3 times
        Open

              if self.article_type.present? && self.article_type_form_file.present? &&
                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        
                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#image calls 'selected_images.first' 3 times
        Open

              if selected_images.any? && selected_images.first.image && selected_images.first.image.image
                return selected_images.first.image.image.url(size.to_sym)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls '@list_of_articles.flatten' 7 times
        Open

                  @list_of_articles = @list_of_articles.flatten.shuffle
                elsif sort_order == "Alphabetically"
                  @list_of_articles = @list_of_articles.flatten.sort_by do |article|
                    [article.title.downcase, article.title]
                  end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'Goldencobra::Article.active.articletype_for_index(self)' 2 times
        Open

                @list_of_articles = Goldencobra::Article.active.articletype_for_index(self)
              else
                # Index aller Artikel anzeigen, die Kinder sind von einem Bestimmten artikel
                parent_article = Goldencobra::Article.where(id: self.article_for_index_id).select(:id, :ancestry).first
                if parent_article.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#method_missing calls 'self.get_related_object' 3 times
        Open

              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
                  self.get_related_object.send(meth.to_s.split(".").last)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.init_image_methods calls 'image_type.underscore' 3 times
        Open

                  define_method "image_#{image_type.underscore}" do
                    image(image_type, "original")
                  end
                  define_method "image_alt_#{image_type.underscore}" do
                    selected_images = article_images.where(position: image_type)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#active? calls 'self.active_since' 4 times
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.children.order("updated_at DESC").first.updated_at.utc' 2 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.updated_at' 3 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
                else
                  self.updated_at.utc
                end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#active? calls 'Time.now.utc' 2 times
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#get_related_object calls 'self.article_type_form_file.underscore.parameterize' 2 times
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        
                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.article_type_form_file.underscore' 2 times
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.articletype_for_index calls 'current_article.display_index_types' 4 times
        Open

                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
                elsif current_article.display_index_types == "index"
                  where("article_type LIKE '% Index' ")
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'sort_order.downcase' 3 times
        Open

                elsif respond_to?(sort_order.downcase)
                  sorter = sort_order.downcase.to_sym
                  @list_of_articles = @list_of_articles.flatten.sort_by do |article|
                    article.respond_to?(sorter) ? article.send(sorter) : article
                  end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#published_at calls 'self.article_type_form_file.underscore.parameterize.downcase' 2 times
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#update_parent_article_etag calls 'self.parent' 2 times
        Open

              if self.parent.present?
                self.parent.update_attributes(updated_at: Time.now)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.articletype_for_index calls 'current_article.display_index_articletypes' 5 times
        Open

              if current_article.display_index_articletypes == "all"
                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
                elsif current_article.display_index_types == "index"
                  where("article_type LIKE '% Index' ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#verify_existence_of_opengraph_image calls 'self.article_images.first' 4 times
        Open

                if self.article_images.any? && self.article_images.first.present? &&
                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article assumes too much for instance variable '@unsortable'
        Open

          class Article < ActiveRecord::Base
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Classes should not assume that instance variables are set or present outside of the current class definition.

        Good:

        class Foo
          def initialize
            @bar = :foo
          end
        
          def foo?
            @bar == :foo
          end
        end

        Good as well:

        class Foo
          def foo?
            bar == :foo
          end
        
          def bar
            @bar ||= :foo
          end
        end

        Bad:

        class Foo
          def go_foo!
            @bar = :foo
          end
        
          def foo?
            @bar == :foo
          end
        end

        Example

        Running Reek on:

        class Dummy
          def test
            @ivar
          end
        end

        would report:

        [1]:InstanceVariableAssumption: Dummy assumes too much for instance variable @ivar

        Note that this example would trigger this smell warning as well:

        class Parent
          def initialize(omg)
            @omg = omg
          end
        end
        
        class Child < Parent
          def foo
            @omg
          end
        end

        The way to address the smell warning is that you should create an attr_reader to use @omg in the subclass and not access @omg directly like this:

        class Parent
          attr_reader :omg
        
          def initialize(omg)
            @omg = omg
          end
        end
        
        class Child < Parent
          def foo
            omg
          end
        end

        Directly accessing instance variables is considered a smell because it breaks encapsulation and makes it harder to reason about code.

        If you don't want to expose those methods as public API just make them private like this:

        class Parent
          def initialize(omg)
            @omg = omg
          end
        
          private
          attr_reader :omg
        end
        
        class Child < Parent
          def foo
            omg
          end
        end

        Current Support in Reek

        An instance variable must:

        • be set in the constructor
        • or be accessed through a method with lazy initialization / memoization.

        If not, Instance Variable Assumption will be reported.

        Goldencobra::Article#article_type_xml_fields manually dispatches method call
        Open

              if related_object && related_object.respond_to?(:custom_rss_fields)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#date_of_last_modified_child calls 'self.children.order("updated_at DESC").first' 2 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_teaser calls 'self.teaser.blank?' 2 times
        Open

              return self.summary if self.teaser.blank? && self.summary.present?
              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.articletype_for_index calls 'current_article.display_index_types == "show"' 2 times
        Open

                if current_article.display_index_types == "show"
                  where("article_type LIKE '% Show' ")
                elsif current_article.display_index_types == "index"
                  where("article_type LIKE '% Index' ")
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_1 calls 'self.url_path_changed?' 2 times
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
                #Erstelle Redirector nur mit source
                if self.url_path_changed?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#get_related_object calls 'self.article_type_form_file.underscore' 2 times
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        
                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#render_html calls 'localparams[:params]' 2 times
        Open

              if localparams.present? && localparams[:params].present?
                av.params.merge!(localparams[:params])
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.simple_search calls 'article.parent.title' 2 times
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_redirection_step_2 calls 'self.absolute_public_url' 2 times
        Open

                Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
                if r.present?
                  r.target_url = self.absolute_public_url
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles manually dispatches method call
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
              end
        
              # get articles with tag
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#article_type_form_file calls 'self.article_type' 2 times
        Open

              if self.article_type.present?
                self.article_type.split(" ")[0..-2].join("")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#date_of_last_modified_child calls 'self.updated_at.utc' 3 times
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
                  self.children.order("updated_at DESC").first.updated_at.utc
                else
                  self.updated_at.utc
                end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#get_related_object calls 'self.article_type_form_file.underscore.parameterize.downcase' 2 times
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        
                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#image calls 'selected_images.first.image.image' 2 times
        Open

              if selected_images.any? && selected_images.first.image && selected_images.first.image.image
                return selected_images.first.image.image.url(size.to_sym)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.article_type_form_file.underscore.parameterize' 2 times
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_teaser calls 'self.summary' 3 times
        Open

              return self.summary if self.teaser.blank? && self.summary.present?
              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#render_html calls 'av.request' 2 times
        Open

              av.request["format"] = "text/html"
              av.controller = Goldencobra::ArticlesController.new
              av.controller.request = av.request
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#parse_image_gallery_tags manually dispatches method call
        Open

              if self.respond_to?(:image_gallery_tags)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#published_at manually dispatches method call
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
                if related_object && related_object.respond_to?(:published_at)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#self.init_image_methods manually dispatches method call
        Open

                  if ActiveRecord::Base.connection.table_exists?("goldencobra_uploads") && Goldencobra::Upload.respond_to?(:attachment_definitions)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Reek reports a Manual Dispatch smell if it finds source code that manually checks whether an object responds to a method before that method is called. Manual dispatch is a type of Simulated Polymorphism which leads to code that is harder to reason about, debug, and refactor.

        Example

        class MyManualDispatcher
          attr_reader :foo
        
          def initialize(foo)
            @foo = foo
          end
        
          def call
            foo.bar if foo.respond_to?(:bar)
          end
        end

        Reek would emit the following warning:

        test.rb -- 1 warning:
          [9]: MyManualDispatcher manually dispatches method call (ManualDispatch)

        Goldencobra::Article#article_for_index_limit calls 'self.article_for_index_count.to_i' 2 times
        Open

              if self.article_for_index_count.to_i <= 0
                return 1000
              else
                self.article_for_index_count.to_i
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.index_of_articles_tagged_with' 2 times
        Open

              if self.index_of_articles_tagged_with.present?
                @list_of_articles = @list_of_articles.tagged_with(self.index_of_articles_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls 'self.not_tagged_with' 2 times
        Open

              if self.not_tagged_with.present?
                @list_of_articles = @list_of_articles.tagged_with(self.not_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#verify_existence_of_opengraph_image calls 'self.article_images.first.image.image' 2 times
        Open

                   self.article_images.first.image.image.present?
                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#article_for_index_limit calls 'self.article_for_index_count' 2 times
        Open

              if self.article_for_index_count.to_i <= 0
                return 1000
              else
                self.article_for_index_count.to_i
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#selected_layout calls 'self.articletype' 3 times
        Open

                if self.articletype.present? && self.articletype.default_template_file.present?
                  self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.simple_search calls 'article.ancestry' 2 times
        Open

                  ancestry: article.ancestry ? article.ancestry : ''
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#find_related_subarticle calls 'self.descendants' 2 times
        Open

                self.descendants.order("id DESC").first
              else
                self.descendants.order("id ASC").first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#public_url calls 'self.url_path' 2 times
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
                  a_url = self.get_url_from_path
                else
                  a_url = self.url_path
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#published_at calls 'self.created_at' 2 times
        Open

                  self.created_at
                end
              else
                self.created_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#selected_layout calls 'self.articletype.default_template_file' 2 times
        Open

                if self.articletype.present? && self.articletype.default_template_file.present?
                  self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#image calls 'selected_images.first.image' 3 times
        Open

              if selected_images.any? && selected_images.first.image && selected_images.first.image.image
                return selected_images.first.image.image.url(size.to_sym)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#index_articles calls '!a.respond_to_all?(sorter)' 2 times
        Open

                  @unsortable = @list_of_articles.flatten.select { |a| !a.respond_to_all?(sorter) }
                  @list_of_articles = @list_of_articles.flatten.delete_if { |a| !a.respond_to_all?(sorter) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#method_missing calls 'meth.to_s.split(".")' 3 times
        Open

              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
                  self.get_related_object.send(meth.to_s.split(".").last)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#parse_image_gallery_tags calls 'self.image_gallery_tags' 2 times
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article assumes too much for instance variable '@list_of_articles'
        Open

          class Article < ActiveRecord::Base
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Classes should not assume that instance variables are set or present outside of the current class definition.

        Good:

        class Foo
          def initialize
            @bar = :foo
          end
        
          def foo?
            @bar == :foo
          end
        end

        Good as well:

        class Foo
          def foo?
            bar == :foo
          end
        
          def bar
            @bar ||= :foo
          end
        end

        Bad:

        class Foo
          def go_foo!
            @bar = :foo
          end
        
          def foo?
            @bar == :foo
          end
        end

        Example

        Running Reek on:

        class Dummy
          def test
            @ivar
          end
        end

        would report:

        [1]:InstanceVariableAssumption: Dummy assumes too much for instance variable @ivar

        Note that this example would trigger this smell warning as well:

        class Parent
          def initialize(omg)
            @omg = omg
          end
        end
        
        class Child < Parent
          def foo
            @omg
          end
        end

        The way to address the smell warning is that you should create an attr_reader to use @omg in the subclass and not access @omg directly like this:

        class Parent
          attr_reader :omg
        
          def initialize(omg)
            @omg = omg
          end
        end
        
        class Child < Parent
          def foo
            omg
          end
        end

        Directly accessing instance variables is considered a smell because it breaks encapsulation and makes it harder to reason about code.

        If you don't want to expose those methods as public API just make them private like this:

        class Parent
          def initialize(omg)
            @omg = omg
          end
        
          private
          attr_reader :omg
        end
        
        class Child < Parent
          def foo
            omg
          end
        end

        Current Support in Reek

        An instance variable must:

        • be set in the constructor
        • or be accessed through a method with lazy initialization / memoization.

        If not, Instance Variable Assumption will be reported.

        Goldencobra::Article#method_missing calls 'meth.to_s' 3 times
        Open

              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
                  self.get_related_object.send(meth.to_s.split(".").last)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#published_at calls 'self.article_type_form_file' 3 times
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_descendants_status calls 'self.descendants' 3 times
        Open

              if !self.new_record? && self.active_changed? && self.descendants.any?
                # Save without callbacks
                if Rails::VERSION::MAJOR == 3
                  self.descendants.map{ |d| d.update_column(:active, self.active) }
                elsif Rails::VERSION::MAJOR > 3
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_descendants_status calls 'self.descendants.map' 2 times
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
                elsif Rails::VERSION::MAJOR > 3
                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_standard_application_template calls 'self.articletype.default_template_file' 2 times
        Open

                  if self.articletype.present? && self.articletype.default_template_file.present?
                    self.template_file = self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#uniqify_url_name calls 'self.url_name' 2 times
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
              if similar_names.count > 1
                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
                self.url_name = [self.url_name, last_used_number + 1].join("--")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#published_at calls 'self.article_type_form_file.underscore' 2 times
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#self.init_image_methods calls 'ActiveRecord::Base.connection' 2 times
        Open

              if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
                Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
                  define_method "image_#{image_type.underscore}" do
                    image(image_type, "original")
                  end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#set_standard_application_template calls 'ActiveRecord::Base.connection' 2 times
        Open

              if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") && ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Goldencobra::Article#verify_existence_of_opengraph_image calls 'self.article_images.first.image' 3 times
        Open

                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Duplication occurs when two fragments of code look nearly identical, or when two fragments of code have nearly identical effects at some conceptual level.

        Reek implements a check for Duplicate Method Call.

        Example

        Here's a very much simplified and contrived example. The following method will report a warning:

        def double_thing()
          @other.thing + @other.thing
        end

        One quick approach to silence Reek would be to refactor the code thus:

        def double_thing()
          thing = @other.thing
          thing + thing
        end

        A slightly different approach would be to replace all calls of double_thing by calls to @other.double_thing:

        class Other
          def double_thing()
            thing + thing
          end
        end

        The approach you take will depend on balancing other factors in your code.

        Method filter_with_permissions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def filter_with_permissions(list, current_operator)
              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
                return list
              else
                a = Ability.new(current_operator)
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Method selected_layout has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def selected_layout
              if self.template_file.blank?
                if self.articletype.present? && self.articletype.default_template_file.present?
                  self.articletype.default_template_file
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Method published_at has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def published_at
              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
                if related_object && related_object.respond_to?(:published_at)
                  related_object.published_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb - 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

        Goldencobra::Article has missing safe method 'mark_as_startpage!'
        Open

            def mark_as_startpage!
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A candidate method for the Missing Safe Method smell are methods whose names end with an exclamation mark.

        An exclamation mark in method names means (the explanation below is taken from here ):

        The ! in method names that end with ! means, “This method is dangerous”—or, more precisely, this method is the “dangerous” version of an otherwise equivalent method, with the same name minus the !. “Danger” is relative; the ! doesn’t mean anything at all unless the method name it’s in corresponds to a similar but bang-less method name. So, for example, gsub! is the dangerous version of gsub. exit! is the dangerous version of exit. flatten! is the dangerous version of flatten. And so forth.

        Such a method is called Missing Safe Method if and only if her non-bang version does not exist and this method is reported as a smell.

        Example

        Given

        class C
          def foo; end
          def foo!; end
          def bar!; end
        end

        Reek would report bar! as Missing Safe Method smell but not foo!.

        Reek reports this smell only in a class context, not in a module context in order to allow perfectly legit code like this:

        class Parent
          def foo; end
        end
        
        module Dangerous
          def foo!; end
        end
        
        class Son < Parent
          include Dangerous
        end
        
        class Daughter < Parent
        end

        In this example, Reek would not report the Missing Safe Method smell for the method foo of the Dangerous module.

        Goldencobra::Article#remove_html_tags doesn't depend on instance state (maybe move it to another class?)
        Open

            def remove_html_tags(text)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A Utility Function is any instance method that has no dependency on the state of the instance.

        Goldencobra::Article#hint_label is a writable attribute
        Open

            attr_accessor   :hint_label, :manual_article_sort, :create_redirection
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

        The same holds to a lesser extent for getters, but Reek doesn't flag those.

        Example

        Given:

        class Klass
          attr_accessor :dummy
        end

        Reek would emit the following warning:

        reek test.rb
        
        test.rb -- 1 warning:
          [2]:Klass declares the writable attribute dummy (Attribute)

        Goldencobra::Article#create_redirection is a writable attribute
        Open

            attr_accessor   :hint_label, :manual_article_sort, :create_redirection
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

        The same holds to a lesser extent for getters, but Reek doesn't flag those.

        Example

        Given:

        class Klass
          attr_accessor :dummy
        end

        Reek would emit the following warning:

        reek test.rb
        
        test.rb -- 1 warning:
          [2]:Klass declares the writable attribute dummy (Attribute)

        Goldencobra::Article#manual_article_sort is a writable attribute
        Open

            attr_accessor   :hint_label, :manual_article_sort, :create_redirection
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A class that publishes a setter for an instance variable invites client classes to become too intimate with its inner workings, and in particular with its representation of state.

        The same holds to a lesser extent for getters, but Reek doesn't flag those.

        Example

        Given:

        class Klass
          attr_accessor :dummy
        end

        Reek would emit the following warning:

        reek test.rb
        
        test.rb -- 1 warning:
          [2]:Klass declares the writable attribute dummy (Attribute)

        Goldencobra::Article#absolute_base_url doesn't depend on instance state (maybe move it to another class?)
        Open

            def absolute_base_url
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A Utility Function is any instance method that has no dependency on the state of the instance.

        Goldencobra::Article#filter_with_permissions doesn't depend on instance state (maybe move it to another class?)
        Open

            def filter_with_permissions(list, current_operator)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        A Utility Function is any instance method that has no dependency on the state of the instance.

        Complex method Goldencobra::Article::search_by_url (20.8)
        Open

            def self.search_by_url(url)
              article = nil
              articles = Goldencobra::Article.where(url_name: url.split("/").last.to_s.split(".").first)
              article_path = "/#{url.split('.').first}"
              if articles.count > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by flog

        Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

        You can read more about ABC metrics or the flog tool

        Goldencobra::Article#metatag has unused parameter 'name'
        Open

            def metatag(name)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Unused Parameter refers to methods with parameters that are unused in scope of the method.

        Having unused parameters in a method is code smell because leaving dead code in a method can never improve the method and it makes the code confusing to read.

        Example

        Given:

        class Klass
          def unused_parameters(x,y,z)
            puts x,y # but not z
          end
        end

        Reek would emit the following warning:

        [2]:Klass#unused_parameters has unused parameter 'z' (UnusedParameters)

        Goldencobra::Article#self.ransackable_scopes has unused parameter 'auth_object'
        Open

            def self.ransackable_scopes(auth_object = nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        Unused Parameter refers to methods with parameters that are unused in scope of the method.

        Having unused parameters in a method is code smell because leaving dead code in a method can never improve the method and it makes the code confusing to read.

        Example

        Given:

        class Klass
          def unused_parameters(x,y,z)
            puts x,y # but not z
          end
        end

        Reek would emit the following warning:

        [2]:Klass#unused_parameters has unused parameter 'z' (UnusedParameters)

        Goldencobra::Article#self.search_by_url has the variable name 'a'
        Open

                article = articles.select { |a| a.public_url(false) == article_path }.first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_redirection_step_1 has the name 'set_redirection_step_1'
        Open

            def set_redirection_step_1
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Method Name is a method name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#mark_as_startpage! has the variable name 'a'
        Open

              Goldencobra::Article.startpage.each do |a|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#self.state_attributes_for_select has the variable name 's'
        Open

              states.map do |s, _|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_redirection_step_1 has the variable name 'r'
        Open

                r = Goldencobra::Redirector.find_by_source_url(old_url)
                if r.blank?
                  r = Goldencobra::Redirector.create(source_url: old_url)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_redirection_step_2 has the variable name 'r'
        Open

                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#uniqify_url_name has the variable name 'v'
        Open

                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#parse_image_gallery_tags has the variable name 'a'
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#self.articles_for_index_selecetion has the variable name 'a'
        Open

                  |a| [a.parent_path, a.id]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_descendants_status has the variable name 'd'
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
                elsif Rails::VERSION::MAJOR > 3
                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#self.simple_search has the parameter name 'q'
        Open

            def self.simple_search(q)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Parameter Name is a parameter name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#index_articles has the variable name 'a'
        Open

                  @unsortable = @list_of_articles.flatten.select { |a| !a.respond_to_all?(sorter) }
                  @list_of_articles = @list_of_articles.flatten.delete_if { |a| !a.respond_to_all?(sorter) }
                  @list_of_articles = @list_of_articles.sort_by { |a| eval("a.#{sorter}") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_redirection_step_2 has the variable name 'd'
        Open

                      custom_children.each do |d|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#filter_with_permissions has the variable name 'a'
        Open

        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#get_url_from_path has the variable name 'a'
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#uniqify_url_name has the variable name 'c'
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#set_redirection_step_2 has the name 'set_redirection_step_2'
        Open

            def set_redirection_step_2
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Method Name is a method name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Goldencobra::Article#public_url has the variable name 'a'
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by reek

        An Uncommunicative Variable Name is a variable name that doesn't communicate its intent well enough.

        Poor names make it hard for the reader to build a mental picture of what's going on in the code. They can also be mis-interpreted; and they hurt the flow of reading, because the reader must slow down to interpret the names.

        Avoid more than 3 levels of block nesting.
        Open

                    if custom_children.count < 30
                      # wenn es nur wenige Kinderartikel gibt, dann gleich direkt machen
                      custom_children.each do |d|
                        d.updated_at = Time.now
                        d.url_path = d.get_url_from_path
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for excessive nesting of conditional and looping constructs.

        You can configure if blocks are considered using the CountBlocks option. When set to false (the default) blocks are not counted towards the nesting level. Set to true to count blocks as well.

        The maximum level of nesting allowed is configurable.

        Use delete instead of gsub.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

        Use tr instead of gsub.
        Open

                self.url_name = self.breadcrumb.urlize(downcase: true, convert_spaces: true).gsub("_", "-")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

        Use tr instead of gsub.
        Open

              self.title.to_s.gsub("/", " ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

        Use delete instead of gsub.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop identifies places where gsub can be replaced by tr or delete.

        Example:

        # bad
        'abc'.gsub('b', 'd')
        'abc'.gsub('a', '')
        'abc'.gsub(/a/, 'd')
        'abc'.gsub!('a', 'd')
        
        # good
        'abc'.gsub(/.*/, 'a')
        'abc'.gsub(/a+/, 'd')
        'abc'.tr('b', 'd')
        'a b c'.delete(' ')

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

            def set_descendants_status
              if !self.new_record? && self.active_changed? && self.descendants.any?
                # Save without callbacks
                if Rails::VERSION::MAJOR == 3
                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb and 1 other location - About 55 mins to fix
        app/models/goldencobra/menue.rb on lines 166..174

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

        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

        Missing space after #.
        Open

              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Extra blank line detected.
        Open

        
            if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Unnecessary spacing detected.
        Open

            attr_accessor   :hint_label, :manual_article_sort, :create_redirection
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for extra/unnecessary whitespace.

        Example:

        # good if AllowForAlignment is true
        name      = "RuboCop"
        # Some comment and an empty line
        
        website  += "/rubocop-hq/rubocop" unless cond
        puts        "rubocop"          if     debug
        
        # bad for any configuration
        set_app("RuboCop")
        website  = "https://github.com/rubocop-hq/rubocop"

        Use empty lines between method definitions.
        Open

            def date_of_last_modified_child
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Extra blank line detected.
        Open

        
            def cleanup_redirections
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Missing space after #.
        Open

                #Erstelle Redirector nur mit source
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Use empty lines between method definitions.
        Open

            def article_type_form_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Use empty lines between method definitions.
        Open

            def published_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Extra blank line detected.
        Open

        
            def date_of_last_modified_child
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Missing space after #.
        Open

            #Datum für den RSS reader, Datum ist created_at es sei denn ein Articletype hat ein published_at definiert
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Extra blank line detected.
        Open

        
            # Methode filtert die @list_of_articles.
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Extra blank line detected.
        Open

        
            # scope for index articles, display show-articles, index-articles or both articletypes
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Extra blank line detected.
        Open

        
            def index_articles(current_operator=nil, user_frontend_tags=nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Use 2 (not 0) spaces for rails indentation.
        Open

            def self.ransackable_scopes(auth_object = nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for indentation that doesn't use the specified number of spaces.

        See also the IndentationConsistency cop which is the companion to this one.

        Example:

        # bad
        class A
         def test
          puts 'hello'
         end
        end
        
        # good
        class A
          def test
            puts 'hello'
          end
        end

        Example: IgnoredPatterns: ['^\s*module']

        # bad
        module A
        class B
          def test
          puts 'hello'
          end
        end
        end
        
        # good
        module A
        class B
          def test
            puts 'hello'
          end
        end
        end

        Add an empty line after magic comments.
        Open

        # == Schema Information
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for a newline after the final magic comment.

        Example:

        # good
        # frozen_string_literal: true
        
        # Some documentation for Person
        class Person
          # Some code
        end
        
        # bad
        # frozen_string_literal: true
        # Some documentation for Person
        class Person
          # Some code
        end

        Use empty lines between method definitions.
        Open

            def filter_with_permissions(list, current_operator)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Missing space after #.
        Open

            #Das ist der Titel, der verwendet wird, wenn daraus ein Menüpunkt erstellt werden soll.
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #children         Scopes the model on children of the record
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Surrounding space missing in default value assignment.
        Open

            def index_articles(current_operator=nil, user_frontend_tags=nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Space missing to the left of {.
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing to the left of {.
        Open

                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing inside }.
        Open

            scope :modified_since, lambda{ |date| where("updated_at > ?", Date.parse(date))}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Line is too long. [111/100]
        Open

                parent_article = Goldencobra::Article.where(id: self.article_for_index_id).select(:id, :ancestry).first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [120/100]
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use empty lines between method definitions.
        Open

            def absolute_public_url
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Missing space after #.
        Open

            #Gibt ein Textstring zurück der bei den speziellen Artiekltypen für die Volltextsuche durchsucht werden soll
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #is_only_child?   Returns true if the record is the only child of its parent
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Surrounding space missing in default value assignment.
        Open

            def render_html(layoutfile="application", localparams={})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Surrounding space missing in default value assignment.
        Open

            def render_html(layoutfile="application", localparams={})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Space missing to the left of {.
        Open

            scope :frontend_tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :frontend_tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Do not use spaces between -> and opening brace in lambda literals
        Open

            scope :parent_ids_in_eq, -> (art_id = 1) { subtree_of(art_id) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for spaces between -> and opening parameter brace in lambda literals.

        Example: EnforcedStyle: requirenospace (default)

        # bad
          a = -> (x, y) { x + y }
        
          # good
          a = ->(x, y) { x + y }

        Example: EnforcedStyle: require_space

        # bad
          a = ->(x, y) { x + y }
        
          # good
          a = -> (x, y) { x + y }

        Symbol with a boolean name - you probably meant to use false.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for :true and :false symbols. In most cases it would be a typo.

        Example:

        # bad
        :true
        
        # good
        true

        Example:

        # bad
        :false
        
        # good
        false

        Line is too long. [158/100]
        Open

                  where("article_type = '#{current_article.display_index_articletypes} Show' OR article_type = '#{current_article.display_index_articletypes} Index'")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [126/100]
        Open

                      system("cd #{::Rails.root} && RAILS_ENV=#{::Rails.env} bundle exec rake article_cache:recreate ID=#{self.id} &")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [141/100]
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Method parameter must be at least 3 characters long.
        Open

            def self.simple_search(q)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks method parameter names for how descriptive they are. It is highly configurable.

        The MinNameLength config option takes an integer. It represents the minimum amount of characters the name must be. Its default is 3. The AllowNamesEndingInNumbers config option takes a boolean. When set to false, this cop will register offenses for names ending with numbers. Its default is false. The AllowedNames config option takes an array of whitelisted names that will never register an offense. The ForbiddenNames config option takes an array of blacklisted names that will always register an offense.

        Example:

        # bad
        def bar(varOne, varTwo)
          varOne + varTwo
        end
        
        # With `AllowNamesEndingInNumbers` set to false
        def foo(num1, num2)
          num1 * num2
        end
        
        # With `MinArgNameLength` set to number greater than 1
        def baz(a, b, c)
          do_stuff(a, b, c)
        end
        
        # good
        def bar(thud, fred)
          thud + fred
        end
        
        def foo(speed, distance)
          speed * distance
        end
        
        def baz(age_a, height_b, gender_c)
          do_stuff(age_a, height_b, gender_c)
        end

        Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
        Open

                return eval("self.#{method_name}.present?")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

        Example:

        # bad
        eval <<-RUBY
          def do_something
          end
        RUBY
        
        # bad
        C.class_eval <<-RUBY
          def do_something
          end
        RUBY
        
        # good
        eval <<-RUBY, binding, __FILE__, __LINE__ + 1
          def do_something
          end
        RUBY
        
        # good
        C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def do_something
          end
        RUBY

        Freeze mutable objects assigned to constants.
        Open

            LiquidParser = {}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

        Example:

        # bad
        CONST = [1, 2, 3]
        
        # good
        CONST = [1, 2, 3].freeze
        
        # good
        CONST = <<~TESTING.freeze
        This is a heredoc
        TESTING

        Redundant self detected.
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.article_type.present? ? self.article_type.split(" ").last : ""
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.article_type.split(" ")[0..-2].join("")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.articletype.present? && self.articletype.default_template_file.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Rename is_startpage? to startpage?.
        Open

            def is_startpage?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop makes sure that predicates are named properly.

        Example:

        # bad
        def is_even?(value)
        end
        
        # good
        def even?(value)
        end
        
        # bad
        def has_value?
        end
        
        # good
        def value?
        end

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if selected_images.any? && selected_images.first.image && selected_images.first.image.image
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.breadcrumb.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

                if with_prefix
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        Redundant return detected.
        Open

              return results
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? &&
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.summary if self.teaser.blank? && self.summary.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_for_index_count.to_i <= 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Missing space after #.
        Open

        #parent_id        Returns the id of the parent of the record, nil for a root node
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #root_id          Returns the id of the root of the tree the record is in
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing to the left of {.
        Open

            scope :articletype, lambda{ |name| where(article_type: name)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing to the left of {.
        Open

            scope :latest, lambda{ |counter| order("created_at DESC").limit(counter)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing to the left of {.
        Open

            scope :modified_since, lambda{ |date| where("updated_at > ?", Date.parse(date))}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Line is too long. [115/100]
        Open

            belongs_to :articletype, class_name: Goldencobra::Articletype, foreign_key: "article_type", primary_key: "name"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [139/100]
        Open

                  if ActiveRecord::Base.connection.table_exists?("goldencobra_uploads") && Goldencobra::Upload.respond_to?(:attachment_definitions)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [112/100]
        Open

            #Gibt ein Textstring zurück der bei den speziellen Artiekltypen für die Volltextsuche durchsucht werden soll
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [123/100]
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [184/100]
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Rename has_children to children?.
        Open

            def has_children
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop makes sure that predicates are named properly.

        Example:

        # bad
        def is_even?(value)
        end
        
        # good
        def even?(value)
        end
        
        # bad
        def has_value?
        end
        
        # good
        def value?
        end

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

                  if a.can?(:read, article)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Redundant self detected.
        Open

                  self.get_related_object.send(meth.to_s.split(".").last)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.template_file.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                return self.breadcrumb
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Use empty lines between method definitions.
        Open

            def cleanup_redirections
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Unnecessary spacing detected.
        Open

            web_url         :external_url_redirect
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for extra/unnecessary whitespace.

        Example:

        # good if AllowForAlignment is true
        name      = "RuboCop"
        # Some comment and an empty line
        
        website  += "/rubocop-hq/rubocop" unless cond
        puts        "rubocop"          if     debug
        
        # bad for any configuration
        set_app("RuboCop")
        website  = "https://github.com/rubocop-hq/rubocop"

        Missing space after #.
        Open

                #Suche Redirector nur mit source und vervollständige ihn
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #path             Scopes model on path records of the record
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing after comma.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Surrounding space missing in default value assignment.
        Open

            def index_articles(current_operator=nil, user_frontend_tags=nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that the equals signs in parameter default assignments have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end
        
        # good
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end

        Example: EnforcedStyle: no_space

        # bad
        def some_method(arg1 = :default, arg2 = nil, arg3 = [])
          # do something...
        end
        
        # good
        def some_method(arg1=:default, arg2=nil, arg3=[])
          # do something...
        end

        Space inside parentheses detected.
        Open

              html_to_render = av.render(template: "/goldencobra/articles/show.html.erb", layout: "layouts/#{layoutfile}", locals: localparams, content_type: "text/html" )
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for spaces inside ordinary round parentheses.

        Example: EnforcedStyle: no_space (default)

        # The `no_space` style enforces that parentheses do not have spaces.
        
        # bad
        f( 3)
        g = (a + 3 )
        
        # good
        f(3)
        g = (a + 3)

        Example: EnforcedStyle: space

        # The `space` style enforces that parentheses have a space at the
        # beginning and end.
        # Note: Empty parentheses should not have spaces.
        
        # bad
        f(3)
        g = (a + 3)
        y( )
        
        # good
        f( 3 )
        g = ( a + 3 )
        y()

        Line is too long. [256/100]
        Open

            scope :fulltext_contains, lambda{ |name| where("content LIKE '%#{name}%' OR teaser LIKE '%#{name}%' OR url_name LIKE '%#{name}%' OR subtitle LIKE '%#{name}%' OR summary LIKE '%#{name}%' OR context_info LIKE '%#{name}%' OR breadcrumb LIKE '%#{name}%'")}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [110/100]
        Open

            #Datum für den RSS reader, Datum ist created_at es sei denn ein Articletype hat ein published_at definiert
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [136/100]
        Open

              #Wenn der Artikle vor mehr als 24 Stunden erstellt wurde und sich an der URL etwas verändert hat, dann eine Weiterleitung anlegen.
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [120/100]
        Open

              active.search(title_or_subtitle_or_url_name_or_content_or_summary_or_teaser_contains: q).relation.map do |article|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [125/100]
        Open

                :frontend_tag_name_contains, :frontend_tag_name_equals, :frontend_tag_name_starts_with, :frontend_tag_name_ends_with,
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [106/100]
        Open

        #path_ids         Returns a list the path ids, starting with the root id and ending with the node's own id
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.article_type.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.metatag_open_graph_image.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if !self.new_record? && self.active_changed? && self.descendants.any?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use (sub_name =~ /^_(?!edit).*/).zero? instead of (sub_name =~ /^_(?!edit).*/) == 0.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for usage of comparison operators (==, >, <) to test numbers as zero, positive, or negative. These can be replaced by their respective predicate methods. The cop can also be configured to do the reverse.

        The cop disregards #nonzero? as it its value is truthy or falsey, but not true and false, and thus not always interchangeable with != 0.

        The cop ignores comparisons to global variables, since they are often populated with objects which can be compared with integers, but are not themselves Integer polymorphic.

        Example: EnforcedStyle: predicate (default)

        # bad
        
        foo == 0
        0 > foo
        bar.baz > 0
        
        # good
        
        foo.zero?
        foo.negative?
        bar.baz.positive?

        Example: EnforcedStyle: comparison

        # bad
        
        foo.zero?
        foo.negative?
        bar.baz.positive?
        
        # good
        
        foo == 0
        0 > foo
        bar.baz > 0

        Redundant return detected.
        Open

                  return "/"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              self.link_checks.each do |lc|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Missing space after #.
        Open

        #parent           Returns the parent of the record, nil for a root node
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #root             Returns the root of the tree the record is in, self for a root node
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #sibling_ids      Returns a list of sibling ids
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Align the operands of a condition in an if statement spanning multiple lines.
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the indentation of the right hand side operand in binary operations that span more than one line.

        Example: EnforcedStyle: aligned (default)

        # bad
        if a +
            b
          something
        end
        
        # good
        if a +
           b
          something
        end

        Example: EnforcedStyle: indented

        # bad
        if a +
           b
          something
        end
        
        # good
        if a +
            b
          something
        end

        Space missing after comma.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space missing after comma.
        Open

            DisplayIndexTypes = [["Einzelseiten und Übersichtsseiten", "all"], ["Einzelseiten", "show"],["Übersichtsseiten", "index"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space missing inside }.
        Open

                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Unused block argument - a. You can omit the argument if you don't care about it.
        Open

                  @list_of_articles = @list_of_articles.sort_by { |a| eval("a.#{sorter}") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for unused block arguments.

        Example:

        # bad
        
        do_something do |used, unused|
          puts used
        end
        
        do_something do |bar|
          puts :foo
        end
        
        define_method(:foo) do |bar|
          puts :baz
        end

        Example:

        #good
        
        do_something do |used, _unused|
          puts used
        end
        
        do_something do
          puts :foo
        end
        
        define_method(:foo) do |_bar|
          puts :baz
        end

        Line is too long. [113/100]
        Open

            scope :no_meta_description, -> { where("metatag_meta_description IS NULL OR metatag_meta_description = ''") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [105/100]
        Open

        #ancestor_ids     Returns a list of ancestor ids, starting with the root id and ending with the parent id
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Do not prefix reader method names with get_.
        Open

            def get_url_from_path
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop makes sure that accessor methods are named properly.

        Example:

        # bad
        def set_attribute(value)
        end
        
        # good
        def attribute=(value)
        end
        
        # bad
        def get_attribute
        end
        
        # good
        def attribute
        end

        Use SCREAMING_SNAKE_CASE for constants.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether constant names are written using SCREAMINGSNAKECASE.

        To avoid false positives, it ignores cases in which we cannot know for certain the type of value that would be assigned to a constant.

        Example:

        # bad
        InchInCm = 2.54
        INCHinCM = 2.54
        Inch_In_Cm = 2.54
        
        # good
        INCH_IN_CM = 2.54

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if ActiveRecord::Base.connection.table_exists?("goldencobra_settings")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :articletype, lambda{ |name| where(article_type: name)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        Freeze mutable objects assigned to constants.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

        Example:

        # bad
        CONST = [1, 2, 3]
        
        # good
        CONST = [1, 2, 3].freeze
        
        # good
        CONST = <<~TESTING.freeze
        This is a heredoc
        TESTING

        Redundant self detected.
        Open

              return false if self.active == false
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.breadcrumb.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.teaser if self.teaser.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Missing space after #.
        Open

        #subtree_ids      Returns a list of all ids in the record's subtree
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing after comma.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space missing after comma.
        Open

                  file_name_path = File.join(path_to_articletypes,name)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Space between { and | missing.
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

                last_used_number = similar_names.map{|v| v.split("--")[1].to_i}.compact.max
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Line is too long. [103/100]
        Open

        #  active_since                        :datetime         default(Fri, 03 Oct 2014 09:43:07 CEST +02:00)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [157/100]
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [121/100]
        Open

                    @list_of_articles = @list_of_articles.to_depth(current_depth + self.index_of_articles_descendents_depth.to_i)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Memoized variable @searchable_in_article_type_result does not match method name searchable_in_article_type. Use @searchable_in_article_type instead.
        Open

              @searchable_in_article_type_result ||= begin
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for memoized methods whose instance variable name does not match the method name.

        This cop can be configured with the EnforcedStyleForLeadingUnderscores directive. It can be configured to allow for memoized instance variables prefixed with an underscore. Prefixing ivars with an underscore is a convention that is used to implicitly indicate that an ivar should not be set or referencd outside of the memoization method.

        Example: EnforcedStyleForLeadingUnderscores: disallowed (default)

        # bad
        # Method foo is memoized using an instance variable that is
        # not `@foo`. This can cause confusion and bugs.
        def foo
          @something ||= calculate_expensive_thing
        end
        
        # good
        def _foo
          @foo ||= calculate_expensive_thing
        end
        
        # good
        def foo
          @foo ||= calculate_expensive_thing
        end
        
        # good
        def foo
          @foo ||= begin
            calculate_expensive_thing
          end
        end
        
        # good
        def foo
          helper_variable = something_we_need_to_calculate_foo
          @foo ||= calculate_expensive_thing(helper_variable)
        end

        Example: EnforcedStyleForLeadingUnderscores :required

        # bad
        def foo
          @something ||= calculate_expensive_thing
        end
        
        # bad
        def foo
          @foo ||= calculate_expensive_thing
        end
        
        # good
        def foo
          @_foo ||= calculate_expensive_thing
        end
        
        # good
        def _foo
          @_foo ||= calculate_expensive_thing
        end

        Example: EnforcedStyleForLeadingUnderscores :optional

        # bad
        def foo
          @something ||= calculate_expensive_thing
        end
        
        # good
        def foo
          @foo ||= calculate_expensive_thing
        end
        
        # good
        def foo
          @_foo ||= calculate_expensive_thing
        end
        
        # good
        def _foo
          @_foo ||= calculate_expensive_thing
        end

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.respond_to?(:image_gallery_tags)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

              if self.article_type.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Redundant self detected.
        Open

              self.title.to_s.gsub("/", " ")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.get_related_object
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.children.order("updated_at DESC").first.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              Goldencobra::Menue.where(target: self.public_url)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              Goldencobra::Comment.where("article_id in (?)", self.subtree_ids)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Missing space after #.
        Open

        #ancestors        Scopes the model on ancestors of the record
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #descendants      Scopes the model on direct and indirect children of the record
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #descendant_ids   Returns a list of a descendant ids
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #depth            Return the depth of the node, root nodes are at depth 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Put one space between the method name and the first argument.
        Open

            attr_accessor   :hint_label, :manual_article_sort, :create_redirection
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that exactly one space is used between a method name and the first argument for method calls without parentheses.

        Alternatively, extra spaces can be added to align the argument with something on a preceding or following line, if the AllowForAlignment config parameter is true.

        Example:

        # bad
        something  x
        something   y, z
        something'hello'
        
        # good
        something x
        something y, z
        something 'hello'

        Line is too long. [103/100]
        Open

                @list_of_articles = @list_of_articles.tagged_with(self.not_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.parent.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Convert if nested inside else to elsif.
        Open

                if current_article.display_index_types == "show"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        If the else branch of a conditional consists solely of an if node, it can be combined with the else to become an elsif. This helps to keep the nesting level from getting too deep.

        Example:

        # bad
        if condition_a
          action_a
        else
          if condition_b
            action_b
          else
            action_c
          end
        end
        
        # good
        if condition_a
          action_a
        elsif condition_b
          action_b
        else
          action_c
        end

        Ternary operators must not be nested. Prefer if or else constructs instead.
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for nested ternary op expressions.

        Example:

        # bad
        a ? (b ? b1 : b2) : a2
        
        # good
        if a
          b ? b1 : b2
        else
          a2
        end

        Redundant return detected.
        Open

              return article
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              selected_images = self.article_images.where(position: position)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.article_type.split(" ")[0..-2].join("")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Extra blank line detected.
        Open

        
            # **************************
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Extra blank line detected.
        Open

        
            #Datum für den RSS reader, Datum ist created_at es sei denn ein Articletype hat ein published_at definiert
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Missing space after #.
        Open

        #is_root?         Returns true if the record is a root node, false otherwise
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #path_ids         Returns a list the path ids, starting with the root id and ending with the node's own id
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #has_children?    Returns true if the record has any children, false otherwise
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #is_childless?    Returns true is the record has no childen, false otherwise
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing after comma.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Do not use spaces between -> and opening brace in lambda literals
        Open

            scope :parent_ids_in, -> (art_id = 1) { subtree_of(art_id) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for spaces between -> and opening parameter brace in lambda literals.

        Example: EnforcedStyle: requirenospace (default)

        # bad
          a = -> (x, y) { x + y }
        
          # good
          a = ->(x, y) { x + y }

        Example: EnforcedStyle: require_space

        # bad
          a = ->(x, y) { x + y }
        
          # good
          a = -> (x, y) { x + y }

        Space missing inside }.
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Line is too long. [108/100]
        Open

                @list_of_articles = @list_of_articles.tagged_with(user_frontend_tags, on: :frontend_tags, any: true)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use SCREAMING_SNAKE_CASE for constants.
        Open

            LiquidParser = {}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether constant names are written using SCREAMINGSNAKECASE.

        To avoid false positives, it ignores cases in which we cannot know for certain the type of value that would be assigned to a constant.

        Example:

        # bad
        InchInCm = 2.54
        INCHinCM = 2.54
        Inch_In_Cm = 2.54
        
        # good
        INCH_IN_CM = 2.54

        Use SCREAMING_SNAKE_CASE for constants.
        Open

            DisplayIndexTypes = [["Einzelseiten und Übersichtsseiten", "all"], ["Einzelseiten", "show"],["Übersichtsseiten", "index"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether constant names are written using SCREAMINGSNAKECASE.

        To avoid false positives, it ignores cases in which we cannot know for certain the type of value that would be assigned to a constant.

        Example:

        # bad
        InchInCm = 2.54
        INCHinCM = 2.54
        Inch_In_Cm = 2.54
        
        # good
        INCH_IN_CM = 2.54

        Unnecessary utf-8 encoding comment.
        Open

        # encoding: utf-8
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks ensures source files have no utf-8 encoding comments.

        Example:

        # bad
        # encoding: UTF-8
        # coding: UTF-8
        # -*- coding: UTF-8 -*-

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

              if sorter_limit && sorter_limit > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :modified_since, lambda{ |date| where("updated_at > ?", Date.parse(date))}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        Redundant return detected.
        Open

              return html_to_render
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              return false if self.active_since.present? && self.active_since > Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.children.length > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.summary if self.teaser.blank? && self.summary.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Space inside } missing.
        Open

              av.assign({article: self})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Missing space after #.
        Open

        #siblings         Scopes the model on siblings of the record, the record itself is included
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Line is too long. [109/100]
        Open

            scope :active, -> { where("active = 1 AND active_since < '#{Time.now.strftime('%Y-%m-%d %H:%M:%S ')}'") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Do not prefix reader method names with get_.
        Open

            def get_related_object
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop makes sure that accessor methods are named properly.

        Example:

        # bad
        def set_attribute(value)
        end
        
        # good
        def attribute=(value)
        end
        
        # bad
        def get_attribute
        end
        
        # good
        def attribute
        end

        Space missing to the left of {.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Missing top-level class documentation comment.
        Open

          class Article < ActiveRecord::Base
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for missing top-level documentation of classes and modules. Classes with no body are exempt from the check and so are namespace modules - modules that have nothing in their bodies except classes, other modules, or constant definitions.

        The documentation requirement is annulled if the class or module has a "#:nodoc:" comment next to it. Likewise, "#:nodoc: all" does the same for all its children.

        Example:

        # bad
        class Person
          # ...
        end
        
        # good
        # Description/Explanation of Person class
        class Person
          # ...
        end

        Space missing inside }.
        Open

            scope :tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Use next to skip iteration.
        Open

                  if ActiveRecord::Base.connection.table_exists?("goldencobra_uploads") && Goldencobra::Upload.respond_to?(:attachment_definitions)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use next to skip iteration instead of a condition at the end.

        Example: EnforcedStyle: skipmodifierifs (default)

        # bad
        [1, 2].each do |a|
          if a == 1
            puts a
          end
        end
        
        # good
        [1, 2].each do |a|
          next unless a == 1
          puts a
        end
        
        # good
        [1, 2].each do |o|
          puts o unless o == 1
        end

        Example: EnforcedStyle: always

        # With `always` all conditions at the end of an iteration needs to be
        # replaced by next - with `skip_modifier_ifs` the modifier if like
        # this one are ignored: `[1, 2].each { |a| return 'yes' if a == 1 }`
        
        # bad
        [1, 2].each do |o|
          puts o unless o == 1
        end
        
        # bad
        [1, 2].each do |a|
          if a == 1
            puts a
          end
        end
        
        # good
        [1, 2].each do |a|
          next unless a == 1
          puts a
        end

        Space between { and | missing.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Redundant return detected.
        Open

                return self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant return detected.
        Open

              return results
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              self.startpage
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                related_object = self.send(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              av.request = ActionDispatch::Request.new(Rack::MockRequest.env_for(self.public_url))
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Line is too long. [125/100]
        Open

                Goldencobra::Setting.for_key("goldencobra.article.image_positions").to_s.split(",").map(&:strip).each do |image_type|
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [194/100]
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [121/100]
        Open

                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if similar_names.count > 1
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Redundant self detected.
        Open

              return true if self.active_since.present? && self.active_since < Time.now.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                return self.title
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.save
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Space missing to the left of {.
        Open

            scope :tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing to the left of {.
        Open

            scope :fulltext_contains, lambda{ |name| where("content LIKE '%#{name}%' OR teaser LIKE '%#{name}%' OR url_name LIKE '%#{name}%' OR subtitle LIKE '%#{name}%' OR summary LIKE '%#{name}%' OR context_info LIKE '%#{name}%' OR breadcrumb LIKE '%#{name}%'")}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing to the left of {.
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing inside }.
        Open

            scope :latest, lambda{ |counter| order("created_at DESC").limit(counter)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

            scope :frontend_tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :frontend_tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space inside { missing.
        Open

              av.assign({article: self})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that braces used for hash literals have or don't have surrounding space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that hash literals have
        # surrounding space.
        
        # bad
        h = {a: 1, b: 2}
        
        # good
        h = { a: 1, b: 2 }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that hash literals have
        # no surrounding space.
        
        # bad
        h = { a: 1, b: 2 }
        
        # good
        h = {a: 1, b: 2}

        Example: EnforcedStyle: compact

        # The `compact` style normally requires a space inside
        # hash braces, with the exception that successive left
        # braces or right braces are collapsed together in nested hashes.
        
        # bad
        h = { a: { b: 2 } }
        
        # good
        h = { a: { b: 2 }}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces do not contain spaces.
        
        # bad
        foo = { }
        bar = {    }
        
        # good
        foo = {}
        bar = {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # empty hash braces contain space.
        
        # bad
        foo = {}
        
        # good
        foo = { }
        foo = {  }
        foo = {     }

        Line is too long. [126/100]
        Open

            DisplayIndexTypes = [["Einzelseiten und Übersichtsseiten", "all"], ["Einzelseiten", "show"],["Übersichtsseiten", "index"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [134/100]
        Open

              av = ActionView::Base.new(ActionController::Base.view_paths + ["#{::Goldencobra::Engine.root}/app/views/goldencobra/articles/"])
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use SCREAMING_SNAKE_CASE for constants.
        Open

            ImportDataFunctions = []
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether constant names are written using SCREAMINGSNAKECASE.

        To avoid false positives, it ignores cases in which we cannot know for certain the type of value that would be assigned to a constant.

        Example:

        # bad
        InchInCm = 2.54
        INCHinCM = 2.54
        Inch_In_Cm = 2.54
        
        # good
        INCH_IN_CM = 2.54

        Use the return of the conditional for variable assignment and comparison.
        Open

                  if self.articletype.present? && self.articletype.default_template_file.present?
                    self.template_file = self.articletype.default_template_file
                  else
                    self.template_file = "application"
                  end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if related_object && related_object.respond_to?(:custom_rss_fields)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.create_redirection.present? && self.create_redirection.to_i > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :latest, lambda{ |counter| order("created_at DESC").limit(counter)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :frontend_tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :frontend_tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        include is used at the top level. Use inside class or module.
        Open

        include Goldencobra::ApplicationHelper
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that include, extend and prepend statements appear inside classes and modules, not at the top level, so as to not affect the behavior of Object.

        Example:

        # bad
        include M
        
        class C
        end
        
        # bad
        extend M
        
        class C
        end
        
        # bad
        prepend M
        
        class C
        end
        
        # good
        class C
          include M
        end
        
        # good
        class C
          extend M
        end
        
        # good
        class C
          prepend M
        end

        Redundant return detected.
        Open

                return 1000
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

              self.has_children?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.article_type.present? ? self.article_type.split(" ").last : ""
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Missing space after #.
        Open

            #bevor ein Artikle gespeichert wird , wird ein redirector unvollständig erstellt
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #ancestor_ids     Returns a list of ancestor ids, starting with the root id and ending with the parent id
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #child_ids        Returns a list of child ids
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing to the left of {.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing inside }.
        Open

            scope :frontend_tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :frontend_tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space between { and | missing.
        Open

            scope :tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Unused method argument - name. If it's necessary, use _ or _name as an argument name to indicate that it won't be used. You can also write as metatag(*) if you want the method to accept any arguments but don't care about them.
        Open

            def metatag(name)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for unused method arguments.

        Example:

        # bad
        
        def some_method(used, unused, _unused_but_allowed)
          puts used
        end

        Example:

        # good
        
        def some_method(used, _unused, _unused_but_allowed)
          puts used
        end

        Line is too long. [117/100]
        Open

                @list_of_articles = @list_of_articles.tagged_with(self.index_of_articles_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [201/100]
        Open

            # Nachdem ein Artikel gelöscht oder aktualsisiert wurde soll sein Elternelement aktualisiert werden, damit ein rss feed oder ähnliches mitbekommt wenn ein kindeintrag gelöscht oder bearbeitet wurde
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Pass __FILE__ and __LINE__ to eval method, as they are used by backtraces.
        Open

                  @list_of_articles = @list_of_articles.sort_by { |a| eval("a.#{sorter}") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks eval method usage. eval can receive source location metadata, that are filename and line number. The metadata is used by backtraces. This cop recommends to pass the metadata to eval method.

        Example:

        # bad
        eval <<-RUBY
          def do_something
          end
        RUBY
        
        # bad
        C.class_eval <<-RUBY
          def do_something
          end
        RUBY
        
        # good
        eval <<-RUBY, binding, __FILE__, __LINE__ + 1
          def do_something
          end
        RUBY
        
        # good
        C.class_eval <<-RUBY, __FILE__, __LINE__ + 1
          def do_something
          end
        RUBY

        Freeze mutable objects assigned to constants.
        Open

            DisplayIndexTypes = [["Einzelseiten und Übersichtsseiten", "all"], ["Einzelseiten", "show"],["Übersichtsseiten", "index"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

        Example:

        # bad
        CONST = [1, 2, 3]
        
        # good
        CONST = [1, 2, 3].freeze
        
        # good
        CONST = <<~TESTING.freeze
        This is a heredoc
        TESTING

        Freeze mutable objects assigned to constants.
        Open

            ImportDataFunctions = []
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

        Example:

        # bad
        CONST = [1, 2, 3]
        
        # good
        CONST = [1, 2, 3].freeze
        
        # good
        CONST = <<~TESTING.freeze
        This is a heredoc
        TESTING

        Redundant self detected.
        Open

              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Extra blank line detected.
        Open

        
            # returns article type name without index/show
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Missing space after #.
        Open

            #der menue.title hat folgende vorgaben: validates_format_of :title, with: /^[\w\d\?\.\'\!\s&üÜöÖäÄß\-\:\,\"]+$/
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

                #url_path in der Datenbank als string speichern und beim update von ancestry neu berechnen... ansonsten den urlpath aus dem string holen statt jedesmal über alle eltern zu iterieren
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing to the left of {.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Space missing inside }.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Unused method argument - auth_object. If it's necessary, use _ or _auth_object as an argument name to indicate that it won't be used. You can also write as ransackable_scopes(*) if you want the method to accept any arguments but don't care about them.
        Open

            def self.ransackable_scopes(auth_object = nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for unused method arguments.

        Example:

        # bad
        
        def some_method(used, unused, _unused_but_allowed)
          puts used
        end

        Example:

        # good
        
        def some_method(used, _unused, _unused_but_allowed)
          puts used
        end

        Line is too long. [123/100]
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [194/100]
        Open

            scope :for_sitemap, -> { includes(:images).where('dynamic_redirection = "false" AND ( external_url_redirect IS NULL OR external_url_redirect = "") AND active = 1 AND robots_no_index =  0') }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Missing space after #.
        Open

        #has_siblings?    Returns true if the record's parent has more than one child
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Line is too long. [115/100]
        Open

            #der menue.title hat folgende vorgaben: validates_format_of :title, with: /^[\w\d\?\.\'\!\s&üÜöÖäÄß\-\:\,\"]+$/
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Space missing after comma.
        Open

            DynamicRedirectOptions = [[:false,"deaktiviert"],[:latest,"neuester Untereintrag"], [:oldest, "ältester Untereintrag"]]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Line is too long. [135/100]
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [110/100]
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Space missing after comma.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for comma (,) not followed by some kind of space.

        Example:

        # bad
        [1,2]
        { foo:bar,}
        
        # good
        [1, 2]
        { foo:bar, }

        Line is too long. [151/100]
        Open

              if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") && ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") && ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Use the -> { ... } lambda literal syntax for single line lambdas.
        Open

            scope :fulltext_contains, lambda{ |name| where("content LIKE '%#{name}%' OR teaser LIKE '%#{name}%' OR url_name LIKE '%#{name}%' OR subtitle LIKE '%#{name}%' OR summary LIKE '%#{name}%' OR context_info LIKE '%#{name}%' OR breadcrumb LIKE '%#{name}%'")}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop (by default) checks for uses of the lambda literal syntax for single line lambdas, and the method call syntax for multiline lambdas. It is configurable to enforce one of the styles for both single line and multiline lambdas as well.

        Example: EnforcedStyle: linecountdependent (default)

        # bad
        f = lambda { |x| x }
        f = ->(x) do
              x
            end
        
        # good
        f = ->(x) { x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: lambda

        # bad
        f = ->(x) { x }
        f = ->(x) do
              x
            end
        
        # good
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end

        Example: EnforcedStyle: literal

        # bad
        f = lambda { |x| x }
        f = lambda do |x|
              x
            end
        
        # good
        f = ->(x) { x }
        f = ->(x) do
              x
            end

        Freeze mutable objects assigned to constants.
        Open

            SortOptions = ["Created_at", "Updated_at", "Random", "Alphabetically", "GlobalSortID"]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether some constant value isn't a mutable literal (e.g. array or hash).

        Example:

        # bad
        CONST = [1, 2, 3]
        
        # good
        CONST = [1, 2, 3].freeze
        
        # good
        CONST = <<~TESTING.freeze
        This is a heredoc
        TESTING

        Favor unless over if for negative conditions.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for uses of if with a negated condition. Only ifs without else are considered. There are three different styles:

        - both
        - prefix
        - postfix

        Example: EnforcedStyle: both (default)

        # enforces `unless` for `prefix` and `postfix` conditionals
        
        # bad
        
        if !foo
          bar
        end
        
        # good
        
        unless foo
          bar
        end
        
        # bad
        
        bar if !foo
        
        # good
        
        bar unless foo

        Example: EnforcedStyle: prefix

        # enforces `unless` for just `prefix` conditionals
        
        # bad
        
        if !foo
          bar
        end
        
        # good
        
        unless foo
          bar
        end
        
        # good
        
        bar if !foo

        Example: EnforcedStyle: postfix

        # enforces `unless` for just `postfix` conditionals
        
        # bad
        
        bar if !foo
        
        # good
        
        bar unless foo
        
        # good
        
        if !foo
          bar
        end

        Line is too long. [163/100]
        Open

              html_to_render = av.render(template: "/goldencobra/articles/show.html.erb", layout: "layouts/#{layoutfile}", locals: localparams, content_type: "text/html" )
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Redundant return detected.
        Open

                  return "#{Goldencobra::Domain.current.try(:url_prefix)}/"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Line is too long. [158/100]
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Redundant self detected.
        Open

                  self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant curly braces around a hash parameter.
        Open

              av.assign({article: self})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

        Example: EnforcedStyle: braces

        # The `braces` style enforces braces around all method
        # parameters that are hashes.
        
        # bad
        some_method(x, y, a: 1, b: 2)
        
        # good
        some_method(x, y, {a: 1, b: 2})

        Example: EnforcedStyle: no_braces (default)

        # The `no_braces` style checks that the last parameter doesn't
        # have braces around it.
        
        # bad
        some_method(x, y, {a: 1, b: 2})
        
        # good
        some_method(x, y, a: 1, b: 2)

        Example: EnforcedStyle: context_dependent

        # The `context_dependent` style checks that the last parameter
        # doesn't have braces around it, but requires braces if the
        # second to last parameter is also a hash literal.
        
        # bad
        some_method(x, y, {a: 1, b: 2})
        some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)
        
        # good
        some_method(x, y, a: 1, b: 2)
        some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

        Redundant self detected.
        Open

              related_object = self.get_related_object
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

                if reverse_sort
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        When using method_missing, define respond_to_missing?.
        Open

            def method_missing(meth, *args, &block)
              if meth.to_s.split(".").first == self.get_related_object.class.name.downcase
                if meth.to_s.split(".").count == 1
                  self.get_related_object
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for the presence of method_missing without also defining respond_to_missing?.

        Example:

        #bad
        def method_missing(name, *args)
          # ...
        end
        
        #good
        def respond_to_missing?(name, include_private)
          # ...
        end
        
        def method_missing(name, *args)
          # ...
        end

        Redundant self detected.
        Open

                self.article_for_index_count.to_i
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? &&
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.teaser if self.teaser.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.summary if self.teaser.blank? && self.summary.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.created_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.try(:authors).try(:first)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Use empty lines between method definitions.
        Open

            def index_articles(current_operator=nil, user_frontend_tags=nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether method definitions are separated by one empty line.

        NumberOfEmptyLines can be an integer (default is 1) or an array (e.g. [1, 2]) to specify a minimum and maximum number of empty lines permitted.

        AllowAdjacentOneLineDefs configures whether adjacent one-line method definitions are considered an offense.

        Example:

        # bad
        def a
        end
        def b
        end

        Example:

        # good
        def a
        end
        
        def b
        end

        Extra blank line detected.
        Open

        
            def absolute_public_url
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks for two or more consecutive blank lines.

        Example:

        # bad - It has two empty lines.
        some_method
        # one empty line
        # two empty lines
        some_method
        
        # good
        some_method
        # one empty line
        some_method

        Missing space after #.
        Open

                      #Ansosnten einen Raketask damit starten
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Block argument expression is not on the same line as the block start.
        Open

                  |a| [a.parent_path, a.id]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether the multiline do end blocks have a newline after the start of the block. Additionally, it checks whether the block arguments, if any, are on the same line as the start of the block.

        Example:

        # bad
        blah do |i| foo(i)
          bar(i)
        end
        
        # bad
        blah do
          |i| foo(i)
          bar(i)
        end
        
        # good
        blah do |i|
          foo(i)
          bar(i)
        end
        
        # bad
        blah { |i| foo(i)
          bar(i)
        }
        
        # good
        blah { |i|
          foo(i)
          bar(i)
        }

        Space missing to the left of {.
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        Put one space between the method name and the first argument.
        Open

            web_url         :external_url_redirect
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that exactly one space is used between a method name and the first argument for method calls without parentheses.

        Alternatively, extra spaces can be added to align the argument with something on a preceding or following line, if the AllowForAlignment config parameter is true.

        Example:

        # bad
        something  x
        something   y, z
        something'hello'
        
        # good
        something x
        something y, z
        something 'hello'

        Space missing inside }.
        Open

            scope :articletype, lambda{ |name| where(article_type: name)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space missing inside }.
        Open

            scope :fulltext_contains, lambda{ |name| where("content LIKE '%#{name}%' OR teaser LIKE '%#{name}%' OR url_name LIKE '%#{name}%' OR subtitle LIKE '%#{name}%' OR summary LIKE '%#{name}%' OR context_info LIKE '%#{name}%' OR breadcrumb LIKE '%#{name}%'")}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Space missing inside }.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have surrounding space inside them on configuration. For blocks taking parameters, it checks that the left brace has or doesn't have trailing space depending on configuration.

        Example: EnforcedStyle: space (default)

        # The `space` style enforces that block braces have
        # surrounding space.
        
        # bad
        some_array.each {puts e}
        
        # good
        some_array.each { puts e }

        Example: EnforcedStyle: no_space

        # The `no_space` style enforces that block braces don't
        # have surrounding space.
        
        # bad
        some_array.each { puts e }
        
        # good
        some_array.each {puts e}

        Example: EnforcedStyleForEmptyBraces: no_space (default)

        # The `no_space` EnforcedStyleForEmptyBraces style enforces that
        # block braces don't have a space in between when empty.
        
        # bad
        some_array.each {   }
        some_array.each {  }
        some_array.each { }
        
        # good
        some_array.each {}

        Example: EnforcedStyleForEmptyBraces: space

        # The `space` EnforcedStyleForEmptyBraces style enforces that
        # block braces have at least a space in between when empty.
        
        # bad
        some_array.each {}
        
        # good
        some_array.each { }
        some_array.each {  }
        some_array.each {   }

        Example: SpaceBeforeBlockParameters: true (default)

        # The SpaceBeforeBlockParameters style set to `true` enforces that
        # there is a space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each {|n| n * 2 }
        
        # good
        [1, 2, 3].each { |n| n * 2 }

        Example: SpaceBeforeBlockParameters: false

        # The SpaceBeforeBlockParameters style set to `false` enforces that
        # there is no space between `{` and `|`. Overrides `EnforcedStyle`
        # if there is a conflict.
        
        # bad
        [1, 2, 3].each { |n| n * 2 }
        
        # good
        [1, 2, 3].each {|n| n * 2 }

        Line is too long. [141/100]
        Open

            has_many :permissions, -> { where subject_class: "Goldencobra::Article" }, class_name: Goldencobra::Permission, foreign_key: "subject_id"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Line is too long. [110/100]
        Open

            scope :frontend_tag_name_contains, lambda{|tag_name| tagged_with(tag_name.split(","), on: :frontend_tags)}
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use the return of the conditional for variable assignment and comparison.
        Open

                if self.article_images.any? && self.article_images.first.present? &&
                   self.article_images.first.image.present? &&
                   self.article_images.first.image.image.present?
                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
                else
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.url_name.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

                if r.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Redundant return detected.
        Open

              return old_result
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant return detected.
        Open

                return self.title
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

                related_object = self.get_related_object
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.articletype.present? && self.articletype.default_template_file.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.created_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Extra empty line detected at method body beginning.
        Open

        
            end
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cops checks if empty lines exist around the bodies of methods.

        Example:

        # good
        
        def foo
          # ...
        end
        
        # bad
        
        def bar
        
          # ...
        
        end

        Missing space after #.
        Open

            acts_as_taggable_on :tags, :frontend_tags #https://github.com/mbleigh/acts-as-taggable-on
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Missing space after #.
        Open

        #subtree          Scopes the model on descendants and itself
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether comments have a leading space after the # denoting the start of the comment. The leading space is not required for some RDoc special syntax, like #++, #--, #:nodoc, =begin- and =end comments, "shebang" directives, or rackup options.

        Example:

        # bad
        #Some comment
        
        # good
        # Some comment

        Space missing to the left of {.
        Open

                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks that block braces have or don't have a space before the opening brace depending on configuration.

        Example: EnforcedStyle: space (default)

        # bad
        foo.map{ |a|
          a.bar.to_s
        }
        
        # good
        foo.map { |a|
          a.bar.to_s
        }

        Example: EnforcedStyle: no_space

        # bad
        foo.map { |a|
          a.bar.to_s
        }
        
        # good
        foo.map{ |a|
          a.bar.to_s
        }

        private (on line 891) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
        Open

            def self.ransackable_scopes(auth_object = nil)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for private or protected access modifiers which are applied to a singleton method. These access modifiers do not make singleton methods private/protected. private_class_method can be used for that.

        Example:

        # bad
        
        class C
          private
        
          def self.method
            puts 'hi'
          end
        end

        Example:

        # good
        
        class C
          def self.method
            puts 'hi'
          end
        
          private_class_method :method
        end

        Example:

        # good
        
        class C
          class << self
            private
        
            def method
              puts 'hi'
            end
          end
        end

        Line is too long. [189/100]
        Open

                #url_path in der Datenbank als string speichern und beim update von ancestry neu berechnen... ansonsten den urlpath aus dem string holen statt jedesmal über alle eltern zu iterieren
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the length of lines in the source code. The maximum length is configurable. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Use SCREAMING_SNAKE_CASE for constants.
        Open

            SortOptions = ["Created_at", "Updated_at", "Random", "Alphabetically", "GlobalSortID"]
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks whether constant names are written using SCREAMINGSNAKECASE.

        To avoid false positives, it ignores cases in which we cannot know for certain the type of value that would be assigned to a constant.

        Example:

        # bad
        InchInCm = 2.54
        INCHinCM = 2.54
        Inch_In_Cm = 2.54
        
        # good
        INCH_IN_CM = 2.54

        Use compact module/class definition instead of nested style.
        Open

        module Goldencobra
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks the style of children definitions at classes and modules. Basically there are two different styles:

        Example: EnforcedStyle: nested (default)

        # good
        # have each child on its own line
        class Foo
          class Bar
          end
        end

        Example: EnforcedStyle: compact

        # good
        # combine definitions as much as possible
        class Foo::Bar
        end

        The compact style is only forced for classes/modules with one child.

        Use a guard clause instead of wrapping the code inside a conditional expression.
        Open

              if self.article_for_index_count.to_i <= 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use a guard clause instead of wrapping the code inside a conditional expression

        Example:

        # bad
        def test
          if something
            work
          end
        end
        
        # good
        def test
          return unless something
          work
        end
        
        # also good
        def test
          work if something
        end
        
        # bad
        if something
          raise 'exception'
        else
          ok
        end
        
        # good
        raise 'exception' if something
        ok

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

              if self.title.blank? && self.breadcrumb.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Favor modifier if usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
        Open

              if self.parent.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop. The tab size is configured in the IndentationWidth of the Layout/Tab cop.

        Example:

        # bad
        if condition
          do_stuff(bar)
        end
        
        unless qux.empty?
          Foo.do_something
        end
        
        # good
        do_stuff(bar) if condition
        Foo.do_something unless qux.empty?

        Redundant begin block detected.
        Open

              begin
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant begin blocks.

        Currently it checks for code like this:

        Example:

        # bad
        def redundant
          begin
            ala
            bala
          rescue StandardError => e
            something
          end
        end
        
        # good
        def preferred
          ala
          bala
        rescue StandardError => e
          something
        end
        
        # bad
        # When using Ruby 2.5 or later.
        do_something do
          begin
            something
          rescue => ex
            anything
          end
        end
        
        # good
        # In Ruby 2.5 or later, you can omit `begin` in `do-end` block.
        do_something do
          something
        rescue => ex
          anything
        end

        Redundant return detected.
        Open

                return nil
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant return detected.
        Open

              return list.where('goldencobra_articles.id in (?)', new_list)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant return detected.
        Open

                return self.breadcrumb
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant return expressions.

        Example:

        # These bad cases should be extended to handle methods whose body is
        # if/else or a case expression with a default branch.
        
        # bad
        def test
          return something
        end
        
        # bad
        def test
          one
          two
          three
          return something
        end
        
        # good
        def test
          return something if something_else
        end
        
        # good
        def test
          if x
          elsif y
          else
          end
        end

        Redundant self detected.
        Open

                if self.children.order("updated_at DESC").first.updated_at.utc > self.updated_at.utc
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return self.content[0..200] if self.teaser.blank? && self.summary.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.article_type.present? && self.article_type_form_file.present? && self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.descendants.order("id DESC").first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                @list_of_articles = @list_of_articles.tagged_with(self.index_of_articles_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                @list_of_articles = @list_of_articles.tagged_with(self.not_tagged_with.split(",").map(&:strip),
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.title.blank? && self.breadcrumb.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Use %i or %I for an array of symbols.
        Open

              [
                :parent_ids_in,
                :frontend_tag_name_contains, :frontend_tag_name_equals, :frontend_tag_name_starts_with, :frontend_tag_name_ends_with,
                :tag_name_contains, :tag_name_equals, :tag_name_starts_with, :tag_name_ends_with,
                :fulltext_contains, :fulltext_equals, :fulltext_starts_with, :fulltext_ends_with,
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop can check for array literals made up of symbols that are not using the %i() syntax.

        Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

        Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

        Example: EnforcedStyle: percent (default)

        # good
        %i[foo bar baz]
        
        # bad
        [:foo, :bar, :baz]

        Example: EnforcedStyle: brackets

        # good
        [:foo, :bar, :baz]
        
        # bad
        %i[foo bar baz]

        Redundant self detected.
        Open

              if self.title.blank? && self.breadcrumb.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.title = self.breadcrumb
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                   self.article_images.first.image.image.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  custom_children = Goldencobra::Article.where(ancestry: "#{self.ancestry}/#{self.id}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.url_name = [self.url_name, last_used_number + 1].join("--")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  a_url = self.url_path
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

              return list.where('goldencobra_articles.id in (?)', new_list)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Redundant self detected.
        Open

                  custom_children = Goldencobra::Article.where(ancestry: "#{self.ancestry}/#{self.id}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Use %i or %I for an array of symbols.
        Open

                Goldencobra::Article.select([:id, :ancestry, :url_name]).map do
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop can check for array literals made up of symbols that are not using the %i() syntax.

        Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

        Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

        Example: EnforcedStyle: percent (default)

        # good
        %i[foo bar baz]
        
        # bad
        [:foo, :bar, :baz]

        Example: EnforcedStyle: brackets

        # good
        [:foo, :bar, :baz]
        
        # bad
        %i[foo bar baz]

        Use %i or %I for an array of symbols.
        Open

              "/#{self.path.select([:ancestry, :url_name, :startpage, :id]).map{|a| a.url_name if !a.startpage}.compact.join("/")}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop can check for array literals made up of symbols that are not using the %i() syntax.

        Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

        Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

        Example: EnforcedStyle: percent (default)

        # good
        %i[foo bar baz]
        
        # bad
        [:foo, :bar, :baz]

        Example: EnforcedStyle: brackets

        # good
        [:foo, :bar, :baz]
        
        # bad
        %i[foo bar baz]

        Redundant self detected.
        Open

              self.update_column(:url_path, self.get_url_from_path)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Use double pipes || instead.
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for unnecessary conditional expressions.

        Example:

        # bad
        a = b ? b : c
        
        # good
        a = b || c

        Example:

        # bad
        if b
          b
        else
          c
        end
        
        # good
        b || c
        
        # good
        if b
          b
        elsif cond
          c
        end

        Redundant self detected.
        Open

                self.update_columns(article_for_index_id: self.id)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Pass &:blank? as an argument to delete_if instead of a block.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use symbols as procs when possible.

        Example:

        # bad
        something.map { |s| s.upcase }
        
        # good
        something.map(&:upcase)

        Redundant self detected.
        Open

              if self.dynamic_redirection == "latest"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.url_name = self.breadcrumb.urlize(downcase: true, convert_spaces: true).gsub("_", "-")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.update_columns(article_for_index_id: self.id)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.parent.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.update_column(:article_for_index_id, self.id)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.update_column(:article_for_index_id, self.id)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && self.active_changed? && self.descendants.any?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.create_redirection.present? && self.create_redirection.to_i > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.parent.update_attributes(updated_at: Time.now)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.active_since = self.created_at
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                   self.article_images.first.image.present? &&
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  if self.articletype.present? && self.articletype.default_template_file.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings inside interpolations.
        Open

              article_path = "/#{url.split('.').first}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        The use of eval is a serious security risk.
        Open

                return eval("self.#{method_name}.present?")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for the use of Kernel#eval and Binding#eval.

        Example:

        # bad
        
        eval(something)
        binding.eval(something)

        Redundant self detected.
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.article_images.any? && self.article_images.first.present? &&
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return unless self.kind_of_article_type == "Index"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                  title: article ? article.title : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Pass &:strip as an argument to map instead of a block.
        Open

              if current_operator && current_operator.respond_to?(:has_role?) && current_operator.has_role?(Goldencobra::Setting.for_key("goldencobra.article.preview.roles").split(",").map{|a| a.strip})
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use symbols as procs when possible.

        Example:

        # bad
        something.map { |s| s.upcase }
        
        # good
        something.map(&:upcase)

        Redundant self detected.
        Open

                self.descendants.order("id ASC").first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.create_redirection.present? && self.create_redirection.to_i > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.path.map(&:url_name).join("/")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Use double pipes || instead.
        Open

                  ancestry: article.ancestry ? article.ancestry : ''
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for unnecessary conditional expressions.

        Example:

        # bad
        a = b ? b : c
        
        # good
        a = b || c

        Example:

        # bad
        if b
          b
        else
          c
        end
        
        # good
        b || c
        
        # good
        if b
          b
        elsif cond
          c
        end

        Redundant self detected.
        Open

              if self.article_for_index_id.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path_changed?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              self.update_column(:url_path, self.get_url_from_path)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.startpage
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                  teaser: article ? article.teaser : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Prefer double-quoted strings inside interpolations.
        Open

            scope :active, -> { where("active = 1 AND active_since < '#{Time.now.strftime('%Y-%m-%d %H:%M:%S ')}'") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks that quotes inside the string interpolation match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        result = "Tests #{success ? "PASS" : "FAIL"}"
        
        # good
        result = "Tests #{success ? 'PASS' : 'FAIL'}"

        Example: EnforcedStyle: double_quotes

        # bad
        result = "Tests #{success ? 'PASS' : 'FAIL'}"
        
        # good
        result = "Tests #{success ? "PASS" : "FAIL"}"

        Prefer to_s over string interpolation.
        Open

                @list_of_articles = @list_of_articles.includes("#{self.article_type_form_file.underscore.parameterize.downcase}")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for strings that are just an interpolated expression.

        Example:

        # bad
        "#{@var}"
        
        # good
        @var.to_s
        
        # good if @var is already a String
        @var

        Use !empty? instead of length > 0.
        Open

              if self.children.length > 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for numeric comparisons that can be replaced by a predicate method, such as receiver.length == 0, receiver.length > 0, receiver.length != 0, receiver.length < 1 and receiver.size == 0 that can be replaced by receiver.empty? and !receiver.empty.

        Example:

        # bad
        [1, 2, 3].length == 0
        0 == "foobar".length
        array.length < 1
        {a: 1, b: 2}.length != 0
        string.length > 0
        hash.size > 0
        
        # good
        [1, 2, 3].empty?
        "foobar".empty?
        array.empty?
        !{a: 1, b: 2}.empty?
        !string.empty?
        !hash.empty?

        Redundant self detected.
        Open

                parent_article = Goldencobra::Article.where(id: self.article_for_index_id).select(:id, :ancestry).first
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  og_img_val = "#{self.absolute_base_url}#{self.article_images.first.image.image.url}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.url_name.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              return if self.article_for_index_id.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                Goldencobra::Redirector.where(source_url: self.absolute_public_url).destroy_all
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                r = Goldencobra::Redirector.find_by_id(self.create_redirection)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && self.active_changed? && self.descendants.any?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        The use of eval is a serious security risk.
        Open

                  @list_of_articles = @list_of_articles.sort_by { |a| eval("a.#{sorter}") }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for the use of Kernel#eval and Binding#eval.

        Example:

        # bad
        
        eval(something)
        binding.eval(something)

        Redundant self detected.
        Open

              if self.respond_to?(self.article_type_form_file.underscore.parameterize.downcase)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  unless self.index_of_articles_descendents_depth == "all"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path_change[0]}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.respond_to?(:image_gallery_tags)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.not_tagged_with.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              modified_hours_since = ((Time.now - self.created_at) / 1.hour).round
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if self.metatag_open_graph_image.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  old_url = "#{self.absolute_base_url}#{Goldencobra::Domain.current.try(:url_prefix)}#{self.url_path}"
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                    self.template_file = self.articletype.default_template_file
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Redundant self detected.
        Open

                  r.target_url = self.absolute_public_url
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.template_file.blank?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  if self.articletype.present? && self.articletype.default_template_file.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Redundant self detected.
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                  parent_title: article.parent ? article.parent.title ? article.parent.title : '' : '',
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Redundant self detected.
        Open

              similar_names = self.siblings.pluck(:url_name).select{|c| c.split("--")[0] == self.url_name }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && self.active_changed? && self.descendants.any?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.descendants.map{ |d| d.update_column(:active, self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Avoid rescuing without specifying an error class.
        Open

              rescue
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for rescuing StandardError. There are two supported styles implicit and explicit. This cop will not register an offense if any error other than StandardError is specified.

        Example: EnforcedStyle: implicit

        # `implicit` will enforce using `rescue` instead of
        # `rescue StandardError`.
        
        # bad
        begin
          foo
        rescue StandardError
          bar
        end
        
        # good
        begin
          foo
        rescue
          bar
        end
        
        # good
        begin
          foo
        rescue OtherError
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError, SecurityError
          bar
        end

        Example: EnforcedStyle: explicit (default)

        # `explicit` will enforce using `rescue StandardError`
        # instead of `rescue`.
        
        # bad
        begin
          foo
        rescue
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError
          bar
        end
        
        # good
        begin
          foo
        rescue OtherError
          bar
        end
        
        # good
        begin
          foo
        rescue StandardError, SecurityError
          bar
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                      file_name = [name.titleize.gsub(' ',''), sub_name.gsub('_','').titleize].join(" ") if File.exist?(File.join(file_name_path,sub_name)) && (sub_name =~ /^_(?!edit).*/) == 0
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        Pass &:url_path_changed? as an argument to map instead of a block.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Use symbols as procs when possible.

        Example:

        # bad
        something.map { |s| s.upcase }
        
        # good
        something.map(&:upcase)

        Redundant self detected.
        Open

              if self.index_of_articles_tagged_with.present?
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.article_images.any? && self.article_images.first.present? &&
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                if self.url_path.blank? || self.url_path_changed? || self.url_name_changed? || self.ancestry_changed? || self.ancestors.map{ |a| a.url_path_changed? }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  self.descendants.map{ |d| d.update_columns(active: self.active) }
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                    @list_of_articles = @list_of_articles.to_depth(current_depth + self.index_of_articles_descendents_depth.to_i)
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

              if !self.new_record? && (self.url_path_changed? || self.url_name_changed? || self.ancestry_changed?) && modified_hours_since > 24
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                      system("cd #{::Rails.root} && RAILS_ENV=#{::Rails.env} bundle exec rake article_cache:recreate ID=#{self.id} &")
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                self.image_gallery_tags = self.image_gallery_tags.compact.delete_if{|a| a.blank?}.join(",") if self.image_gallery_tags.class == Array
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Redundant self detected.
        Open

                  a_url = self.get_url_from_path
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        This cop checks for redundant uses of self.

        The usage of self is only needed when:

        • Sending a message to same object with zero arguments in presence of a method name clash with an argument or a local variable.

        • Calling an attribute writer to prevent an local variable assignment.

        Note, with using explicit self you can only send messages with public or protected scope, you cannot send private messages this way.

        Note we allow uses of self with operators because it would be awkward otherwise.

        Example:

        # bad
        def foo(bar)
          self.baz
        end
        
        # good
        def foo(bar)
          self.bar  # Resolves name clash with the argument.
        end
        
        def foo
          bar = 1
          self.bar  # Resolves name clash with the local variable.
        end
        
        def foo
          %w[x y z].select do |bar|
            self.bar == bar  # Resolves name clash with argument of the block.
          end
        end

        Prefer double-quoted strings unless you need single quotes to avoid extra backslashes for escaping.
        Open

                  ancestry: article.ancestry ? article.ancestry : ''
        Severity: Minor
        Found in app/models/goldencobra/article.rb by rubocop

        Checks if uses of quotes match the configured preference.

        Example: EnforcedStyle: single_quotes (default)

        # bad
        "No special symbols"
        "No string interpolation"
        "Just text"
        
        # good
        'No special symbols'
        'No string interpolation'
        'Just text'
        "Wait! What's #{this}!"

        Example: EnforcedStyle: double_quotes

        # bad
        'Just some text'
        'No special chars or interpolation'
        
        # good
        "Just some text"
        "No special chars or interpolation"
        "Every string in #{project} uses double_quotes"

        There are no issues that match your filters.

        Category
        Status