From 26ced45f67534dbc63678ef58165f89241d6ece4 Mon Sep 17 00:00:00 2001 From: Earlopain Date: Fri, 17 Mar 2023 19:52:41 +0100 Subject: [PATCH] [Rubocop] Enforce consistent lambda notation --- .rubocop.yml | 3 +++ app/controllers/application_controller.rb | 2 +- app/logical/file_methods.rb | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/.rubocop.yml b/.rubocop.yml index 0d11fb3e3..dd5a83521 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -125,6 +125,9 @@ Style/HashSyntax: Style/IfUnlessModifier: Enabled: false +Style/Lambda: + EnforcedStyle: literal + Style/NumericPredicate: EnforcedStyle: comparison diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index dd47052c9..ea03e223f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -190,7 +190,7 @@ class ApplicationController < ActionController::Base return unless request.get? || request.head? params[:search] ||= ActionController::Parameters.new - deep_reject_blank = lambda do |hash| + deep_reject_blank = ->(hash) do hash.reject { |k, v| v.blank? || (v.is_a?(Hash) && deep_reject_blank.call(v).blank?) } end if params[:search].is_a?(ActionController::Parameters) diff --git a/app/logical/file_methods.rb b/app/logical/file_methods.rb index 38627b4b4..4e3749f47 100644 --- a/app/logical/file_methods.rb +++ b/app/logical/file_methods.rb @@ -49,7 +49,7 @@ module FileMethods return false if !is_image? image = Vips::Image.new_from_file(file_path) - fetch = lambda do |key| + fetch = ->(key) do value = image.get(key) value.encode("ASCII", invalid: :replace, undef: :replace).gsub("\u0000", "") rescue Vips::Error