Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check alternative locations for .restyled.yaml #98

Closed
pbrisbin opened this issue May 4, 2020 · 2 comments · Fixed by #103
Closed

Check alternative locations for .restyled.yaml #98

pbrisbin opened this issue May 4, 2020 · 2 comments · Fixed by #103

Comments

@pbrisbin
Copy link
Member

pbrisbin commented May 4, 2020

Check the following in order, first found is used.

  • .restyled.yaml (current)
  • .restyled.yml
  • .github/restyled.yaml
  • .github/restyled.yml
@chiroptical
Copy link
Contributor

I was able to build and test restyler locally and would like to try to add this enhancement. I see https://github.com/restyled-io/restyler/blob/master/src/Restyler/Config.hs#L203, it should be a simple change using https://hackage.haskell.org/package/base-4.14.0.0/docs/Data-List.html#v:find. I'll need to think more carefully about how to test it.

@pbrisbin
Copy link
Member Author

pbrisbin commented May 8, 2020

Sounds great! I'm happy to review any WIP, if you get started but have questions.

I'm not sure Data.List.find would be useful here, since you probably want to iterate over a list of paths in IO and halt on the first one that exists. I suspect you'd just want to change loadConfigFrom to accept [ConfigSource], and then configFile to configFiles.

For testing, there is a way to run an RIO App a with a mocked file system (example), which means you should be able to call loadConfigFrom with various files present and assert the desired outcomes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants