ameba fixes

This commit is contained in:
Jorge Morante 2023-05-17 14:24:45 +02:00
parent abbc96bb5b
commit d7610fd277
10 changed files with 20 additions and 24 deletions

1
.gitignore vendored
View File

@ -8,3 +8,4 @@ vendor/bundle
.byebug_history
shared
bin/*
lib/

View File

@ -1,6 +0,0 @@
---
version: 1.0
shards:
priority_queue:
git: https://github.com/amadanmath/priority_queue.cr.git
version: 0.1.0+git.commit.5ce7c82b876644f28715d384f3615a2dc7b2a66b

View File

@ -1,2 +1,6 @@
version: 2.0
shards: {}
shards:
ameba:
git: https://github.com/crystal-ameba/ameba.git
version: 1.3.1

View File

@ -8,6 +8,11 @@ targets:
tmux-fingers:
main: src/fingers.cr
development_dependencies:
ameba:
github: crystal-ameba/ameba
version: ~> 1.3.0
crystal: 1.7.3
license: MIT

View File

@ -102,7 +102,7 @@ class Fingers::Commands::LoadConfig < Fingers::Commands::Base
end
def clean_up_patterns(patterns)
patterns.reject { |pattern| pattern.empty? }
patterns.reject(&.empty?)
end
def setup_bindings

View File

@ -28,8 +28,6 @@ module Fingers::Commands
@original_options : Hash(String, String) = {} of String => String
def run
pane_id, mode = @args
track_options_to_restore!
show_hints

View File

@ -50,7 +50,7 @@ module Fingers
end
def matches
@matches ||= @hints_by_text.keys.uniq.flatten
@matches ||= @hints_by_text.keys.uniq!.flatten
end
# private
@ -97,7 +97,7 @@ module Fingers
if match["capture"]?
match_start, match_end = {match.begin(0), match.end(0)}
capture_start, capture_end = find_capture_offset(match).not_nil!
capture_offset = {capture_start - match_start, capture_end - capture_start}
capture_offset = {capture_start - match_start, capture_end - match_end}
else
capture_offset = nil
end
@ -129,7 +129,7 @@ module Fingers
end
getter capture_indices : Array(Int32) do
pattern.name_table.map { |k, v| v == "capture" ? k : nil }.compact
pattern.name_table.compact_map { |k, v| v == "capture" ? k : nil }
end
def lines : Array(String)

View File

@ -26,7 +26,7 @@ class Huffman
return cached_result unless cached_result.nil?
if n <= alphabet.size
return alphabet
return alphabet
end
setup!(alphabet: alphabet, n: n)
@ -55,7 +55,7 @@ class Huffman
result.push(translate_path(path)) if node.children.empty?
end
final_result = result.sort_by { |hint| hint.size }
final_result = result.sort_by(&.size)
save_to_cache(alphabet, n, final_result)

View File

@ -6,12 +6,12 @@ class PriorityQueue(T)
h[k] = [] of T
end
data.each { |priority, item| @q[priority] << item } if data
@priorities = @q.keys.sort
@priorities = @q.keys.sort!
end
def push(priority : Int32, item : T)
@q[priority].push(item)
@priorities = @q.keys.sort
@priorities = @q.keys.sort!
end
def pop
@ -58,6 +58,6 @@ class PriorityQueue(T)
end
def size
@q.values.sum { |list| list.size }
@q.values.sum(&.size)
end
end

View File

@ -218,12 +218,6 @@ class Tmux
end
def tmux
flags = [] of String
# flags.push("-L", socket_flag_value) if socket_flag_value
# return "tmux #{flags.join(" ")}" unless flags.empty?
"tmux"
end