nwhitehead / pyfluidsynth

Python bindings for FluidSynth
GNU Lesser General Public License v2.1
197 stars 56 forks source link

Undefined names `chan` and `name` in the file `fluidsynth.py` #62

Closed cclauss closed 4 months ago

cclauss commented 4 months ago

% ruff check --output-format=github --target-version=py38 .

Error: fluidsynth.py:772:75: F821 Undefined name `chan`
Error: fluidsynth.py:888:12: F821 Undefined name `fluid_synth_set_chorus_speed`
Error: fluidsynth.py:889:20: F821 Undefined name `fluid_synth_set_chorus_speed`
Error: fluidsynth.py:893:12: F821 Undefined name `fluid_synth_set_chorus_depth`
Error: fluidsynth.py:894:20: F821 Undefined name `fluid_synth_set_chorus_depth`
Error: fluidsynth.py:1002:64: F821 Undefined name `name`
Error: fluidsynth.py:1002:83: F821 Undefined name `name`

chan and name are also not defined which will raise NameError if these lines of code are run.

% ruff rule F821

undefined-name (F821)

Derived from the Pyflakes linter.

What it does

Checks for uses of undefined names.

Why is this bad?

An undefined name is likely to raise NameError at runtime.

Example

def double():
    return n * 2  # raises `NameError` if `n` is undefined when `double` is called

Use instead:

def double(n):
    return n * 2

References

nwhitehead commented 4 months ago

Should be fixed by #63