[Refactor:System] Enable Pylint for json_syntax_checker.py#12907
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #12907 +/- ##
=========================================
Coverage 21.64% 21.64%
Complexity 9861 9861
=========================================
Files 268 268
Lines 36920 36920
Branches 495 495
=========================================
Hits 7990 7990
Misses 28439 28439
Partials 491 491
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
dandrecollins07-ctrl
left a comment
There was a problem hiding this comment.
Tested on main and confirmed grading/json_syntax_checker.py was still listed in .pylintrc. Checked out this PR, confirmed the file was removed from the ignore list, and ran python3 -m pylint grading/json_syntax_checker.py, which passed with a score of 10.00/10. Minor common CI testing issues. Approving.
| except Exception: | ||
| print(f'ERROR: Could not load {args.file}') | ||
| KEYS_STR = ", ".join(f"{{ {keys} }}" for keys in reversed(duplicate_keys)) | ||
| print(f"WARNING: Duplicate JSON key(s) found - {KEYS_STR}") | ||
| except (OSError, json.JSONDecodeError, ValueError): | ||
| print(f"ERROR: Could not load {args.file}") |
There was a problem hiding this comment.
This isn't guaranteed to be a safe change. In the future, these types of bare exceptions should be handled by adding inline ignores.
I think this specific instance is acceptable because the failure case is a stack trace anyway.
Why is this Change Important & Necessary?
Continuing the work of enabling pylint on files listed in .pylintrc.
What is the New Behavior?
grading/json_syntax_checker.py will now pass pylint checks and has been removed from the ignored paths in .pylintrc.
What steps should a reviewer take to reproduce or test the bug or new feature?
Run pylint on grading/json_syntax_checker.py with
python3 -m pylint grading/json_syntax_checker.pyAutomated Testing & Documentation
CI will now be able to test the file.