Closed
Description
Bug description
Given this code snippet:
try:
yamllint.cli.run([document])
except SystemExit as e:
lint_result = e.code
else:
sys.exit("Error, yamllint didn't raise expected SystemExit exception.")
if lint_result != 0:
sys.exit("Error, no lint clean yaml.")
my_print("OK.", style="blue")
Since sys.exit()
in the else branch is aborting, there is no doubt that lint_result
must be assigned.
Configuration
No configuration
Command used
pylint m.py
Pylint output
Warning used-before-assignment for the `lint_result` usage.
Expected behavior
Warning should not be given.
Pylint version
pylint 2.15.3
astroid 2.12.10
Python 3.9.2 (default, Feb 28 2021, 17:03:44)
OS / Environment
Debian Buster with PyPI packages
Additional dependencies
No response