-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(build): #16 enhance try cognitive complexity
- Consider the case when multiple exceptions are caught in a single try block. - Update the test case to cover the new feature.
- Loading branch information
1 parent
b8bba38
commit a1d30a2
Showing
3 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
@atatus.capture_span() | ||
def k8s_check_host_pid( | ||
shard: GraphShard, method_supplies: MethodSupplies | ||
) -> MethodExecutionResult: | ||
method = MethodsEnum.K8S_CHECK_HOST_PID | ||
|
||
def n_ids() -> Iterator[NId]: | ||
graph = shard.syntax_graph | ||
integrity = check_template_integrity_for_all_nodes( | ||
graph, method_supplies.selected_nodes | ||
) | ||
if integrity: # 2 (nested = 1) | ||
for nid in method_supplies.selected_nodes: # 3 (nested = 2) | ||
for c_id in get_host_pid(graph, nid): # 4 (nested = 3) | ||
yield c_id | ||
|
||
return get_vulnerabilities_from_n_ids( | ||
n_ids=n_ids(), | ||
query_supplies=QuerySupplies( | ||
desc_key="f267.k8s_check_host_pid", | ||
desc_params={}, | ||
method=method, | ||
method_calls=len(method_supplies.selected_nodes), | ||
graph_shard=shard, | ||
), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters