-
Notifications
You must be signed in to change notification settings - Fork 419
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
Initial spike on Autocorrect #985
base: master
Are you sure you want to change the base?
Commits on Jul 27, 2022
-
Add autocorrect to default suggest pipeline
At this point the pipeline for the default "suggest" task has been modified to include an Autocorrect step. That's all hooked up, and a callback for `autocorrect/1` has been added to the `Credo.Check` behaviour and the default implementation. This can be implemented for each check individually, and it's a noop for now.
Configuration menu - View commit details
-
Copy full SHA for 140488b - Browse repository at this point
Copy the full SHA 140488bView commit details -
Add run autocorrect task & tests
At this point the task in the execution pipeline for running the autocorrect is implemented & tested. It's naive, but it should work in basic cases!
Configuration menu - View commit details
-
Copy full SHA for 0ef3eb7 - Browse repository at this point
Copy the full SHA 0ef3eb7View commit details -
Autocorrect implemented & working for a single check
At this point we have autocorrect functionality implemented & working for the TrailingBlankLine check. I've verified this with manual testing. The UX still has a ton of work to do, but for now the bulk of the work is actually working.
Configuration menu - View commit details
-
Copy full SHA for 7a0dada - Browse repository at this point
Copy the full SHA 7a0dadaView commit details -
Now able to pass
--autocorrect
flag tomix credo
We can now pass an `--autocorrect` flag to the default `suggest` command when running `mix credo` and it works!
Configuration menu - View commit details
-
Copy full SHA for 93cba5d - Browse repository at this point
Copy the full SHA 93cba5dView commit details -
Remove autocorrected issues before displaying results
Now when we autocorrect an issue, we remove that issue from the stored list of issues so it isn't shown to the user (since technically it's no longer an issue since it was autocorrected). One other thing we might do is to change the formatter to display when an issue was there and to indicate that it was autocorrected, also making sure the exit code is 0 for any autocorrected issues, but for now this seemed like a reasonable path forward and much simpler than this option.
Configuration menu - View commit details
-
Copy full SHA for a0042a5 - Browse repository at this point
Copy the full SHA a0042a5View commit details -
Implement most basic version of alias ordering autocorrect
At this point it will autocorrect the most basic version of alias ordering, but it doesn't yet handle multi-aliases or handle groupings of aliases. That will come in a later commit.
Configuration menu - View commit details
-
Copy full SHA for b98842f - Browse repository at this point
Copy the full SHA b98842fView commit details -
More alias ordering autocorrect behavior implemented
More basics of the autocorrect behavior for the alias ordering check have been implemented, and now we just need to handle blocks of aliases with whitespace between them.
Configuration menu - View commit details
-
Copy full SHA for f5f1343 - Browse repository at this point
Copy the full SHA f5f1343View commit details -
"Finish" implementing autocorrect for ordering aliases
We've now handled pretty much all the use cases for ordering aliases automatically. There is some formatter whackiness that will need to be figured out, but beyond that this is a good example of how an autocorrect callback might be implemented for a more involved check than the first one.
Configuration menu - View commit details
-
Copy full SHA for 0d84490 - Browse repository at this point
Copy the full SHA 0d84490View commit details
Commits on Jul 28, 2022
-
Add autocorrect callback for line endings consistency check
This is the first implementation of an autocorrect callback for a consistency check. I don't _love_ how we're doing it right now since we're not actually storing the state of what the "correct" behavior is that should be changed to, so instead we're just using the issue message to give us information about what the autocorrect behavior should be. It's not great, but it works!
Configuration menu - View commit details
-
Copy full SHA for fb4be0e - Browse repository at this point
Copy the full SHA fb4be0eView commit details -
Add autocorrect for unless with else check
This autocorrects an unless with else check so that we're changing it to an `if` statement.
Configuration menu - View commit details
-
Copy full SHA for ab77dcd - Browse repository at this point
Copy the full SHA ab77dcdView commit details -
Add basics for unused string operation autocorrect
This adds the first bits of an implementation for how we might want to autocorrect an unused String operation. Unfortunately because there's nothing in the AST that represents **nothing**, anything we replace that unused String operation with in the AST will be compiled into something - even if just the literal atom `nil`. That would probably be better than unused String operations since those would just be noops in the runtime, but they would be potentially confusing in the code. If we want to actually do this there's probably a _lot_ more that would need to be done for this check, but what we have offers a glimpse into how this kind of check could be autocorrected as a proof of concept.
Configuration menu - View commit details
-
Copy full SHA for acd96bb - Browse repository at this point
Copy the full SHA acd96bbView commit details
Commits on Jul 29, 2022
-
Configuration menu - View commit details
-
Copy full SHA for 4bb4095 - Browse repository at this point
Copy the full SHA 4bb4095View commit details