nwhitehead / pyfluidsynth

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

GitHub Action to spellcheck and lint Python code #61

Closed cclauss closed 4 months ago

cclauss commented 4 months ago

This Action uses minimal steps to run in ~5 seconds to rapidly:

Tools:


The wildcard import from ctypes import * is not a good idea because it can hide undefined name errors:

There are several undefined names to be fixed. Each of these will raise NameError if executed.

% ruff check .

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

% 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