Skip to content

Commit

Permalink
Apply rubocop performance corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
teeparham committed Sep 26, 2024
1 parent ac64f62 commit 4d0bc61
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 4 deletions.
3 changes: 1 addition & 2 deletions lib/gemdiff/bundle_inspector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ def list
@list ||=
outdated
.split("\n")
.map { |line| new_outdated_gem(line) }
.compact
.filter_map { |line| new_outdated_gem(line) }
end

def outdated
Expand Down
2 changes: 1 addition & 1 deletion lib/gemdiff/outdated_gem.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def find_name(name)

def clean_url(url)
uri = URI.parse(url)
uri.path.gsub! %r{/+}, "/"
uri.path.squeeze!("/")
uri.to_s
end

Expand Down
2 changes: 1 addition & 1 deletion lib/gemdiff/repo_finder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def gemspec_homepage(gem_name)
yaml = gemspec(gem_name)
return if yaml.to_s.empty?
spec = YAML.safe_load(yaml, permitted_classes: PERMITTED_GEMSPEC_CLASSES)
return clean_url(spec.homepage) if spec.homepage =~ GITHUB_REPO_REGEX
return clean_url(spec.homepage) if GITHUB_REPO_REGEX.match?(spec.homepage)
match = spec.description.to_s.match(GITHUB_REPO_REGEX)
match && clean_url(match[0])
end
Expand Down

0 comments on commit 4d0bc61

Please sign in to comment.