We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
For files that contain syntax errors, instead of crashing immediately we should simply ignore it (just like other tools, e.g black).
The text was updated successfully, but these errors were encountered:
Not the most robust, but this enough to id misbehaving files, and to work around #20.
diff --git a/teyit.py b/teyit.py index 60f87ad..d3f84f4 100644 --- a/teyit.py +++ b/teyit.py @@ -334,7 +334,11 @@ def _refactor_file(path, **kwargs): with tokenize.open(path) as file: source = file.read() encoding = file.encoding - refactored_source, refactors = refactor_until_deterministic(source, **kwargs) + try: + refactored_source, refactors = refactor_until_deterministic(source, **kwargs) + except SyntaxError: + print(f"Failed: {path}") + return [] if refactored_source != source: path.write_text(refactored_source, encoding=encoding) return refactors
Sorry, something went wrong.
No branches or pull requests
For files that contain syntax errors, instead of crashing immediately we should simply ignore it (just like other tools, e.g black).
The text was updated successfully, but these errors were encountered: