MartinThoma / flake8-simplify

❄ A flake8 plugin that helps you to simplify code
MIT License
187 stars 19 forks source link

[Adjust Rule] loosen SIM115 when just opening a file without reference #174

Open jamesbraza opened 1 year ago

jamesbraza commented 1 year ago

Desired change

Explanation

Why is the adjustment necessary / better?

When not referencing the return of open, context management isn't necessary.

Example

This is an example where the mentioned rule(s) would currently be suboptimal:

# Not referencing the return, simply just creating an empty file
open(path, mode="w")