kunaltyagi / nsiqcppstyle

Cpp style checker in python
GNU General Public License v2.0
26 stars 24 forks source link

Add try/except blocks around external text file read operations to catch encoding-related exceptions #31

Closed mosherubin closed 2 years ago

mosherubin commented 2 years ago

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.

kunaltyagi commented 2 years ago

I think you've not pushed the latest changes

mosherubin commented 2 years ago

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.