Skip to content
This repository was archived by the owner on Mar 12, 2026. It is now read-only.

RFC for bundle canonical#15

Closed
agrim123 wants to merge 1 commit intomasterfrom
agr-bundle-canonical
Closed

RFC for bundle canonical#15
agrim123 wants to merge 1 commit intomasterfrom
agr-bundle-canonical

Conversation

@agrim123
Copy link
Copy Markdown

@agrim123 agrim123 commented Aug 3, 2018

source "https://rubygems.org/"

# a modular Ruby webserver interface
gem "rack"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to have a lot more examples that reflect more real-world Gemfiles and how this command modifies them:

  • How does this work on really large Gemfiles?
  • How does it handle comments inside a Gemfile?
  • How does it handle Gemfiles that have ruby code inside it?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, it only works well for a standard Gemfile.


# Summary

Add a new `bundle canonical` feature. The `bundle canonical` command will modify the gemfile by giving it consistent formatting and beautify it by addign summary of the gems if required.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

addign

gem "rack"
```

Adding `--view` option does not change the Gemfile rather shows what the Gemfile would look like if run without `--view`.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO --dry-run or --dry would be better to name this functionality

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

--dry-run would be fine, I think


# Summary

Add a new `bundle canonical` feature. The `bundle canonical` command will modify the gemfile by giving it consistent formatting and beautify it by addign summary of the gems if required.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consistent formatting

I suggest expanding on what "consistent formatting" is and define what that looks and why it should be that way.

@agrim123 agrim123 force-pushed the agr-bundle-canonical branch from 94f5eb3 to e0b0de4 Compare August 11, 2018 21:28
@deivid-rodriguez
Copy link
Copy Markdown
Contributor

deivid-rodriguez commented Aug 19, 2018

I'm not sure this is worth adding to bundler. As I stated in bundler's PR

I'm unsure about this change, rubocop already provides a bunch of style rules for Gemfiles, and people caring about style & prettyness are probably using rubocop already. For those people, this new command will probably not be useful since it's very likely that it won't be able to achieve the level of flexibility rubocop already has. So in my opinion any efforts towards standarizing Gemfile's appearance should be focused on improving existing and adding new cops for rubocop.

To elaborate a bit further on this: Given the level of configurabily rubocop has, it seems unlikely that what bundler considers "canonical" exactly matches what rubocop considers "canonical". That means bundle canonical and rubocop --auto-correct Gemfile might give different results and compete/conflict with each other. And that might result in rubocop users not using bundle canonical because of this. And those are the users potentially interested in this feature...

@deivid-rodriguez
Copy link
Copy Markdown
Contributor

We should probably come up with a decision here.

@indirect
Copy link
Copy Markdown

indirect commented Jan 2, 2020

I'm happy to leave this to rubocop --auto-correct Gemfile. 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants