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

Format directories #41

Merged
merged 9 commits into from
Oct 26, 2015
Merged

Format directories #41

merged 9 commits into from
Oct 26, 2015

Conversation

Janiczek
Copy link
Contributor

Relates to issue #16 (hopefully closes it).

The functional changes:

  • we check for existence of the INPUT file/directory and exit appropriately
  • we check for existence of any .elm files in the INPUT directory and exit appropriately
  • we search the directory recursively for .elm files and always overwrite them in place (asking beforehand), exiting on any failure during the formatting.
  • because of no indicator of which file did an error happen in, we write something along the lines of "Processing file xyz.elm" before we start working on that file.

The questions are:

  1. (Behavior when encountering errors while formatting multiple files #42) should we always try to format as many files as possible or should we exit on the first failure?
  2. (Formatting a directory into other directory #43) should we allow for usage elm-format DIR --output DIR2, copying the filenames one for one there?
  3. should I try to somehow inject the file-with-error path into the now useless "" placeholder inside the error report, or is it good as it is ("Processing file xyz.elm")? This seems like a nontrivial task, modifying the parser to allow for an extra argument etc.

The code probably needs some refactoring (at least extracting the error messages into a different module?) but I need a bit of a break from it so that I can see it "with a new set of eyes" :) Suggestions welcome! (And some Haskell style.)

@avh4
Copy link
Owner

avh4 commented Oct 26, 2015

I'm going to merge what's done already.

For question (3), where we want to show the filename is in place of "" currently in Main.hs#printError (created #44)

For extracting strings, I'd like to do it in a way that prepares for internationalization, probably with this approach: https://wiki.haskell.org/Internationalization_of_Haskell_programs_using_Haskell_data_types (created #45)

@avh4 avh4 merged commit 46d35a4 into avh4:master Oct 26, 2015
@Janiczek Janiczek deleted the formatDirectory branch October 27, 2015 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants