Skip to content

UP015's range and message are slightly incorrect #15863

@InSyncWithFoo

Description

@InSyncWithFoo

Minimal reproducible example (playground):

open(
    '.txt',
    'r'
)
$ ruff check --isolated --select UP015
.py:1:1: UP015 [*] Unnecessary open mode parameters
  |
1 | / open(
2 | |     '.txt',
3 | |     'r'
4 | | )
  | |_^ UP015
  |
  = help: Remove open mode parameters

Found 1 error.
[*] 1 fixable with the `--fix` option.

There is only one mode parameter, and the value passed to that parameter is called an argument. Additionally, the range is much wider than is necessary; it should cover that argument but nothing else.

Metadata

Metadata

Assignees

No one assigned

    Labels

    breakingBreaking API changediagnosticsRelated to reporting of diagnostics.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions