Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork62
Add support for a simple config file#125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Merged
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
Looking at the code, I'm actually more amenable to this than I was. It's pretty clean, and I'm less worried about maintaining it than I was. A couple of small tweaks and I'll merge this:
|
Thanks for taking a look so quickly! I'm happy to make both of those changes. |
As syntax_tree gains wider usage, it'll be very helpful to allowprojects to commit their particular configs within their repo for use byany tool that uses `stree` instead of having to create wrapper scripts,rely on rake tasks that come with their own overhead, or manually keepsettings up to date among all contributors.This set of changes takes inspiration from sorbet to provide users witha simple config file that's also easy to parse and use within the gem.It's a text file that has the exact options you'd pass on the commandline, each on their own line. These are parsed and prepended to thearguments array within `CLI.run`, still allowing for other options topassed from the command line.I decided to restrict this only to the command line options and avoidthe source files argument, opting to let other tools pass their ownsource file from the command line, which is preferable for tools likeeditor integrations that might interact with a single file at a time. Ifusers want to interact with all of their Ruby files at once, the raketasks are perfect for providing larger, static patterns of files. Andsince they use `CLI.run` as well, they'll pick up options from a.streerc file, if present.I also opted for only supporting a single .streerc file at the projectroot. If there's a need for multiple configs or config locations, thiscan be easily extended to look up through a directory structure oraccept an option for a specific config file location (or even adifferent filename). Those felt out of scope for this initial support.
Thanks! |
Closed
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Following on from conversation in#124, I'm taking a pass at what I think is a useful but fairly simple approach to supporting a config file. I'd love to hear any and all feedback on this. I see this as a viable solution in particular but also as a means to have more concrete discussions about the topic generally.
Context
As syntax_tree gains wider usage, it'll be very helpful to allow projects to commit their particular configs within their repo for use by any tool that uses
stree
instead of having to create wrapper scripts, rely on rake tasks that come with their own overhead, or manually keep settings up to date among all contributors.Approach
This set of changes takes inspiration fromSorbet to provide users with a simple config file that's also easy to parse and use within the gem. It's a text file that has the exact options you'd pass on the command line, each on their own line. These are parsed and prepended to the arguments array within
CLI.run
, still allowing for other options to passed from the command line.Limiting Scope (and Future Extensions)
I decided to restrict this only to the command line options and avoid the source files argument, opting to let other tools pass their own source file from the command line, which is preferable for tools like editor integrations that might interact with a single file at a time. If users want to interact with all of their Ruby files at once, the rake tasks are perfect for providing larger, static patterns of files. And since they use
CLI.run
as well, they'll pick up options from a.syntax_tree
file, if present.I also opted for only supporting a single .syntax_tree file at the project root. If there's a need for multiple configs or config locations, this can be easily extended to look up through a directory structure or accept an option for a specific config file location (or even a different filename). Those felt out of scope for this initial support.