Skip to content

Commit 7c46c53

Browse files
authored
Remove redundant if-condition in the GraphWalker._iter_one (#3654)
## Changes Remove redundant `if`-condition in the `GraphWalker._iter_one` ### Linked issues Progresses #3626 ### Functionality - [x] Code linting
1 parent 6a29424 commit 7c46c53

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

src/databricks/labs/ucx/source_code/linters/graph_walkers.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,15 @@ def _iter_one(self, dependency: Dependency, graph: DependencyGraph, root_path: P
5656
self._lineage.append(dependency)
5757
self._walked_paths.add(dependency.path)
5858
self._log_walk_one(dependency)
59-
if dependency.path.is_file() or is_a_notebook(dependency.path):
60-
inherited_tree = graph.root.build_inherited_tree(root_path, dependency.path)
61-
path_lookup = self._path_lookup.change_directory(dependency.path.parent)
62-
yield from self._process_dependency(dependency, path_lookup, inherited_tree)
63-
maybe_graph = graph.locate_dependency(dependency.path)
64-
# missing graph problems have already been reported while building the graph
65-
if maybe_graph.graph:
66-
child_graph = maybe_graph.graph
67-
for child_dependency in child_graph.local_dependencies:
68-
yield from self._iter_one(child_dependency, child_graph, root_path)
59+
inherited_tree = graph.root.build_inherited_tree(root_path, dependency.path)
60+
path_lookup = self._path_lookup.change_directory(dependency.path.parent)
61+
yield from self._process_dependency(dependency, path_lookup, inherited_tree)
62+
maybe_graph = graph.locate_dependency(dependency.path)
63+
# missing graph problems have already been reported while building the graph
64+
if maybe_graph.graph:
65+
child_graph = maybe_graph.graph
66+
for child_dependency in child_graph.local_dependencies:
67+
yield from self._iter_one(child_dependency, child_graph, root_path)
6968
self._lineage.pop()
7069

7170
def _log_walk_one(self, dependency: Dependency) -> None:

0 commit comments

Comments
 (0)