bitovi / bitovi/bitops

Refactor deploy_plugins() in deploy_plugins.py

Open
#328 0 comments 0 reactions 0 assignees View on GitHub
enhancement ✨ good first issue refactor
Dominant language
Python
Stars
37
Forks
9
PR merge metrics
No merged PRs in 30d

Description

This is an unfinished refactoring sub-task coming from the [Add Pylint as a python static code analyzer #298](https://github.com/bitovi/bitops/pull/298).

The `deploy_plugins()` function in `deploy_plugins.py` is failing pylint check on:
> scripts/plugins/deploy_plugins.py:24:0: R0914: Too many local variables (36/15) (too-many-locals)
> scripts/plugins/deploy_plugins.py:24:0: R0912: Too many branches (19/12) (too-many-branches)
> scripts/plugins/deploy_plugins.py:24:0: R0915: Too many statements (104/50) (too-many-statements)

The function has more than 250+ lines and pylint with multiple warnings is a great indicator that it needs to be restructured and divided into smaller logical pieces. For instance:
* Extract it into a new `Plugin` class perhaps with another layer `PluginDeployer` (note: `PluginInstaller` #329 ) with multiple methods, so the interface would be `Plugin.deploy()` that we can call while iterating over each plugin in the sequence.
* Then another class `PluginConfig` would handle plugin config parsing and processing.

The check is silenced for now, don't forget to unsilence it when the refactoring is done.

Contributor guide

Open the contributing guide

Research direction

Start in scripts/plugins/deploy_plugins.py by reading deploy_plugins() and the currently silenced pylint warnings: too-many-locals, too-many-branches, and too-many-statements. Review the related Add Pylint pull request #298 and the PluginInstaller follow-up #329 for context. Done means the function is restructured, the pylint check is unsilenced, and these warnings no longer occur.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
devops
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.