Open jabraham17 opened 7 months ago
As a part of this, there should be a --dryrun
flag which shows essential a patch file for what changes will be made.
A further user experience improvement would be to have the interactive mode print out what changes are actually going to be made, rather than just the fixit description
In #24663 and #24744, I have been implementing automatic fixits for chplcheck. This allows users to automatically fix issues in their code. However, fixits cannot be applied blindly as they may break code. This is somewhat mitigated by #24744 where users can use
--interactive
to selectively apply fixits, but this provides no protection to users who blindly apply--fixit
For example, the following code cause
chplcheck --fixit
to break codeAfter applying the fixit for an unused loop index, the code will look like the following
This is due to how the locations work in the current parser, and this is not an easy fix (that I can think of). However, if a user blindly applies the fixits, there code will no longer compile.
Another example occurs when multiple fixits are applied on top of each other
In this case, 2 fixits will be applied (unused loop index and unnecessary do keyword). However, because these overlap on the same lines
chplcheck --fixit
will create a very garbled loop.I think there are two things to improve here: