Refactor: use shutil.which instead of manual PATH walk in PosixHelpRenderer
- Dominant language
- Python
- Stars
- 17.3k
- Forks
- 4.6k
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 13
Description
## Summary
\`PosixHelpRenderer._exists_on_path\` in \`awscli/help.py\` (lines ~162-170) manually reimplements PATH lookup by joining each PATH entry with \`os.path.join\`/\`os.path.exists\` inside a list comprehension, then calls \`any()\` on the resulting list.
## Proposed change
Use the stdlib \`shutil.which\` (available since Python 3.3): \`return shutil.which(name) is not None\`. Removes the manual PATH-walking logic and avoids building a throwaway list. Pure refactor, no behavior change.
Contributor guide
Research direction
Start by reviewing PosixHelpRenderer._exists_on_path and the surrounding imports in awscli/help.py, around lines 162-170. Done means the manual PATH walk is replaced as proposed without changing the method's behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Refactor
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100