Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some drive-by easy-to-fix code smells #1174

Closed
akaihola opened this issue Aug 25, 2024 · 1 comment · Fixed by #1216
Closed

Some drive-by easy-to-fix code smells #1174

akaihola opened this issue Aug 25, 2024 · 1 comment · Fixed by #1216

Comments

@akaihola
Copy link
Contributor

Issue

This is a collection of things I noticed in the Aider code base while working on it. These should all be trivial to clean up without changing behavior or breaking anything. I'm happy to make a PR or PRs for these if needed.

Variable added_fnames in cmd_add is only modified, never read

555:     def cmd_add(self, args):
...
558:         added_fnames = []
...
613:                     added_fnames.append(matched_file)
...
633:                     added_fnames.append(matched_file)

expand_subdir() yields both Paths and strs

def expand_subdir(file_path):
    file_path = Path(file_path)
    if file_path.is_file():
        yield file_path          # <-- this is a `Path`
        return

    if file_path.is_dir():
        for file in file_path.rglob("*"):
            if file.is_file():
                yield str(file)  # <-- this is a `str`

Version and model info

Aider 0.52.2-dev 483b7ec

@paul-gauthier
Copy link
Collaborator

Thanks for trying aider and filing this issue.

A PR would be welcome.

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 a pull request may close this issue.

2 participants