[#30] Explicitly set format as text for Bundler::Stats::CLI on ConsoleFormatter.#43
[#30] Explicitly set format as text for Bundler::Stats::CLI on ConsoleFormatter.#43ruyrocha wants to merge 3 commits intofastruby:mainfrom
Bundler::Stats::CLI on ConsoleFormatter.#43Conversation
… on `ConsoleFormatter`.
edcf9e4 to
ae05704
Compare
main branch ~/G/rails_stats (main)> bundle exec rake stats\[points,stdout\]
Directory: /home/ruy/GitHub/rails_stats/points
Could not find command "stats[points,stdout]".
~/G/rails_stats (main) [1]>this branch ~/G/rails_stats (hotfix/console-formatter)> bundle exec rake stats\[points,stdout\]
Directory: /home/ruy/GitHub/rails_stats/points
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
+-----------------------|------------|----------------+
| Name | Total Deps | 1st Level Deps |
+-----------------------|------------|----------------+
| simplecov-console | 8 | 3 |
| codecov | 4 | 1 |
| rails_stats | 4 | 2 |
| simplecov | 3 | 3 |
| minitest-around | 1 | 1 |
| bundler | 0 | 0 |
| byebug | 0 | 0 |
| minitest | 0 | 0 |
| minitest-spec-context | 0 | 0 |
+-----------------------|------------|----------------+
Declared Gems 9
Total Gems 18
Unpinned Versions 6
Github Refs 0
+----------------------+---------+---------+---------+---------+---------+-----+-------+
| Name | Files | Lines | LOC | Classes | Methods | M/C | LOC/M |
+----------------------+---------+---------+---------+---------+---------+-----+-------+
| Channels | 2 | 8 | 8 | 2 | 0 | 0 | 0 |
| Configuration | 21 | 431 | 160 | 1 | 0 | 0 | 0 |
| Controller Tests | 5 | 856 | 684 | 0 | 0 | 0 | 0 |
| Controllers | 15 | 591 | 502 | 15 | 69 | 4 | 5 |
| Feature Tests | 10 | 1392 | 1063 | 0 | 1 | 0 | 1061 |
| Helper Tests | 1 | 10 | 9 | 0 | 0 | 0 | 0 |
| Helpers | 6 | 126 | 103 | 0 | 17 | 0 | 4 |
| Javascripts | 8 | 294 | 225 | 0 | 18 | 0 | 10 |
| Jobs | 1 | 2 | 2 | 1 | 0 | 0 | 0 |
| Madmins | 5 | 124 | 54 | 5 | 4 | 0 | 11 |
| Mailers | 1 | 4 | 4 | 1 | 0 | 0 | 0 |
| Model Tests | 6 | 362 | 294 | 0 | 1 | 0 | 292 |
| Models | 8 | 245 | 188 | 8 | 30 | 3 | 4 |
| Policies | 6 | 84 | 65 | 7 | 14 | 2 | 2 |
| Policy Tests | 1 | 37 | 29 | 0 | 0 | 0 | 0 |
| Spec Support | 10 | 343 | 180 | 0 | 6 | 0 | 28 |
+----------------------+---------+---------+---------+---------+---------+-----+-------+
| Code | 73 | 1909 | 1311 | 40 | 152 | 3 | 6 |
| Tests | 33 | 3000 | 2259 | 0 | 8 | 0 | 280 |
| Total | 106 | 4909 | 3570 | 40 | 160 | 4 | 20 |
+----------------------+---------+---------+---------+---------+---------+-----+-------+
Code LOC: 1311 Test LOC: 2259 Code to Test Ratio: 1:1.7 Files: 106
Polymorphic models count: 0 polymorphic associations
Schema Stats: 6 `create_table` calls in schema.rb
~/G/rails_stats (hotfix/console-formatter)> |
JuanVqz
left a comment
There was a problem hiding this comment.
Hey @ruyrocha sorry for the delay; this change looks right to me. could you please update your PR to let the tests run on it, and if all is green, we can merge.
Extra points: (Optional)
It would be great if you could add tests for the fix.
Ping me when done. thanks!
| class ConsoleFormatter < StatsFormatter | ||
| def to_s | ||
| Bundler::Stats::CLI.start | ||
| Bundler::Stats::CLI.start(['--format', 'text']) |
There was a problem hiding this comment.
I've tested the command; although it works, please consider being more explicit by including the stats subcommand.
Thor may be defaulting to stats but this makes the intent clearer and less reliant on Thor's default behavior.
| Bundler::Stats::CLI.start(['--format', 'text']) | |
| Bundler::Stats::CLI.start(['stats', '--format', 'text']) |
Without stats
➜ Bundler::Stats::CLI.start(['--format', 'text'])"
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
+-----------------------|------------|----------------+
| Name | Total Deps | 1st Level Deps |
+-----------------------|------------|----------------+
| simplecov-console | 8 | 3 |
| codecov | 4 | 1 |
| rails_stats | 4 | 2 |
| simplecov | 3 | 3 |
| minitest-around | 1 | 1 |
| bundler | 0 | 0 |
| byebug | 0 | 0 |
| minitest | 0 | 0 |
| minitest-spec-context | 0 | 0 |
+-----------------------|------------|----------------+
Declared Gems 9
Total Gems 18
Unpinned Versions 6
Github Refs 0
With stats
➜ Bundler::Stats::CLI.start(['stats', '--format', 'text'])"
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
The dependency `bundler` wasn't found. It may not be present in your Gemfile.lock. This often happens when a dependency isn't installed on your platform.
+-----------------------|------------|----------------+
| Name | Total Deps | 1st Level Deps |
+-----------------------|------------|----------------+
| simplecov-console | 8 | 3 |
| codecov | 4 | 1 |
| rails_stats | 4 | 2 |
| simplecov | 3 | 3 |
| minitest-around | 1 | 1 |
| bundler | 0 | 0 |
| byebug | 0 | 0 |
| minitest | 0 | 0 |
| minitest-spec-context | 0 | 0 |
+-----------------------|------------|----------------+
Declared Gems 9
Total Gems 18
Unpinned Versions 6
Github Refs 0
There was a problem hiding this comment.
@ruyrocha Do you think committing this is a good addition?
There was a problem hiding this comment.
@ruyrocha Do you think committing this is a good addition?
I'll revisit this (plus tests) later today; I didn't double-check but I have the sense stats is already being chained.
There was a problem hiding this comment.
@ruyrocha, would appreciate that; feel free to ping me when you are done. 👍
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #43 +/- ##
=======================================
Coverage 83.20% 83.20%
=======================================
Files 19 19
Lines 750 750
=======================================
Hits 624 624
Misses 126 126 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Juan Vásquez <javasgon@gmail.com>
Closes #30
CHANGELOG.mdthat links to this PR under the "main (unreleased)" heading.Description:
Bundler::Stats::CLIwas failing to display console output, and now it's fixed by setting the format as text.I will abide by the code of conduct.