Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the metric of the most-used-components #11738

Merged
merged 1 commit into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions utils/profile_tool/most_used_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,9 @@


def _count_components(components, rules_list, components_out):
for rule in rules_list:
component = get_component_name_by_rule_id(rule, components)
components_out[component] += 1


def get_component_name_by_rule_id(rule_id, components):
for component in components.values():
if rule_id in component.rules:
return component.name
return "without_component"
for component_name, component in components.items():
if len(set(component.rules).intersection(set(rules_list))) > 0:
components_out[component_name] += 1


def load_components(product):
Expand Down Expand Up @@ -59,5 +52,5 @@ def command_most_used_components(args):
_process_all_products_from_controls(components, args.products)

sorted_components = _sorted_dict_by_num_value(components)
csv_header = "component_name,count_of_rules"
csv_header = "component_name,count_of_profiles"
generate_output(sorted_components, args.format, csv_header)
Loading