Fix RuboCop Lint/SuppressedExceptionInNumberConversion (#41884).

git-svn-id: https://svn.redmine.org/redmine/trunk@23626 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2025-04-11 09:00:58 +00:00
parent c77c1d078b
commit 5668aa651f
3 changed files with 2 additions and 8 deletions

View File

@@ -232,12 +232,6 @@ Lint/SuppressedException:
- 'lib/redmine/scm/adapters/cvs_adapter.rb' - 'lib/redmine/scm/adapters/cvs_adapter.rb'
- 'lib/redmine/scm/adapters/subversion_adapter.rb' - 'lib/redmine/scm/adapters/subversion_adapter.rb'
# This cop supports unsafe autocorrection (--autocorrect-all).
Lint/SuppressedExceptionInNumberConversion:
Exclude:
- 'lib/redmine/core_ext/string/conversions.rb'
- 'test/unit/query_test.rb'
# This cop supports safe autocorrection (--autocorrect). # This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments. # Configuration parameters: AutoCorrect, IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument: Lint/UnusedBlockArgument:

View File

@@ -39,7 +39,7 @@ module Redmine
end end
# 2,5 => 2.5 # 2,5 => 2.5
s.tr!(',', '.') s.tr!(',', '.')
begin; Kernel.Float(s); rescue; nil; end Kernel.Float(s, exception: false)
end end
end end
end end

View File

@@ -2326,7 +2326,7 @@ class QueryTest < ActiveSupport::TestCase
values = values =
issues.filter_map do |i| issues.filter_map do |i|
begin begin
Kernel.Float(i.custom_value_for(c.custom_field).to_s) Kernel.Float(i.custom_value_for(c.custom_field).to_s, exception: false)
rescue rescue
nil nil
end end