This repository was archived by the owner on Dec 24, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Bug: codevalidator -f crashes and leaves my file empty when using non-ASCII characters #37
Comments
Here is my ~/.codevalidatorrc. I think nothing special is in there.
|
I just tried this again on my home computer with a fresh clone of the repository, and it does create a backup copy in the |
ePaul
pushed a commit
to ePaul/codevalidator
that referenced
this issue
Aug 2, 2015
This file can be checked with codevalidator (complains about trailing white space, use of tabs, use of carriage return), but with the current code it can't be fixed (will be overwritten with an empty file). hjacobs#37
ePaul
pushed a commit
to ePaul/codevalidator
that referenced
this issue
Aug 2, 2015
This file can be checked with codevalidator (complains about trailing white space, use of tabs, use of carriage return), but with the current code it can't be fixed (will be overwritten with an empty file). hjacobs#37
ePaul
pushed a commit
to ePaul/codevalidator
that referenced
this issue
Aug 5, 2015
This file can be checked with codevalidator (complains about trailing white space, use of tabs, use of carriage return), but with the current code it can't be fixed (will be overwritten with an empty file). hjacobs#37
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Summary
When a YAML file contains a character outside of ASCII as well as trailing whitespaces,
codevalidator -f filename
will crash with an (not that useful) error message and leave the file empty, at the same time not even creating a backup copy.Fortunately I did a
git add
beforehand.How to reproduce
I'm using codevalidator 0.8.2, judging from
pip show codevalidator
(codevalidator itself doesn't have a --version option).Here is an example file (encoded as UTF-8):
This has a trailing space in line 5, and an
–
(en-dash) in line 6. I guess the latter causes codevalidator to crash, the former makes it try to correct at all.Here is the output for this file:
No .pre-cvfix file is created in this case (but one is created if I replace the
–
by-
).It looks like it is using 'ascii' as the codec instead of an unicode one.
Expected behaviour
Codevalidator should be able to handle UTF-8 encoded files.
Even if it is not able to fix my file, it should certainly not destroy it (overwriting it with an empty file).
Even if it does that, it should create a backup copy (unless being told not to by
--no-backup
).Workaround
Make sure only ASCII characters are used in files passed to codevalidator.
And if you are not sure, make a copy of the file beforehands.
The text was updated successfully, but these errors were encountered: