Skip to content

Commit

Permalink
Allow (x || raise) in rubocop
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzedge committed Feb 20, 2024
1 parent 68c2aa9 commit d1a3936
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,8 @@ Metrics/AbcSize:
# The ABC size is a calculated magnitude, so this number can be an Integer or
# a Float.
Max: 20
AllowedMethods:
- 'closest_node'
Exclude:
- 'tasks/*.rb'

Expand All @@ -1353,6 +1355,9 @@ Metrics/ClassLength:
# Avoid complex methods.
Metrics/CyclomaticComplexity:
Max: 6
AllowedMethods:
- 'children_match_prefix'
- 'closest_node'

Metrics/MethodLength:
CountComments: false # count full line comments?
Expand Down
1 change: 1 addition & 0 deletions lib/rambling/trie/configuration/provider_collection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ def file_format filepath

def contains? provider
return true if provider.nil?

p = (provider || raise)
providers.any? && provider_instances.include?(p)
end
Expand Down
8 changes: 5 additions & 3 deletions lib/rambling/trie/container.rb
Original file line number Diff line number Diff line change
Expand Up @@ -201,16 +201,18 @@ def words_within_root phrase
return enum_for :words_within_root, phrase unless block_given?

chars = phrase.chars
# rubocop:disable Style/CommentedKeyword
0.upto(chars.length - 1).each do |starting_index|
new_phrase = chars.slice starting_index..(chars.length - 1) #: Array[String]
new_phrase = chars.slice starting_index..(chars.length - 1) # : Array[String]
root.match_prefix new_phrase do |word|
yield word
end
end #: Enumerator[String, void]
end # : Enumerator[String, void]
# rubocop:enable Style/CommentedKeyword
end

def compress_root
compressor.compress root #: Nodes::Compressed
compressor.compress root # : Nodes::Compressed
end

def char_symbols word
Expand Down
1 change: 1 addition & 0 deletions lib/rambling/trie/serializers/zip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ def dump contents, filepath
serializer = serializers.resolve filename

raise if serializer.nil?

serializer.dump contents, entry_path

zip.add filename, entry_path
Expand Down

0 comments on commit d1a3936

Please sign in to comment.