codebar/planner

View on GitHub

Showing 179 of 191 total issues

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

  def create
    member_type = cookies[:member_type]
    current_service = AuthService.find_by(provider: omnihash[:provider],
                                          uid: omnihash[:uid])

Severity: Minor
Found in app/controllers/auth_services_controller.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

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

    def accept
      user = current_user || @invitation.member
      workshop = @invitation.workshop
      return back_with_message(t('messages.already_rsvped')) if @invitation.attending?

Severity: Minor
Found in app/controllers/concerns/invitation_controller_concerns.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 reject has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def reject
      @workshop = WorkshopPresenter.decorate(@invitation.workshop)
      if @invitation.workshop.date_and_time - 3.5.hours >= Time.zone.now

        if @invitation.attending.eql? false
Severity: Minor
Found in app/controllers/concerns/invitation_controller_concerns.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 mail_args has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def mail_args(member, subject, from_email = 'meetings@codebar.io', cc = '', bcc = '')
Severity: Minor
Found in app/helpers/email_header_helper.rb - About 35 mins to fix

    Method rsvp has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def rsvp
        unless @workshop.available_for_rsvp?
          return redirect_back(
            fallback_location: root_path,
            notice: t('workshops.registration_not_open')
    Severity: Minor
    Found in app/controllers/workshops_controller.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 send_event_emails has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

      def send_event_emails(event, chapter)
        return 'The event is not invitable' unless event.invitable?
    
        invite_coaches_to_event(event, chapter) unless event.audience.eql?('Students')
        invite_students_to_event(event, chapter) unless event.audience.eql?('Coaches')
    Severity: Minor
    Found in app/models/invitation_manager.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

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

      def invite_coaches_to_event(event, chapter)
        chapter_coaches(chapter).each do |coach|
          invitation = Invitation.new(event: event, member: coach, role: 'Coach')
          EventInvitationMailer.invite_coach(event, coach, invitation).deliver_now if invitation.save
    Severity: Minor
    Found in app/models/invitation_manager.rb and 1 other location - About 20 mins to fix
    app/models/invitation_manager.rb on lines 30..33

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

      def invite_students_to_event(event, chapter)
        chapter_students(chapter).each do |student|
          invitation = Invitation.new(event: event, member: student, role: 'Student')
          EventInvitationMailer.invite_student(event, student, invitation).deliver_now if invitation.save
    Severity: Minor
    Found in app/models/invitation_manager.rb and 1 other location - About 20 mins to fix
    app/models/invitation_manager.rb on lines 37..40

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

    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

    sponsor, destroy_sponsor, host, destroy_host are not explicitly defined on the module.
    Open

        before_action :set_workshop, only: %i[sponsor destroy_sponsor host destroy_host]

    This cop checks that methods specified in the filter's only or except options are defined within the same class or module.

    You can technically specify methods of superclass or methods added by mixins on the filter, but these can confuse developers. If you specify methods that are defined in other classes or modules, you should define the filter in that class or module.

    If you rely on behaviour defined in the superclass actions, you must remember to invoke super in the subclass actions.

    Example:

    # bad
    class LoginController < ApplicationController
      before_action :require_login, only: %i[index settings logout]
    
      def index
      end
    end
    
    # good
    class LoginController < ApplicationController
      before_action :require_login, only: %i[index settings logout]
    
      def index
      end
    
      def settings
      end
    
      def logout
      end
    end

    Example:

    # bad
    module FooMixin
      extend ActiveSupport::Concern
    
      included do
        before_action proc { authenticate }, only: :foo
      end
    end
    
    # good
    module FooMixin
      extend ActiveSupport::Concern
    
      included do
        before_action proc { authenticate }, only: :foo
      end
    
      def foo
        # something
      end
    end

    Example:

    class ContentController < ApplicationController
      def update
        @content.update(content_attributes)
      end
    end
    
    class ArticlesController < ContentController
      before_action :load_article, only: [:update]
    
      # the cop requires this method, but it relies on behaviour defined
      # in the superclass, so needs to invoke `super`
      def update
        super
      end
    
      private
    
      def load_article
        @content = Article.find(params[:article_id])
      end
    end

    sponsor, host are not explicitly defined on the module.
    Open

        before_action :set_sponsor, only: %i[sponsor host]

    This cop checks that methods specified in the filter's only or except options are defined within the same class or module.

    You can technically specify methods of superclass or methods added by mixins on the filter, but these can confuse developers. If you specify methods that are defined in other classes or modules, you should define the filter in that class or module.

    If you rely on behaviour defined in the superclass actions, you must remember to invoke super in the subclass actions.

    Example:

    # bad
    class LoginController < ApplicationController
      before_action :require_login, only: %i[index settings logout]
    
      def index
      end
    end
    
    # good
    class LoginController < ApplicationController
      before_action :require_login, only: %i[index settings logout]
    
      def index
      end
    
      def settings
      end
    
      def logout
      end
    end

    Example:

    # bad
    module FooMixin
      extend ActiveSupport::Concern
    
      included do
        before_action proc { authenticate }, only: :foo
      end
    end
    
    # good
    module FooMixin
      extend ActiveSupport::Concern
    
      included do
        before_action proc { authenticate }, only: :foo
      end
    
      def foo
        # something
      end
    end

    Example:

    class ContentController < ApplicationController
      def update
        @content.update(content_attributes)
      end
    end
    
    class ArticlesController < ContentController
      before_action :load_article, only: [:update]
    
      # the cop requires this method, but it relies on behaviour defined
      # in the superclass, so needs to invoke `super`
      def update
        super
      end
    
      private
    
      def load_article
        @content = Article.find(params[:article_id])
      end
    end

    Assignment Branch Condition size for submit is too high. [<5, 24, 2> 24.6/17]
    Open

      def submit
        if Feedback.submit_feedback(feedback_params, params[:id])
          flash[:notice] = I18n.t('messages.feedback_saved')
    
          redirect_to root_path

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Interpreting ABC size:

    • <= 17 satisfactory
    • 18..30 unsatisfactory
    • > 30 dangerous

    You can have repeated "attributes" calls count as a single "branch". For this purpose, attributes are any method with no argument; no attempt is meant to distinguish actual attr_reader from other methods.

    Example: CountRepeatedAttributes: false (default is true)

    # `model` and `current_user`, referenced 3 times each,
     # are each counted as only 1 branch each if
     # `CountRepeatedAttributes` is set to 'false'
    
     def search
       @posts = model.active.visible_by(current_user)
                 .search(params[:q])
       @posts = model.some_process(@posts, current_user)
       @posts = model.another_process(@posts, current_user)
    
       render 'pages/search/page'
     end

    This cop also takes into account AllowedMethods (defaults to []) And AllowedPatterns (defaults to [])

    Omit the hash value.
    Open

            notice: t('messages.invitations.event.no_available_seats', email: email)

    Checks hash literal syntax.

    It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

    A separate offense is registered for each problematic pair.

    The supported styles are:

    • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
    • hash_rockets - forces use of hash rockets for all hashes
    • nomixedkeys - simply checks for hashes with mixed syntaxes
    • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

    This cop has EnforcedShorthandSyntax option. It can enforce either the use of the explicit hash value syntax or the use of Ruby 3.1's hash value shorthand syntax.

    The supported styles are:

    • always - forces use of the 3.1 syntax (e.g. {foo:})
    • never - forces use of explicit hash literal value
    • either - accepts both shorthand and explicit use of hash literal value
    • consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash

    Example: EnforcedStyle: ruby19 (default)

    # bad
    {:a => 2}
    {b: 1, :c => 2}
    
    # good
    {a: 2, b: 1}
    {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
    {d: 1, 'e' => 2} # technically not forbidden

    Example: EnforcedStyle: hash_rockets

    # bad
    {a: 1, b: 2}
    {c: 1, 'd' => 5}
    
    # good
    {:a => 1, :b => 2}

    Example: EnforcedStyle: nomixedkeys

    # bad
    {:a => 1, b: 2}
    {c: 1, 'd' => 2}
    
    # good
    {:a => 1, :b => 2}
    {c: 1, d: 2}

    Example: EnforcedStyle: ruby19nomixed_keys

    # bad
    {:a => 1, :b => 2}
    {c: 2, 'd' => 3} # should just use hash rockets
    
    # good
    {a: 1, b: 2}
    {:c => 3, 'd' => 4}

    Example: EnforcedShorthandSyntax: always (default)

    # bad
    {foo: foo, bar: bar}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: never

    # bad
    {foo:, bar:}
    
    # good
    {foo: foo, bar: bar}

    Example: EnforcedShorthandSyntax: either

    # good
    {foo: foo, bar: bar}
    
    # good
    {foo: foo, bar:}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: consistent

    # bad - `foo` and `bar` values can be omitted
    {foo: foo, bar: bar}
    
    # bad - `bar` value can be omitted
    {foo:, bar: bar}
    
    # bad - mixed syntaxes
    {foo:, bar: baz}
    
    # good
    {foo:, bar:}
    
    # good - can't omit `baz`
    {foo: foo, bar: baz}

    Avoid rescuing without specifying an error class.
    Open

      rescue

    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: 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

    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

    Omit the hash value.
    Open

          invitation = WorkshopInvitation.create(workshop: workshop, member: member, role: role)

    Checks hash literal syntax.

    It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

    A separate offense is registered for each problematic pair.

    The supported styles are:

    • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
    • hash_rockets - forces use of hash rockets for all hashes
    • nomixedkeys - simply checks for hashes with mixed syntaxes
    • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

    This cop has EnforcedShorthandSyntax option. It can enforce either the use of the explicit hash value syntax or the use of Ruby 3.1's hash value shorthand syntax.

    The supported styles are:

    • always - forces use of the 3.1 syntax (e.g. {foo:})
    • never - forces use of explicit hash literal value
    • either - accepts both shorthand and explicit use of hash literal value
    • consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash

    Example: EnforcedStyle: ruby19 (default)

    # bad
    {:a => 2}
    {b: 1, :c => 2}
    
    # good
    {a: 2, b: 1}
    {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
    {d: 1, 'e' => 2} # technically not forbidden

    Example: EnforcedStyle: hash_rockets

    # bad
    {a: 1, b: 2}
    {c: 1, 'd' => 5}
    
    # good
    {:a => 1, :b => 2}

    Example: EnforcedStyle: nomixedkeys

    # bad
    {:a => 1, b: 2}
    {c: 1, 'd' => 2}
    
    # good
    {:a => 1, :b => 2}
    {c: 1, d: 2}

    Example: EnforcedStyle: ruby19nomixed_keys

    # bad
    {:a => 1, :b => 2}
    {c: 2, 'd' => 3} # should just use hash rockets
    
    # good
    {a: 1, b: 2}
    {:c => 3, 'd' => 4}

    Example: EnforcedShorthandSyntax: always (default)

    # bad
    {foo: foo, bar: bar}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: never

    # bad
    {foo:, bar:}
    
    # good
    {foo: foo, bar: bar}

    Example: EnforcedShorthandSyntax: either

    # good
    {foo: foo, bar: bar}
    
    # good
    {foo: foo, bar:}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: consistent

    # bad - `foo` and `bar` values can be omitted
    {foo: foo, bar: bar}
    
    # bad - `bar` value can be omitted
    {foo:, bar: bar}
    
    # bad - mixed syntaxes
    {foo:, bar: baz}
    
    # good
    {foo:, bar:}
    
    # good - can't omit `baz`
    {foo: foo, bar: baz}

    Omit the hash value.
    Open

        invitations.accepted.where(member: member).present?
    Severity: Minor
    Found in app/models/meeting.rb by rubocop

    Checks hash literal syntax.

    It can enforce either the use of the class hash rocket syntax or the use of the newer Ruby 1.9 syntax (when applicable).

    A separate offense is registered for each problematic pair.

    The supported styles are:

    • ruby19 - forces use of the 1.9 syntax (e.g. {a: 1}) when hashes have all symbols for keys
    • hash_rockets - forces use of hash rockets for all hashes
    • nomixedkeys - simply checks for hashes with mixed syntaxes
    • ruby19nomixed_keys - forces use of ruby 1.9 syntax and forbids mixed syntax hashes

    This cop has EnforcedShorthandSyntax option. It can enforce either the use of the explicit hash value syntax or the use of Ruby 3.1's hash value shorthand syntax.

    The supported styles are:

    • always - forces use of the 3.1 syntax (e.g. {foo:})
    • never - forces use of explicit hash literal value
    • either - accepts both shorthand and explicit use of hash literal value
    • consistent - forces use of the 3.1 syntax only if all values can be omitted in the hash

    Example: EnforcedStyle: ruby19 (default)

    # bad
    {:a => 2}
    {b: 1, :c => 2}
    
    # good
    {a: 2, b: 1}
    {:c => 2, 'd' => 2} # acceptable since 'd' isn't a symbol
    {d: 1, 'e' => 2} # technically not forbidden

    Example: EnforcedStyle: hash_rockets

    # bad
    {a: 1, b: 2}
    {c: 1, 'd' => 5}
    
    # good
    {:a => 1, :b => 2}

    Example: EnforcedStyle: nomixedkeys

    # bad
    {:a => 1, b: 2}
    {c: 1, 'd' => 2}
    
    # good
    {:a => 1, :b => 2}
    {c: 1, d: 2}

    Example: EnforcedStyle: ruby19nomixed_keys

    # bad
    {:a => 1, :b => 2}
    {c: 2, 'd' => 3} # should just use hash rockets
    
    # good
    {a: 1, b: 2}
    {:c => 3, 'd' => 4}

    Example: EnforcedShorthandSyntax: always (default)

    # bad
    {foo: foo, bar: bar}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: never

    # bad
    {foo:, bar:}
    
    # good
    {foo: foo, bar: bar}

    Example: EnforcedShorthandSyntax: either

    # good
    {foo: foo, bar: bar}
    
    # good
    {foo: foo, bar:}
    
    # good
    {foo:, bar:}

    Example: EnforcedShorthandSyntax: consistent

    # bad - `foo` and `bar` values can be omitted
    {foo: foo, bar: bar}
    
    # bad - `bar` value can be omitted
    {foo:, bar: bar}
    
    # bad - mixed syntaxes
    {foo:, bar: baz}
    
    # good
    {foo:, bar:}
    
    # good - can't omit `baz`
    {foo: foo, bar: baz}

    Use request.referer instead of request.referrer.
    Open

        request.referrer || root_path

    This cop checks for consistent uses of request.referer or request.referrer, depending on the cop's configuration.

    Example: EnforcedStyle: referer (default)

    # bad
    request.referrer
    
    # good
    request.referer

    Example: EnforcedStyle: referrer

    # bad
    request.referer
    
    # good
    request.referrer

    Assignment Branch Condition size for create is too high. [<19, 86, 17> 89.7/17]
    Open

      def create
        member_type = cookies[:member_type]
        current_service = AuthService.find_by(provider: omnihash[:provider],
                                              uid: omnihash[:uid])
    
    

    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 and https://en.wikipedia.org/wiki/ABC_Software_Metric.

    Interpreting ABC size:

    • <= 17 satisfactory
    • 18..30 unsatisfactory
    • > 30 dangerous

    You can have repeated "attributes" calls count as a single "branch". For this purpose, attributes are any method with no argument; no attempt is meant to distinguish actual attr_reader from other methods.

    Example: CountRepeatedAttributes: false (default is true)

    # `model` and `current_user`, referenced 3 times each,
     # are each counted as only 1 branch each if
     # `CountRepeatedAttributes` is set to 'false'
    
     def search
       @posts = model.active.visible_by(current_user)
                 .search(params[:q])
       @posts = model.some_process(@posts, current_user)
       @posts = model.another_process(@posts, current_user)
    
       render 'pages/search/page'
     end

    This cop also takes into account AllowedMethods (defaults to []) And AllowedPatterns (defaults to [])

    Use the return of the conditional for variable assignment and comparison.
    Open

          if workshop_sponsors.save
            flash[:notice] = 'Sponsor added successfully'
          else
            flash[:notice] = workshop_sponsors.errors.full_messages.to_s
          end

    Avoid using update_attribute because it skips validations.
    Open

          @invitation.update_attribute(:attending, true)

    This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

    Methods may be ignored from this rule by configuring a Whitelist.

    Example:

    # bad
    Article.first.decrement!(:view_count)
    DiscussionBoard.decrement_counter(:post_count, 5)
    Article.first.increment!(:view_count)
    DiscussionBoard.increment_counter(:post_count, 5)
    person.toggle :active
    product.touch
    Billing.update_all("category = 'authorized', author = 'David'")
    user.update_attribute(:website, 'example.com')
    user.update_columns(last_request_at: Time.current)
    Post.update_counters 5, comment_count: -1, action_count: 1
    
    # good
    user.update(website: 'example.com')
    FileUtils.touch('file')

    Example: Whitelist: ["touch"]

    # bad
    DiscussionBoard.decrement_counter(:post_count, 5)
    DiscussionBoard.increment_counter(:post_count, 5)
    person.toggle :active
    
    # good
    user.touch

    Avoid using update_attribute because it skips validations.
    Open

            @invitation.update_attribute(:verified, true)

    This cop checks for the use of methods which skip validations which are listed in https://guides.rubyonrails.org/active_record_validations.html#skipping-validations

    Methods may be ignored from this rule by configuring a Whitelist.

    Example:

    # bad
    Article.first.decrement!(:view_count)
    DiscussionBoard.decrement_counter(:post_count, 5)
    Article.first.increment!(:view_count)
    DiscussionBoard.increment_counter(:post_count, 5)
    person.toggle :active
    product.touch
    Billing.update_all("category = 'authorized', author = 'David'")
    user.update_attribute(:website, 'example.com')
    user.update_columns(last_request_at: Time.current)
    Post.update_counters 5, comment_count: -1, action_count: 1
    
    # good
    user.update(website: 'example.com')
    FileUtils.touch('file')

    Example: Whitelist: ["touch"]

    # bad
    DiscussionBoard.decrement_counter(:post_count, 5)
    DiscussionBoard.increment_counter(:post_count, 5)
    person.toggle :active
    
    # good
    user.touch
    Severity
    Category
    Status
    Source
    Language