Skip to content

✨ Quality: Unexpanded tilde in file path#2283

Merged
soxoj merged 1 commit intosoxoj:mainfrom
tang-vu:contribai/improve/quality/unexpanded-tilde-in-file-path
Mar 21, 2026
Merged

✨ Quality: Unexpanded tilde in file path#2283
soxoj merged 1 commit intosoxoj:mainfrom
tang-vu:contribai/improve/quality/unexpanded-tilde-in-file-path

Conversation

@tang-vu
Copy link
Copy Markdown
Contributor

@tang-vu tang-vu commented Mar 20, 2026

Closes #2282

✨ Code Quality

Problem

The path '~/.maigret/settings.json' uses a tilde (~) which is not automatically expanded by Python's open() function. This will cause the settings file in the user's home directory to be silently ignored (caught by FileNotFoundError) because Python will look for a literal directory named ~ in the current working directory.

Severity: medium
File: maigret/settings.py

Solution

Use os.path.expanduser('~/.maigret/settings.json') or pathlib.Path('~/.maigret/settings.json').expanduser() to properly resolve the home directory path.

Changes

  • maigret/settings.py (modified)

Testing

  • Existing tests pass
  • Manual review completed
  • No new warnings/errors introduced


🤖 About this PR

This pull request was generated by ContribAI, an AI agent
that helps improve open source projects. The change was:

  1. Discovered by automated code analysis
  2. Generated by AI with context-aware code generation
  3. Self-reviewed by AI quality checks

If you have questions or feedback about this PR, please comment below.
We appreciate your time reviewing this contribution!

The path `'~/.maigret/settings.json'` uses a tilde (`~`) which is not automatically expanded by Python's `open()` function. This will cause the settings file in the user's home directory to be silently ignored (caught by `FileNotFoundError`) because Python will look for a literal directory named `~` in the current working directory.

Affected files: settings.py
@soxoj
Copy link
Copy Markdown
Owner

soxoj commented Mar 21, 2026

Thank you! 🪄

@soxoj soxoj merged commit 5b7b28e into soxoj:main Mar 21, 2026
4 checks passed
soxoj pushed a commit that referenced this pull request Mar 22, 2026
The path `'~/.maigret/settings.json'` uses a tilde (`~`) which is not automatically expanded by Python's `open()` function. This will cause the settings file in the user's home directory to be silently ignored (caught by `FileNotFoundError`) because Python will look for a literal directory named `~` in the current working directory.

Affected files: settings.py
soxoj pushed a commit that referenced this pull request Mar 22, 2026
The path `'~/.maigret/settings.json'` uses a tilde (`~`) which is not automatically expanded by Python's `open()` function. This will cause the settings file in the user's home directory to be silently ignored (caught by `FileNotFoundError`) because Python will look for a literal directory named `~` in the current working directory.

Affected files: settings.py
soxoj pushed a commit that referenced this pull request Apr 7, 2026
The path `'~/.maigret/settings.json'` uses a tilde (`~`) which is not automatically expanded by Python's `open()` function. This will cause the settings file in the user's home directory to be silently ignored (caught by `FileNotFoundError`) because Python will look for a literal directory named `~` in the current working directory.

Affected files: settings.py
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.

fix: unexpanded tilde in file path

2 participants