elm-analyse icon indicating copy to clipboard operation
elm-analyse copied to clipboard

Allow fixing a whole file or project

Open antew opened this issue 5 years ago • 3 comments

This came about from integration with the language server so that we could have a "Fix all issues in this file" action, it seemed like it would be nice to have in the CLI tool, so I also added some options for that.

  • To fix a single file: elm-analyse --fix src/Main.elm or elm-analyse -f src/Main.elm

fix-file

  • To fix an entire project: elm-analyse --fix-all

fix-all

  • Less verbose logging when running in CLI mode, it now replaces the output of each line for info messages, and prints other messages on newlines. I'm not sure if belongs along with this PR, if you aren't a fan I can remove it :)

When fixing a file it will apply a single fix, then re-analyze the file, and apply the next fix. I tried fixing files from the bottom up, but ran into issues when there were multiple issues on one line, like in an import list with a few unused variables.

antew avatar Oct 29 '19 00:10 antew

Can we move this forward?

razzeee avatar Jan 03 '20 10:01 razzeee

My colleague came across the fix-all flag by finding & running the install from his vim/language-server setup. It allowed us to use elm-analyse to quickly fix 600/750 errors we had automatically and was a life-saver for speeding up adoption in the code base.

michaeljones avatar Jan 07 '20 17:01 michaeljones

Hi @antew I am confused, I've installed elm-analyse from your branch and neither the --fix or the --fix-all flag seem to have any effect.

maca avatar Apr 24 '20 20:04 maca