ikuseiGmbH/Goldencobra

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

Summary

Maintainability
A
1 hr
Test Coverage

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

    def self.reset_to_default
      if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") &&
         ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
        Goldencobra::Article.article_types_for_select.each do |at|
          if Goldencobra::Articletype.find_by_name(at).blank?

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 create_fieldgroup has 9 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def self.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)
Severity: Major
Found in app/models/goldencobra/articletype.rb - About 1 hr to fix

    Goldencobra::Articletype#self.reset_field_blocks_for has approx 6 statements
    Open

        def self.reset_field_blocks_for(articletype)
    Severity: Minor
    Found in app/models/goldencobra/articletype.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::Articletype#self.create_fieldgroup has 9 parameters
    Open

        def self.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)
    Severity: Minor
    Found in app/models/goldencobra/articletype.rb by reek

    A Long Parameter List occurs when a method has a lot of parameters.

    Example

    Given

    class Dummy
      def long_list(foo,bar,baz,fling,flung)
        puts foo,bar,baz,fling,flung
      end
    end

    Reek would report the following warning:

    test.rb -- 1 warning:
      [2]:Dummy#long_list has 5 parameters (LongParameterList)

    A common solution to this problem would be the introduction of parameter objects.

    Avoid parameter lists longer than 5 parameters. [9/5]
    Open

        def self.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)

    This cop checks for methods with too many parameters. The maximum number of parameters is configurable. Keyword arguments can optionally be excluded from the total count.

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

        def self.reset_to_default
          if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") &&
             ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
            Goldencobra::Article.article_types_for_select.each do |at|
              if Goldencobra::Articletype.find_by_name(at).blank?
    Severity: Minor
    Found in app/models/goldencobra/articletype.rb - About 35 mins to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Goldencobra::Articletype has no descriptive comment
    Open

      class Articletype < ActiveRecord::Base
    Severity: Minor
    Found in app/models/goldencobra/articletype.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::Articletype#self.reset_to_default calls 'ActiveRecord::Base.connection' 3 times
    Open

          if ActiveRecord::Base.connection.table_exists?("goldencobra_articles") &&
             ActiveRecord::Base.connection.table_exists?("goldencobra_articletypes")
            Goldencobra::Article.article_types_for_select.each do |at|
              if Goldencobra::Articletype.find_by_name(at).blank?
                Goldencobra::Articletype.create(name: at, default_template_file: "application")
    Severity: Minor
    Found in app/models/goldencobra/articletype.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::Articletype#set_defaults doesn't depend on instance state (maybe move it to another class?)
    Open

        def set_defaults
    Severity: Minor
    Found in app/models/goldencobra/articletype.rb by reek

    A Utility Function is any instance method that has no dependency on the state of the instance.

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_widget_block(at)

    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. [135/100]
    Open

            new_a = at.fieldgroups.create(title: "Index", position: "first_block", foldable: true, closed: false, expert: false, sorter: 2)

    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. [132/100]
    Open

                              "index__display_index_types", "index__display_index_articletypes", "index__index_of_articles_tagged_with",

    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.

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_media_block(at)

    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. [106/100]
    Open

        has_many :articles, class_name: "Goldencobra::Article", foreign_key: :article_type, primary_key: :name

    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 2 (not 0) spaces for rails indentation.
    Open

        def self.reset_field_blocks_for(articletype)

    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

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)

    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

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_field_blocks_for(articletype)

    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

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_index_block(at)

    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

    Useless private access modifier.
    Open

        private

    This cop checks for redundant access modifiers, including those with no code, those which are repeated, and leading public modifiers in a class or module body. Conditionally-defined methods are considered as always being defined, and thus access modifiers guarding such methods are not redundant.

    Example:

    class Foo
      public # this is redundant (default access is public)
    
      def method
      end
    
      private # this is not redundant (a method is defined)
      def method2
      end
    
      private # this is redundant (no following methods are defined)
    end

    Example:

    class Foo
      # The following is not redundant (conditionally defined methods are
      # considered as always defining a method)
      private
    
      if condition?
        def method
        end
      end
    
      protected # this is not redundant (method is defined)
    
      define_method(:method2) do
      end
    
      protected # this is redundant (repeated from previous modifier)
    
      [1,2,3].each do |i|
        define_method("foo#{i}") do
        end
      end
    
      # The following is redundant (methods defined on the class'
      # singleton class are not affected by the public modifier)
      public
    
      def self.method3
      end
    end

    Example:

    # Lint/UselessAccessModifier:
    #   ContextCreatingMethods:
    #     - concerning
    require 'active_support/concern'
    class Foo
      concerning :Bar do
        def some_public_method
        end
    
        private
    
        def some_private_method
        end
      end
    
      # this is not redundant because `concerning` created its own context
      private
    
      def some_other_private_method
      end
    end

    Example:

    # Lint/UselessAccessModifier:
    #   MethodCreatingMethods:
    #     - delegate
    require 'active_support/core_ext/module/delegation'
    class Foo
      # this is not redundant because `delegate` creates methods
      private
    
      delegate :method_a, to: :method_b
    end

    Line is too long. [137/100]
    Open

          new_a = at.fieldgroups.create(title: "Allgemein", position: "first_block", foldable: true, closed: false, expert: false, sorter: 1)

    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.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)

    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

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_common_block(at)

    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. [129/100]
    Open

                              "external_url_redirect", "redirect_link_title", "redirection_target_in_new_window", "state", "creator"]

    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

                              "index__not_tagged_with", "index__sorter_limit","index__sort_order","index__reverse_sort"]

    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. [116/100]
    Open

                              "index__not_tagged_with", "index__sorter_limit","index__sort_order","index__reverse_sort"]

    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.reset_common_block(at)

    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

    Method parameter must be at least 3 characters long.
    Open

        def self.reset_index_block(at)

    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

    Method parameter must be at least 3 characters long.
    Open

        def self.reset_widget_block(at)

    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

    Line is too long. [139/100]
    Open

          new_a = at.fieldgroups.create(title: "Einstellungen", position: "last_block", foldable: true, closed: true, expert: false, sorter: 5)

    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.reset_meta_block(at)

    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

    Extra blank line detected.
    Open

    
        def self.reset_field_blocks_for(articletype)

    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

    Line is too long. [142/100]
    Open

          new_a = at.fieldgroups.create(title: "Metadescriptions", position: "last_block", foldable: true, closed: true, expert: false, sorter: 3)

    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.

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_meta_block(at)

    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

    Use SCREAMING_SNAKE_CASE for constants.
    Open

        ArticleFieldOptions = [

    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

    Line is too long. [125/100]
    Open

            index_elements = ["index__display_index_articles", "index__article_for_index_id", "index__article_descendents_depth",

    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. [158/100]
    Open

          metas = ["breadcrumb", "metatag_title_tag", "metatag_meta_description", "metatag_open_graph_title", "metatag_open_graph_description", "robots_no_index"]

    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. [109/100]
    Open

        def self.create_fieldgroup(at, title, position, foldable, closed, expert, sorter, fieldname, fieldsorter)

    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.reset_media_block(at)

    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

    Method parameter must be at least 3 characters long.
    Open

        def self.reset_settings_block(at)

    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

    private (on line 55) does not make singleton methods private. Use private_class_method or private inside a class << self block instead.
    Open

        def self.reset_settings_block(at)

    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. [123/100]
    Open

          setting_elements = ["frontend_tag_list", "url_name", "parent_id", "active_since", "cacheable", "dynamic_redirection",

    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

                              "index__not_tagged_with", "index__sorter_limit","index__sort_order","index__reverse_sort"]

    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. [137/100]
    Open

          new_a = at.fieldgroups.create(title: title, position: position, foldable: foldable, closed: closed, expert: expert, sorter: sorter)

    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.

    Freeze mutable objects assigned to constants.
    Open

        ArticleFieldOptions = [
          :global_sorting_id, :title, :subtitle, :content,
          :teaser, :summary, :tag_list, :frontend_tag_list, :active,
          :active_since, :context_info, :metatags, :metatag_title_tag,
          :metatag_meta_description, :metatag_open_graph_title,

    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

    Use %i or %I for an array of symbols.
    Open

        ArticleFieldOptions = [
          :global_sorting_id, :title, :subtitle, :content,
          :teaser, :summary, :tag_list, :frontend_tag_list, :active,
          :active_since, :context_info, :metatags, :metatag_title_tag,
          :metatag_meta_description, :metatag_open_graph_title,

    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 a guard clause instead of wrapping the code inside a conditional expression.
    Open

          if at.name.include?(" Index")

    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

    Missing top-level class documentation comment.
    Open

      class Articletype < ActiveRecord::Base

    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

    Use a guard clause instead of wrapping the code inside a conditional expression.
    Open

          if articletype.try(:fieldgroups).blank?

    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 compact module/class definition instead of nested style.
    Open

    module Goldencobra

    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.

    There are no issues that match your filters.

    Category
    Status