app/controllers/client_data_controller.rb

Summary

Maintainability
A
2 hrs
Test Coverage

Class ClientDataController has 24 methods (exceeds 20 allowed). Consider refactoring.
Open

class ClientDataController < ApplicationController
  include TokenAuth
  before_action -> { authorize model_class }, only: [:new, :create]
  before_action -> { authorize proposal }, only: [:edit, :update]
  before_action :build_client_data_instance, only: [:new, :create]
Severity: Minor
Found in app/controllers/client_data_controller.rb - About 2 hrs to fix

    Use @client_data_instance.changed_attributes.present? instead of !@client_data_instance.changed_attributes.blank?.
    Open

        !@client_data_instance.changed_attributes.blank?

    This cops checks for code that can be changed to blank?. Settings: NotNilAndNotEmpty: Convert checks for not nil and not empty? to present? NotBlank: Convert usages of not blank? to present? UnlessBlank: Convert usages of unless blank? to if present?

    Example:

    # NotNilAndNotEmpty: true
      # bad
      !foo.nil? && !foo.empty?
      foo != nil && !foo.empty?
      !foo.blank?
    
      # good
      foo.present?
    
    # NotBlank: true
      # bad
      !foo.blank?
      not foo.blank?
    
      # good
      foo.present?
    
    # UnlessBlank: true
      # bad
      something unless foo.blank?
    
      # good
      something if  foo.present?

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

      before_action :find_client_data_instance, only: [:edit, :update]

    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]

    Put empty method definitions on a single line.
    Open

      def edit
      end

    This cop checks for the formatting of empty method definitions. By default it enforces empty method definitions to go on a single line (compact style), but it can be configured to enforce the end to go on its own line (expanded style).

    Note: A method definition is not considered empty if it contains comments.

    Example: EnforcedStyle: compact (default)

    # bad
    def foo(bar)
    end
    
    def self.foo(bar)
    end
    
    # good
    def foo(bar); end
    
    def foo(bar)
      # baz
    end
    
    def self.foo(bar); end

    Example: EnforcedStyle: expanded

    # bad
    def foo(bar); end
    
    def self.foo(bar); end
    
    # good
    def foo(bar)
    end
    
    def self.foo(bar)
    end

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

      before_action -> { authorize proposal }, only: [:edit, :update]

    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

      before_action -> { authorize model_class }, only: [:new, :create]

    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

      before_action :build_client_data_instance, only: [:new, :create]

    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]

    There are no issues that match your filters.

    Category
    Status