-
Notifications
You must be signed in to change notification settings - Fork 25
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
Add try/except blocks around external text file read operations to catch encoding-related exceptions #31
Merged
Conversation
This file contains 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
(1) Modifying Python 2 functions and code style not compatible with Python 3, including adding parentheses to all "print" invocations (2) Updating the version string from "0.2.2.13" to "0.3.0.1" (3) Minor grammatical corrections (4) Changing "except Usage" to "except Exception" (solved a thrown exception when Usage() function invoked internally)
(2) Modified all file(...) calls to open(...) (3) Modified calls to deprecated CmpObjects(...) comparison function (not supported in Python 3) to call a new function CmpObjects() in nsiqcppstyle_util.py (4) Removed redundant "import" statements in all engine script files (5) Moved all duplicate functions to nsiqcppstyle_util.py, all source files now call these functions (6) Removed all explicit Python 2.x code
…se are meant to catch any Unicode-related exceptions thrown while reading these files (e.g., the file contains an invalid UTF-8 sequence), providing more robust code. The except clauses will log a message pointing to the file that causes the exception. External files include: (*) C++ source file being processed (*) The filefilter.txt file (*) Rule Python script files
…nto kunaltyagi-master # Conflicts: # nsiqcppstyle_exe.py
kunaltyagi
requested changes
Jun 21, 2022
I think you've not pushed the latest changes |
Got it - as part of the mixup, I needed to merge my repo's pull request-created branch into its master branch. Now you can see the changes. |
kunaltyagi
reviewed
Jun 22, 2022
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor comment, rest lgtm
kunaltyagi
approved these changes
Jun 23, 2022
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.
Added try/except blocks around read operations of external files. These are meant to catch any Unicode-related exceptions thrown while reading these files (e.g., the file contains an invalid UTF-8 sequence), providing more robust code. The except clauses will log a message pointing to the file that causes the exception. External files include:
These modifications were made because NsiqCppStyle often failed to read external files, due to encoding issues in the source files (e.g., invalid UTF-8 sequences, incorrect UTF16 encoding). I was often left puzzling over which file had the invalid sequence. With the try/except blocks, the user is told which file is problematic.