feat: Show list of ignored gems - #2354
Conversation
1ee1e56 to
6645633
Compare
51a7713 to
28d3674
Compare
28d3674 to
bcc671b
Compare
KaanOzkan
left a comment
There was a problem hiding this comment.
Thank you, few more refactors. Also there might be some long lines, it'd be good to run rubocop before pushing.
| gem_queue = gems_to_generate(@gem_names) | ||
| user_excluded_gems = user_excluded_gem_names(gem_queue) | ||
| gem_queue.reject! { |gem| @exclude.include?(gem.name) } |
There was a problem hiding this comment.
| gem_queue = gems_to_generate(@gem_names) | |
| user_excluded_gems = user_excluded_gem_names(gem_queue) | |
| gem_queue.reject! { |gem| @exclude.include?(gem.name) } | |
| user_excluded_gems = @gem_names & @exclude | |
| gem_queue = gems_to_generate(@gem_names) | |
| gem_queue.reject! { |gem| @exclude.include?(gem.name) } |
Simpler
There was a problem hiding this comment.
Also I think we should move user_excluded_gems assignment right before it's printed. It's nicer I believe.
| def gems_to_generate(gem_names) | ||
| return @bundle.dependencies if gem_names.empty? | ||
|
|
||
| (gem_names - @exclude).each_with_object([]) do |gem_name, gems| |
There was a problem hiding this comment.
| gem_names.each_with_object([]) do |gem_name, gems| |
| def user_excluded_gem_names(gem_queue) | ||
| @exclude.uniq.select do |gem_name| | ||
| @bundle.gem(gem_name) && | ||
| (@gem_names.include?(gem_name) || gem_queue.any? { |gem| gem.name == gem_name }) | ||
| end | ||
| end |
There was a problem hiding this comment.
| def user_excluded_gem_names(gem_queue) | |
| @exclude.uniq.select do |gem_name| | |
| @bundle.gem(gem_name) && | |
| (@gem_names.include?(gem_name) || gem_queue.any? { |gem| gem.name == gem_name }) | |
| end | |
| end |
| @@ -44,6 +46,14 @@ | |||
| else | |||
| say("No operations performed, all RBIs are up-to-date.", [:green, :bold]) | |||
There was a problem hiding this comment.
This should be printed at the end, let's move the new prints before this if/else.
| say("No operations performed, all RBIs are up-to-date.", [:green, :bold]) | ||
| end | ||
| unless @skipped_gems.empty? | ||
| say("\nNote: Tapioca is skipping gem rbi generation for following gems due to the built-in configuration:", [:yellow, :bold]) |
There was a problem hiding this comment.
| say("\nNote: Tapioca is skipping gem rbi generation for following gems due to the built-in configuration:", [:yellow, :bold]) | |
| say("\nNote: Tapioca skipped RBI generation for the following gems because they are ignored by default:", [:yellow, :bold]) |
| say(@skipped_gems.join(", "), [:yellow, :bold]) | ||
| end | ||
| unless user_excluded_gems.empty? | ||
| say("\nNote: Tapioca is skipping gem rbi generation for following gems due to user configuration:", [:yellow, :bold]) |
There was a problem hiding this comment.
| say("\nNote: Tapioca is skipping gem rbi generation for following gems due to user configuration:", [:yellow, :bold]) | |
| say("\nNote: Tapioca skipped RBI generation for the following gems because they were excluded:", [:yellow, :bold]) |
| assert_success_status(result) | ||
| end | ||
|
|
||
| it "reports explicitly requested ignored gems" do |
There was a problem hiding this comment.
Can you also add a test for not reporting excluded gems when we only run gem and gem --all?
Motivation
This PR addresses #1347 which aims to show a message when trying to run
tapioca gemon a ignored gem.Implementation
I have added a skipped gems property to the cli.
Tests
I have now written a test just to confirm something like
gem sorbetoutputs the warning that it was skipped. More than happy to add more if needed.No warning
Warning