From 989793a40905972f9a3ed8732a1daf82a9893b10 Mon Sep 17 00:00:00 2001 From: Jeff Keen Date: Wed, 27 Mar 2024 15:47:18 -0500 Subject: [PATCH] Fix linting --- lib/graphiti/configuration.rb | 5 +---- lib/graphiti/debugger.rb | 6 +++--- lib/graphiti/util/cache_debug.rb | 7 ++----- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/lib/graphiti/configuration.rb b/lib/graphiti/configuration.rb index f486f485..121c4317 100644 --- a/lib/graphiti/configuration.rb +++ b/lib/graphiti/configuration.rb @@ -20,6 +20,7 @@ class Configuration attr_reader :debug, :debug_models attr_writer :schema_path + attr_writer :cache_rendering # Set defaults # @api private @@ -63,10 +64,6 @@ def cache_rendering? end end - def cache_rendering=(val) - @cache_rendering = val - end - def schema_path @schema_path ||= raise("No schema_path defined! Set Graphiti.config.schema_path to save your schema.") end diff --git a/lib/graphiti/debugger.rb b/lib/graphiti/debugger.rb index f69826b0..92165d35 100644 --- a/lib/graphiti/debugger.rb +++ b/lib/graphiti/debugger.rb @@ -103,10 +103,10 @@ def on_render(name, start, stop, id, payload) Graphiti::Util::CacheDebug.new(payload[:proxy]).analyze do |cache_debug| logs << ["Cache key for #{cache_debug.name}", :blue, true] - if cache_debug.volatile? - logs << [" \\_ volatile | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :red, true] + logs << if cache_debug.volatile? + [" \\_ volatile | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :red, true] else - logs << [" \\_ stable | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :blue, true] + [" \\_ stable | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :blue, true] end if cache_debug.changed_key? diff --git a/lib/graphiti/util/cache_debug.rb b/lib/graphiti/util/cache_debug.rb index e0e65cac..de42cf77 100644 --- a/lib/graphiti/util/cache_debug.rb +++ b/lib/graphiti/util/cache_debug.rb @@ -20,7 +20,7 @@ def key end def current_version - @current_version ||= { + @current_version ||= { cache_key: proxy.cache_key_with_version, version: proxy.updated_at, expires_in: proxy.cache_expires_in, @@ -50,10 +50,7 @@ def hit_count def change_percentage return 0 if request_count == 0 - (miss_count.to_i / request_count.to_f * 100).round(1) - rescue Exception => e - puts e.inspect end def volatile? @@ -88,4 +85,4 @@ def save end end end -end \ No newline at end of file +end