Skip to content

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

@jamesbraza

Description

@jamesbraza

Desired change

  • Rule(s): SIM115
  • Adjustment: should not be triggered when not referencing the return

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")

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions