Skip to content

refactor(main): reduce cyclomatic complexity of init_plugins#3478

Open
wavebyrd wants to merge 6039 commits intonicolargo:developfrom
wavebyrd:reduce-complexity-init-plugins
Open

refactor(main): reduce cyclomatic complexity of init_plugins#3478
wavebyrd wants to merge 6039 commits intonicolargo:developfrom
wavebyrd:reduce-complexity-init-plugins

Conversation

@wavebyrd
Copy link
Copy Markdown

Summary

  • Extracts four focused helper methods from init_plugins in glances/main.py to reduce its cyclomatic complexity from 19 to 1
  • _apply_config_disables: disables plugins listed in glances.conf
  • _apply_plugin_overrides: handles --disable-plugin / --enable-plugin CLI arguments (including the all keyword)
  • _activate_exporters: activates exporters from --export
  • _apply_process_defaults: handles processcount/processlist dependencies and the default export_process_filter
  • No behavioral changes; all original logic is preserved as-is in the extracted methods

Part of #3460.

Test plan

  • Verify ruff check and ruff format --check pass (confirmed locally)
  • Verify radon cc reports init_plugins at complexity A(1), all helpers under B(10)
  • Run existing test suite to confirm no regressions

drake7707 and others added 30 commits December 15, 2025 07:57
Include GTT to mem% for integrated AMD GPUs
License classifiers have been superseded by license expressions (see https://peps.python.org/pep-0639/).
Detailed changes:
- Enable autoescape=True for Jinja2 environment to prevent XSS (B701).
- Add timeout=15s to requests.get in nginx amp (B113).
- Add timeout=15s to post in restful export (B113).
…ty-bandit

fix(security): resolve B701 (Jinja2) and B113 (timeout) vulnerabilities
Update license specification to SPDX format
Fix quicklook in case psutil.cpu_freq().max=0.0
nicolargo and others added 27 commits March 7, 2026 09:29
…hub.com:sdoshi2061/glances into sdoshi2061-mem-plugin_e8a559ce-ab5b-4674-91e2-9c4f42636da2
Unauthenticated Configuration Secrets Exposure
SQL Injection via Process Names in TimescaleDB Export
Updated security patch descriptions with correct CVE identifiers.
Extract four focused helper methods from init_plugins to bring its
cyclomatic complexity from 19 down to 1:

- _apply_config_disables: disable plugins listed in glances.conf
- _apply_plugin_overrides: handle --disable-plugin/--enable-plugin CLI args
- _activate_exporters: activate exporters from --export CLI arg
- _apply_process_defaults: handle processcount/processlist dependencies
  and default export_process_filter

Part of nicolargo#3460.
@wavebyrd wavebyrd force-pushed the reduce-complexity-init-plugins branch from 1e2fd2e to 560d73a Compare March 13, 2026 21:23
@wavebyrd
Copy link
Copy Markdown
Author

Ping on this refactor to reduce cyclomatic complexity. Ready for review!

@nicolargo
Copy link
Copy Markdown
Owner

Sorry @wavebyrd but i can not review a PR with more than 600 files modified (perhaps a format/lint issue in your dev environment (https://github.com/nicolargo/glances/wiki/How-to-contribute-to-Glances-%3F).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.