You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
refactor(gazelle): report missing BUILD_WORKSPACE_DIRECTORY key more directly (#3240)
Replace `os.environ.get("BUILD_WORKSPACE_DIRECTORY")` with
`os.environ["BUILD_WORKSPACE_DIRECTORY"]`.
The former may return None if the environment variable is not set, in
which case the code will crash with a TypeError when the line is run
since the result is concatenated with a `pathlib.Path` object, and is
therefore making it impossible to use rules_python_gazelle_plugin along
with rules_mypy:
These changes allow rules_mypy users to also use
rules_python_gazelle_plugin without having to work around the type
error.
Now if the environment variable is not set, the code will still crash,
but now with an error that better indicates the failed precondition,
namely `KeyError("BUILD_WORKSPACE_DIRECTORY")` rather than
`TypeError("unsupported operand type(s) for /: 'PosixPath' and
'NoneType')`.
0 commit comments