summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorZsolt Kozaroczy <[email protected]>2023-07-04 09:38:19 +0200
committerGitHub <[email protected]>2023-07-04 09:38:19 +0200
commit692be9e99e0a76d5f6d0b0527466998ca558fe96 (patch)
tree7f5ea962c8a6161d7ea1dd4197027d63f317eb8e
parentec65a1586ab1a4ffaac15578fa19ff04b3caed25 (diff)
parentb2636ddaebd9fd1ecd09466b4606792da53947a5 (diff)
downloadcaxlsx-692be9e99e0a76d5f6d0b0527466998ca558fe96.tar.gz
caxlsx-692be9e99e0a76d5f6d0b0527466998ca558fe96.zip
Merge pull request #288 from tagliala/chore/fix-non-local-exit-from-iterator
Fix Lint/NonLocalExitFromIterator offense
-rw-r--r--.rubocop_todo.yml4
-rw-r--r--lib/axlsx/util/validators.rb5
2 files changed, 2 insertions, 7 deletions
diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml
index 1384f3c5..29c93858 100644
--- a/.rubocop_todo.yml
+++ b/.rubocop_todo.yml
@@ -56,10 +56,6 @@ Lint/DisjunctiveAssignmentInConstructor:
Exclude:
- 'lib/axlsx/drawing/num_data_source.rb'
-Lint/NonLocalExitFromIterator:
- Exclude:
- - 'lib/axlsx/util/validators.rb'
-
# This cop supports safe autocorrection (--autocorrect).
# Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
Lint/UnusedBlockArgument:
diff --git a/lib/axlsx/util/validators.rb b/lib/axlsx/util/validators.rb
index fd17360e..5684c9cb 100644
--- a/lib/axlsx/util/validators.rb
+++ b/lib/axlsx/util/validators.rb
@@ -60,9 +60,8 @@ module Axlsx
end
v_class = v.is_a?(Class) ? v : v.class
- Array(types).each do |t|
- return if v_class <= t
- end
+ return if Array(types).any? { |t| v_class <= t }
+
raise ArgumentError, format(ERR_TYPE, v.inspect, name, types.inspect)
end
end