-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
Code Analysis Issue
Severity: Low
File: Multiple files, particularly in URL construction.
Description
Recommendation
- Use
urllib.parse.urljoin: For constructing URLs, useurllib.parse.urljointo ensure correct URL joining and escaping. This is generally safer and more readable than manual string concatenation.
2. Pre-compute static parts: If parts of a string are static, pre-compute them outside the loop to avoid repeated string formatting.
import urllib.parse
base_url = "https://api.github.com/repos"
# Instead of:
# url = f'https://api.github.com/repos/{owner}/{repo}/pulls?state=all'
# Use:
url = urllib.parse.urljoin(f"{base_url}/{owner}/{repo}/", "pulls?state=all")This issue was automatically generated by code analysis.