Skip to content

UnboundLocalError: "bazel-path for autobazel-attribute looks strange" warning is hit #24

@adamtheturtle

Description

@adamtheturtle

See the following code

def _handle_attribute(self):
"""Cares about the correct handling of autobazel-attributes"""
attribute_path = self.arguments[0]
try:
package_name, target_name, rule_name, attribute_name = attribute_path.rsplit(':', 3)
except (IndexError, ValueError):
self.log.warning("bazel-path for autobazel-attribute looks strange: {}".format(attribute_path))
if target_name.startswith('/'):

If the except clause is hit, target_name is not set and therefore the startswith check will error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions