Skip to content

Rule A003 intended behaviour #23074

@billf11

Description

@billf11

Question

Hi Ruff-Team,

I am wondering what the intended behavior of the rule A003 is as the output of ruff, by running it installed with uv tool install ruff, on the following example code is rather confusing:

#!/usr/bin/env python3


class Testing:
    def __init__(self) -> None:
        self._format: str | None = None

    @property
    def format(self) -> str | None:
        return self._format

    @format.setter
    def format(self, value: str | None) -> None:
        self._format = value


if __name__ == "__main__":
    test = Testing()
    test.format = "example"
    print(f"Format is set to: {test.format}")  # noqa: T201

ruff output:

$ ruff version && ruff check test.py 
ruff 0.15.0 (ce5f7b612 2026-02-03)
A003 Python builtin is shadowed by method `format` from line 9
  --> test.py:12:6
   |
10 |         return self._format
11 |
12 |     @format.setter
   |      ^^^^^^
13 |     def format(self, value: str | None) -> None:
14 |         self._format = value
   |

A003 Python builtin is shadowed by method `format` from line 13
  --> test.py:12:6
   |
10 |         return self._format
11 |
12 |     @format.setter
   |      ^^^^^^
13 |     def format(self, value: str | None) -> None:
14 |         self._format = value
   |

Found 2 errors.

Thus, I am wondering why is it indicating two errors on line 12 in the setter decorator with reference to line 9 and 13 and not at in their corresponding line.

Thanks!

Version

ruff 0.15.0 (ce5f7b6 2026-02-03)

Metadata

Metadata

Assignees

No one assigned

    Labels

    ruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions