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

FURB103 false positive for python <3.10 #12222

Closed
danieleades opened this issue Jul 7, 2024 · 1 comment · Fixed by #12244
Closed

FURB103 false positive for python <3.10 #12222

danieleades opened this issue Jul 7, 2024 · 1 comment · Fixed by #12244
Assignees
Labels
bug Something isn't working help wanted Contributions especially welcome

Comments

@danieleades
Copy link

danieleades commented Jul 7, 2024

FURB103 has a false positive if the 'newline' argument is used in python <3.10

consider the following code snippet:

 with open(outfile, 'w', encoding='utf-8', newline=newline) as f:
     f.write(rendered_file)

the lint suggests using

Path(outfile).write_text(rendered_file, encoding='utf-8', newline=newline)

Path.write_text only supports the newline argument for python 3.10+, but this lint suggest the change even if you're targeting an earlier version of Python. This means the lint has to be manually suppressed. see https://github.com/cookiecutter/cookiecutter/pull/2061/files#diff-02c88bfba84f4a832d0e00474c6fac0000b940456bad66d925eaebf5839d94deR256

@MichaReiser MichaReiser added bug Something isn't working help wanted Contributions especially welcome labels Jul 7, 2024
@evanrittenhouse
Copy link
Contributor

Feel free to assign this to me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Contributions especially welcome
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants