-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Reduce code complexity #2801
Comments
Hello @nicolargo, |
@ariel-anieli yes and all code optimization that look interesting to you . Thanks ! |
🙂 Je t'en prie! I will keep you posted. |
Part of nicolargo#2801. Broke `update` in two parts: * if `local`, stats taken from `get_stats_from_std_sys_lib` * and readability achieved by `add_human_readable_name` * else if `snmp`, taken from `update_stats_with_snmp`. `get_stats_from_std_sys_lib` has two helpers: 1. `get_win_version_and_platform`. 2. `get_linux_version_and_distro`. Signed-off-by: Ariel Otilibili <[email protected]>
@nicolargo, I will take on glances.plugins.percpu.PluginModel.msg_curse(). |
Huge task :) This method is historical... |
🙂 I'll have a try. Are there caveats worth noticing? |
Part of nicolargo#2801. Broken `msg_curse`: if stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Broken `msg_curse`: if no stats returns empty list, else: 1. `define_headers_from_os` 2. `maybe_build_string_msg` 3. `display_cpu_stats_per_line` 4. `manage_max_cpu_to_display` 5. Then, for CPU: * `display_cpu_header_in_columns` * `display_cpu_stats_in_columns` 6. Hence, `summarize_all_cpus_not_displayed` Signed-off-by: Ariel Otilibili <[email protected]>
@nicolargo, I am taking on unittest-core.TestGlances._common_plugin_tests(). |
Part of nicolargo#2801. Common tests follows the flow: * `reset_stats_history_and_views` * `do_checks_before_update` * add first element with `update_stats` * `check_stats` * `filter_stats` * add second element `update_stats` * `chk_hist_maybe_add_third_elem` * `check_views`. Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Common tests follows the flow: * `reset_stats_history_and_views` * `do_checks_before_update` * add first element with `update_stats` * `check_stats` * `filter_stats` * add second element `update_stats` * `chk_hist_maybe_add_third_elem` * `check_views`. Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Common tests follows the flow: * `reset_stats_history_and_views` * `do_checks_before_update` * add first element with `update_stats` * `check_stats` * `filter_stats` * add second element `update_stats` * `chk_hist_maybe_add_third_elem` * `check_views`. Signed-off-by: Ariel Otilibili <[email protected]>
I will tackle |
Part of nicolargo#2801. Broken down `__catch_key` in two parts: * `catch_actions_from_hotkey` * `catch_other_actions_maybe_return_to_browser`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * formatted into a dict; if input method is SNMP, returns default stats * if input method is local, calls `get_stats_for_local_input` * it has three steps: `get_private_ipv4`, `get_first_ipv4`, `get_public_ipv4`. Signed-off-by: Ariel Otilibili <[email protected]>
I'll take on |
Part of nicolargo#2801. Signed-off-by: Ariel Otilibili <[email protected]>
Part of nicolargo#2801. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * second take of 09bf06d0e04d036f676a32d4324750cc019334b5 * reverted in 0c635af.
* part of nicolargo#2801 * second take of 09bf06d0e04d036f676a32d4324750cc019334b5 * reverted in 0c635af.
* part of nicolargo#2801 * second take of 1fda541 * reverted in 0c635af.
* part of nicolargo#2801 * second take of 1fda541 * reverted in 0c635af. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * second take of 1fda541 * reverted in 0c635af. Signed-off-by: Ariel Otilibili <[email protected]>
* part of nicolargo#2801 * second take of 1fda541 * reverted in 0c635af. Signed-off-by: Ariel Otilibili <[email protected]>
Reduce complexity of function higher than 20:
https://scrutinizer-ci.com/g/nicolargo/glances/code-structure/develop?elementType=py-function&orderField=conditional_complexity&order=desc&changesExpanded=0
The text was updated successfully, but these errors were encountered: