Skip to content

Commit

Permalink
CI: URL checker - simplify hash value vivification
Browse files Browse the repository at this point in the history
Implement the [suggested improvement](#2127 (review)) for the URLs hash to have an empty files array for the hash value by default.

Update an old library website to use RubyGems.org instead.
  • Loading branch information
fallwith committed Jul 12, 2023
1 parent 5900d42 commit 6d215e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion lib/new_relic/agent/instrumentation/memcache.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
# NOTE: there are multiple implementations of the Memcached client in Ruby,
# each with slightly different APIs and semantics.
# See:
# http://www.deveiate.org/code/Ruby-MemCache/ (Gem: Ruby-MemCache)
# https://rubygems.org/gems/Ruby-MemCache (Gem: Ruby-MemCache)
# https://github.com/mperham/memcache-client (Gem: memcache-client)
# https://github.com/mperham/dalli (Gem: dalli)

Expand Down
7 changes: 2 additions & 5 deletions test/new_relic/healthy_urls_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def real_url?(url)
end

def gather_urls
Dir.glob(File.join(ROOT, '**', '*')).each_with_object({}) do |file, urls|
Dir.glob(File.join(ROOT, '**', '*')).each_with_object(Hash.new { |hash, key| hash[key] = [] }) do |file, urls|
next unless File.file?(file) && File.basename(file).match?(FILE_PATTERN) && !file.match?(IGNORED_FILE_PATTERN)

changelog_entries_seen = 0
Expand All @@ -104,10 +104,7 @@ def gather_urls
next unless line =~ URL_PATTERN

url = Regexp.last_match(1).sub(%r{(?:/|\.)$}, '')
if real_url?(url)
urls[url] ||= []
urls[url] << file
end
urls[url] << file if real_url?(url)
end
end
end
Expand Down

0 comments on commit 6d215e7

Please sign in to comment.