ahupp / python-magic

A python wrapper for libmagic
Other
2.59k stars 280 forks source link

`test_descriptions_no_json()` is defined twice #323

Closed cclauss closed 3 months ago

cclauss commented 3 months ago

% ruff check --select=F811 # https://docs.astral.sh/ruff/rules/redefined-while-unused

F811 Redefinition of unused `test_descriptions_no_json` from line 195

Redefinitions of unused names are unnecessary and often indicative of a mistake.

https://github.com/ahupp/python-magic/blob/fc7ebc0d6f9e34d422dbf49aec2382e4a5bde379/test/python_magic_test.py#L195-L205

One of these functions should be renamed to be unique.

% ruff rule F811

redefined-while-unused (F811)

Derived from the Pyflakes linter.

Fix is sometimes available.

What it does

Checks for variable definitions that redefine (or "shadow") unused variables.

Why is this bad?

Redefinitions of unused names are unnecessary and often indicative of a mistake.

Example

import foo
import bar
import foo  # Redefinition of unused `foo` from line 1

Use instead:

import foo
import bar
ahupp commented 3 months ago

fixed in 4b776d72729b4a1cf87f6939089cacdeff171972