Change the extension used by perltidy.#3052
Open
drgrice1 wants to merge 1 commit into
Open
Conversation
This is to address openwebwork/pg#1018 (comment). The two settings that affect backups for `perltidy` are `-b` (or `--backup-and-modify-in-place`) and `-bext` (or `--backup-file-extension`). The `-b` option is boolean and if given it means that a backup of the original Perl file will be created with the extension specified by the `-bext` option, and the original Perl file will be modified in place. This is currently set by default in the `.perltidyrc` file that we use. If this option is not given, then the original Perl file is never modified, and the result of running `perltidy` is saved in a new file with the extension `.tdy`. The `-bext` option sets the file extension that is used when the `-b` option is set, and determines if the backup file should be kept. The default value is `bak` which means the extension `.bak` is used and the backup will be kept. If this is set to a value that does not include a forward slash, then its value will be used for the extension and the backup will be kept. If the value is set to something that has a forward slash in it, then the backup will be created with that extension, but will be deleted if there are no errors. This is currently set by default in the `bin/dev_scripts/run-perltidy.pl` script. This changes the `-bext` value set by the `bin/dev_scripts/run-perltidy.pl` to `/tidybak`. That means that a backup file will be created with the extension `.tidybak`, but will be deleted if there are no errors. This will fix @Alex-Jordan's issue because it will not touch any file with the `.bak` extension. Note that anyone that creates backups with the `.tidybak` extension will end up having the same problem, but the extension is chosen because no one really should be using that, and it should not conflict.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is to address openwebwork/pg#1018 (comment).
The two settings that affect backups for
perltidyare-b(or--backup-and-modify-in-place) and-bext(or--backup-file-extension).The
-boption is boolean and if given it means that a backup of the original Perl file will be created with the extension specified by the-bextoption, and the original Perl file will be modified in place. This is currently set by default in the.perltidyrcfile that we use. If this option is not given, then the original Perl file is never modified, and the result of runningperltidyis saved in a new file with the extension.tdy.The
-bextoption sets the file extension that is used when the-boption is set, and determines if the backup file should be kept. The default value isbakwhich means the extension.bakis used and the backup will be kept. If this is set to a value that does not include a forward slash, then its value will be used for the extension and the backup will be kept. If the value is set to something that has a forward slash in it, then the backup will be created with that extension, but will be deleted if there are no errors. This is currently set by default in thebin/dev_scripts/run-perltidy.plscript.This changes the
-bextvalue set by thebin/dev_scripts/run-perltidy.plto/tidybak. That means that a backup file will be created with the extension.tidybak, but will be deleted if there are no errors.This will fix @Alex-Jordan's issue because it will not touch any file with the
.bakextension. Note that anyone that creates backups with the.tidybakextension will end up having the same problem, but the extension is chosen because no one really should be using that, and it should not conflict.