canonical / canonical/craft-application

Remove `work_dir` argument from `ProviderService` methods

Open
#606 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14
Forks
29
Avg merge
2d 3h
Merged PRs (30d)
12

Description

### Bug Description

The `ProviderService` class's `__init__` takes a `work_dir` argument, stored as `self._work_dir`. Some `ProviderService` methods use this, but others take their own `work_dir` and use that instead. This situation is confusing at best, a source of potential bugs at worst.

Ideally, all `work_dir` arguments to methods can be removed and replaced with `self._work_dir`. If some method(s) actually do need a different work dir, perhaps the argument should be named something different? Or if it truly should be called `work_dir` and methods need to take their own, comment(s) illuminating the situation should be added.

This same situation doesn't exist on other `service` classes.

### To Reproduce

`vi craft_application/services/provider.py`

Contributor guide

Open the contributing guide

Research direction

Open craft_application/services/provider.py and inspect ProviderService.__init__ alongside every method that accepts or uses work_dir. Determine whether each method should rely on self._work_dir or needs a distinct, clearly explained argument; done means the inconsistency is resolved and any necessary exception is documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.