Skip to content

False positive for WPS237 #3506

@incendius679

Description

@incendius679

What's wrong

I encountered this error in one of my functions for a game on Pygame, and after reviewing the WPS documentation, I believe it is a false positive. Please review the function yourself.

def draw(self: Self) -> None:
      """Draw the top bar with the current game statistics.

      This method fills the top bar with a gray background and renders the
      current score, elapsed time, number of flags, wins, and losses. It
      positions the text according to the predefined UI positions and
      updates the display.
      """
      self. Fill(GRAY)
      score_text: pygame.Surface = self._font.render(
          f"Score: {self.stats.score}", True, BLACK
      )
      time_text: pygame.Surface = self._font.render(
          f"Time: {self.timer.elapsed_time}", True, BLACK
      )
      num_flags_text: pygame.Surface = self._font.render(
          f"Flags: {self.stats.num_flags}", True, BLACK
      )
      wins_text: pygame.Surface = self._font.render(
          f"Wins: {self.stats.wins}", True, BLACK
      )
      losses_text: pygame.Surface = self._font.render(
          f"Losses: {self.stats.losses}", True, BLACK
      )
      self.blit(
          score_text,
          (
              self._positions.score[0] * self._width,
              self._positions.score[1] * self._height,
          ),
      )
      self.blit(
          time_text,
          (
              self._positions.time[0] * self._width,
              self._positions.time[1] * self._height,
          ),
      )
      self.blit(
          num_flags_text,
          (
              self._positions.flags[0] * self._width,
              self._positions.flags[1] * self._height,
          ),
      )
      self.blit(
          wins_text,
          (
              self._positions.wins[0] * self._width,
              self._positions.wins[1] * self._height,
          ),
      )
      self.blit(
          losses_text,
          (
              self._positions.losses[0] * self._width,
              self._positions.losses[1] * self._height,
          ),
      )

How it should be

I don't think it should make a mistake.

Flake8 version and plugins

  "platform": {
    "python_implementation": "CPython",
    "python_version": "3.13.5",
    "system": "Linux"
  },
  "plugins": [
    {
      "plugin": "Flake8-pyproject",
      "version": "1.2.3"
    },
    {
      "plugin": "darglint",
      "version": "1.8.1"
    },
    {
      "plugin": "flake8-annotations",
      "version": "3.1.1"
    },
    {
      "plugin": "flake8-bugbear",
      "version": "24.12.12"
    },
    {
      "plugin": "flake8-builtins",
      "version": "2.5.0"
    },
    {
      "plugin": "flake8-comprehensions",
      "version": "3.16.0"
    },
    {
      "plugin": "flake8-eradicate",
      "version": "1.5.0"
    },
    {
      "plugin": "mccabe",
      "version": "0.7.0"
    },
    {
      "plugin": "pycodestyle",
      "version": "2.14.0"
    },
    {
      "plugin": "pyflakes",
      "version": "3.4.0"
    },
    {
      "plugin": "wemake-python-styleguide",
      "version": "1.3.0"
    }
  ],
  "version": "7.3.0"
}

pip information

(Note: I don't use pip, I use uv)
uv 0.8.5
asteroid==3.3.11
attrs==25.3.0
bandit==1.8.6
black==25.1.0
click==8.2.1
darglint==1.8.1
dill==0.4.0
eradicate==2.3.0
flake8==7.3.0
flake8-annotations==3.1.1
flake8-bugbear==24.12.12
flake8-builtins==2.5.0
flake8-comprehensions==3.16.0
flake8-eradicate==1.5.0
flake8-pyproject==1.2.3
isort==6.0.1
markdown-it-py==3.0.0
mccabe==0.7.0
mdurl==0.1.2
mypy==1.17.1
mypy-extensions==1.1.0
packaging==25.0
pathspec==0.12.1
pbr==6.1.1
platformdirs==4.3.8
pycodestyle==2.14.0
pyflakes==3.4.0
pygame==2.6.1
pygments==2.19.2
pylint==3.3.7
pyyaml==6.0.2
rich==14.1.0
ruff==0.12.8
setuptools==80.9.0
stevedore==5.4.1
tomlkit==0.13.3
typing-extensions==4.14.1
wemake-python-styleguide==1.3.0

OS information

Google Chrome OS Version 138.0.7204.178 (Official build) (ARM 64 bits)
With Debian GNU/Linux 12 (bookworm)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions