Skip to content

FURB103 false positive for python <3.10 #12222

@danieleades

Description

@danieleades

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

Metadata

Metadata

Labels

bugSomething isn't workinghelp wantedContributions especially welcome

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions