Skip to content

pyflakes (pylint, ruff, ....) clean-up, CI? #1101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
roryyorke opened this issue Jan 19, 2025 · 5 comments · Fixed by #1118
Open

pyflakes (pylint, ruff, ....) clean-up, CI? #1101

roryyorke opened this issue Jan 19, 2025 · 5 comments · Fixed by #1118

Comments

@roryyorke
Copy link
Contributor

Running pyflakes on main HEAD (0ff0452) reveals lots of possible issues; see end.

  1. Is there interest in getting and keeping the tree lint-clean?

    This would require some changes to style, e.g., dropping from foo import * (see output below), and some patience when the linter spits out an incomprehensible message.

  2. Are there strong preferences for a particular linter?

    I use pyflakes often: it's simple, has a low false-positive rate, but is not configurable.

    The other two I'm aware of:

    • pylint, more extensive checks, configurable
    • ruff; my crude, probably unfair thinking of it is "pylint written in Rust", but I think it may do more

pyflakes output:

control/modelsimp.py:343:9: local variable 'order' is assigned to but never used
control/pzmap.py:14:1: 'math.pi' imported but unused
control/pzmap.py:18:1: 'numpy.cos' imported but unused
control/pzmap.py:18:1: 'numpy.exp' imported but unused
control/pzmap.py:18:1: 'numpy.linspace' imported but unused
control/pzmap.py:18:1: 'numpy.sin' imported but unused
control/pzmap.py:18:1: 'numpy.sqrt' imported but unused
control/pzmap.py:25:1: '.freqplot._freqplot_defaults' imported but unused
control/pzmap.py:28:1: '.lti.LTI' imported but unused
control/stochsys.py:25:1: '.iosys.InputOutputSystem' imported but unused
control/stochsys.py:25:1: '.iosys._process_indices' imported but unused
control/stochsys.py:29:1: redefinition of unused 'StateSpace' from line 23
control/stochsys.py:173:9: local variable 'NN' is assigned to but never used
control/stochsys.py:292:9: local variable 'NN' is assigned to but never used
control/stochsys.py:449:13: undefined name 'warnings'
control/stochsys.py:463:9: 'raise NotImplemented' should be 'raise NotImplementedError'
control/iosys.py:11:1: 'warnings.warn' imported but unused
control/nlsys.py:21:1: 'copy' imported but unused
control/nlsys.py:28:1: '.iosys._process_signal_list' imported but unused
control/nlsys.py:214:9: local variable 'dt' is assigned to but never used
control/nlsys.py:246:9: local variable 'dt' is assigned to but never used
control/nlsys.py:814:16: f-string is missing placeholders
control/nlsys.py:834:16: f-string is missing placeholders
control/nlsys.py:2477:5: '.statesp._convert_to_statespace' imported but unused
control/nlsys.py:2478:5: '.xferfcn.TransferFunction' imported but unused
control/nlsys.py:2540:12: f-string is missing placeholders
control/nlsys.py:2579:16: f-string is missing placeholders
control/nlsys.py:2642:24: f-string is missing placeholders
control/nlsys.py:2668:16: f-string is missing placeholders
control/nlsys.py:2745:24: f-string is missing placeholders
control/mateqn.py:40:1: 'numpy.copy' imported but unused
control/mateqn.py:40:1: 'numpy.dot' imported but unused
control/mateqn.py:40:1: 'numpy.atleast_2d' imported but unused
control/statesp.py:19:1: 'copy.deepcopy' imported but unused
control/statesp.py:25:1: 'numpy.array' imported but unused
control/statesp.py:25:1: 'numpy.ones' imported but unused
control/statesp.py:35:1: '.iosys._process_dt_keyword' imported but unused
control/statesp.py:35:1: '.iosys.iosys_repr' imported but unused
control/statesp.py:35:1: '.iosys.isdtime' imported but unused
control/nichols.py:24:1: '.freqplot._default_frequency_range' imported but unused
control/nichols.py:24:1: '.freqplot._freqplot_defaults' imported but unused
control/nichols.py:140:29: undefined name 'idx_sys'
control/phaseplot.py:41:1: '.exception.ControlNotImplemented' imported but unused
control/phaseplot.py:165:5: local variable 'passed_kwargs' is assigned to but never used
control/phaseplot.py:633:14: local variable 'single_color' is assigned to but never used
control/phaseplot.py:1094:13: f-string is missing placeholders
control/phaseplot.py:1096:19: undefined name 'ControlArgument'
control/phaseplot.py:1096:35: f-string is missing placeholders
control/phaseplot.py:1261:9: local variable 'xy' is assigned to but never used
control/phaseplot.py:1268:9: local variable 'bp' is assigned to but never used
control/statefbk.py:49:1: '.exception.ControlNotImplemented' imported but unused
control/statefbk.py:53:1: '.mateqn._check_shape' imported but unused
control/statefbk.py:55:1: '.statesp._convert_to_statespace' imported but unused
control/statefbk.py:278:5: local variable 'b' is assigned to but never used
control/timeresp.py:1841:5: '.lti.LTI' imported but unused
control/freqplot.py:14:1: 'os.path.commonprefix' imported but unused
control/freqplot.py:763:17: local variable 'mag_ylim' is assigned to but never used
control/freqplot.py:769:17: local variable 'phase_ylim' is assigned to but never used
control/freqplot.py:2219:38: undefined name 'arg'
control/__init__.py:74:1: 'from .iosys import *' used; unable to detect undefined names
control/__init__.py:75:1: 'from .nlsys import *' used; unable to detect undefined names
control/__init__.py:76:1: 'from .lti import *' used; unable to detect undefined names
control/__init__.py:77:1: 'from .statesp import *' used; unable to detect undefined names
control/__init__.py:78:1: 'from .xferfcn import *' used; unable to detect undefined names
control/__init__.py:79:1: 'from .frdata import *' used; unable to detect undefined names
control/__init__.py:82:1: 'from .timeresp import *' used; unable to detect undefined names
control/__init__.py:83:1: 'from .timeplot import *' used; unable to detect undefined names
control/__init__.py:85:1: 'from .bdalg import *' used; unable to detect undefined names
control/__init__.py:86:1: 'from .ctrlplot import *' used; unable to detect undefined names
control/__init__.py:87:1: 'from .delay import *' used; unable to detect undefined names
control/__init__.py:88:1: 'from .descfcn import *' used; unable to detect undefined names
control/__init__.py:89:1: 'from .dtime import *' used; unable to detect undefined names
control/__init__.py:90:1: 'from .freqplot import *' used; unable to detect undefined names
control/__init__.py:91:1: 'from .margins import *' used; unable to detect undefined names
control/__init__.py:92:1: 'from .mateqn import *' used; unable to detect undefined names
control/__init__.py:93:1: 'from .modelsimp import *' used; unable to detect undefined names
control/__init__.py:94:1: 'from .nichols import *' used; unable to detect undefined names
control/__init__.py:95:1: 'from .phaseplot import *' used; unable to detect undefined names
control/__init__.py:96:1: 'from .pzmap import *' used; unable to detect undefined names
control/__init__.py:97:1: 'from .rlocus import *' used; unable to detect undefined names
control/__init__.py:98:1: 'from .statefbk import *' used; unable to detect undefined names
control/__init__.py:99:1: 'from .stochsys import *' used; unable to detect undefined names
control/__init__.py:100:1: 'from .ctrlutil import *' used; unable to detect undefined names
control/__init__.py:101:1: 'from .canonical import *' used; unable to detect undefined names
control/__init__.py:102:1: 'from .robust import *' used; unable to detect undefined names
control/__init__.py:103:1: 'from .config import *' used; unable to detect undefined names
control/__init__.py:104:1: 'from .sisotool import *' used; unable to detect undefined names
control/__init__.py:105:1: 'from .passivity import *' used; unable to detect undefined names
control/__init__.py:106:1: 'from .sysnorm import *' used; unable to detect undefined names
control/__init__.py:109:1: '.phaseplot' imported but unused
control/__init__.py:110:1: '.phaseplot as pp' imported but unused
control/__init__.py:113:1: 'from .exception import *' used; unable to detect undefined names
control/__init__.py:124:13: 'ss' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:124:1: 'LTI' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:125:13: 'tf' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:125:1: 'LTI' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:126:17: 'bode_plot' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:126:1: 'LTI' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:127:20: 'nyquist_plot' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:127:1: 'LTI' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:128:20: 'nichols_plot' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:128:1: 'LTI' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/__init__.py:131:1: 'reset_defaults' may be undefined, or defined from star imports: .bdalg, .canonical, .config, .ctrlplot, .ctrlutil, .delay, .descfcn, .dtime, .exception, .frdata, .freqplot, .iosys, .lti, .margins, .mateqn, .modelsimp, .nichols, .nlsys, .passivity, .phaseplot, .pzmap, .rlocus, .robust, .sisotool, .statefbk, .statesp, .stochsys, .sysnorm, .timeplot, .timeresp, .xferfcn
control/rlocus.py:19:1: 'functools.partial' imported but unused
control/rlocus.py:21:1: 'matplotlib.pyplot as plt' imported but unused
control/rlocus.py:24:1: 'numpy.array' imported but unused
control/rlocus.py:24:1: 'numpy.imag' imported but unused
control/rlocus.py:24:1: 'numpy.real' imported but unused
control/rlocus.py:29:1: '.iosys.isdtime' imported but unused
control/rlocus.py:465:40: undefined name 'prevrow'
control/rlocus.py:467:32: undefined name 'prevrow'
control/rlocus.py:471:9: local variable 'prevrow' is assigned to but never used
control/lti.py:10:1: 'numpy.angle' imported but unused
control/canonical.py:11:1: 'numpy.zeros' imported but unused
control/canonical.py:11:1: 'numpy.shape' imported but unused
control/canonical.py:11:1: 'numpy.iscomplex' imported but unused
control/canonical.py:11:1: 'numpy.vstack' imported but unused
control/canonical.py:11:1: 'numpy.hstack' imported but unused
control/canonical.py:11:1: 'numpy.empty' imported but unused
control/canonical.py:11:1: 'numpy.finfo' imported but unused
control/canonical.py:11:1: 'numpy.float64' imported but unused
control/canonical.py:13:1: 'numpy.linalg.eig' imported but unused
control/dtime.py:51:1: '.statesp.StateSpace' imported but unused
control/sysnorm.py:15:1: 'scipy as sp' imported but unused
control/xferfcn.py:25:1: 'numpy.angle' imported but unused
control/xferfcn.py:25:1: 'numpy.float64' imported but unused
control/xferfcn.py:25:1: 'numpy.pi' imported but unused
control/xferfcn.py:34:1: '.iosys.isdtime' imported but unused
control/xferfcn.py:221:17: import 'poly' from line 25 shadowed by loop variable
control/xferfcn.py:1242:21: import 'poly' from line 25 shadowed by loop variable
control/xferfcn.py:1462:5: local variable 'kwargs' is assigned to but never used
control/frdata.py:18:1: 'numpy.angle' imported but unused
control/frdata.py:18:1: 'numpy.where' imported but unused
control/optimal.py:26:1: '.exception.ControlNotImplemented' imported but unused
control/optimal.py:27:1: '.iosys._process_indices' imported but unused
control/optimal.py:166:56: undefined name 'method'
control/optimal.py:1109:26: undefined name 'optimal_methods'
control/timeplot.py:14:1: 'matplotlib as mpl' imported but unused
control/timeplot.py:181:5: '.iosys.InputOutputSystem' imported but unused
control/timeplot.py:182:5: '.timeresp.TimeResponseData' imported but unused
control/exception.py:74:13: 'slycot' imported but unused
control/exception.py:88:13: 'pandas' imported but unused
control/exception.py:101:13: 'cvxopt' imported but unused
control/robust.py:45:1: 'from .exception import *' used; unable to detect undefined names
control/robust.py:47:1: 'from .statefbk import *' used; unable to detect undefined names
control/robust.py:106:5: local variable 'dico' is assigned to but never used
control/robust.py:111:15: 'ControlSlycot' may be undefined, or defined from star imports: .exception, .statefbk
control/robust.py:194:5: local variable 'dico' is assigned to but never used
control/robust.py:199:15: 'ControlSlycot' may be undefined, or defined from star imports: .exception, .statefbk
control/tests/timeplot_test.py:10:1: 'control.tests.conftest.mplcleanup' imported but unused
control/tests/timeplot_test.py:318:9: local variable 'combresp' is assigned to but never used
control/tests/timeplot_test.py:424:13: local variable 'shape' is assigned to but never used
control/tests/descfcn_test.py:213:9: local variable 'bias' is assigned to but never used
control/tests/descfcn_test.py:239:9: local variable 'cplt' is assigned to but never used
control/tests/bspline_test.py:14:1: 'scipy as sp' imported but unused
control/tests/bspline_test.py:18:1: 'control.optimal as opt' imported but unused
control/tests/bspline_test.py:221:9: local variable 'basis' is assigned to but never used
control/tests/matlab_test.py:139:9: local variable 'sys1' is assigned to but never used
control/tests/matlab_test.py:149:9: local variable 'sys1' is assigned to but never used
control/tests/matlab_test.py:159:9: local variable 'sys1' is assigned to but never used
control/tests/matlab_test.py:588:9: local variable 'unwrapped' is assigned to but never used
control/tests/xferfcn_test.py:1125:9: local variable 'array' is assigned to but never used
control/tests/trdata_test.py:217:9: local variable 'response_bad_kw' is assigned to but never used
control/tests/freqplot_test.py:10:1: 'control.tests.conftest.editsdefaults' imported but unused
control/tests/freqplot_test.py:10:1: 'control.tests.conftest.slycotonly' imported but unused
control/tests/freqplot_test.py:169:5: local variable 'lines_default' is assigned to but never used
control/tests/frd_test.py:6:1: 'sys as pysys' imported but unused
control/tests/frd_test.py:16:1: 'control.evalfr' imported but unused
control/tests/frd_test.py:186:9: local variable 'h2' is assigned to but never used
control/tests/frd_test.py:320:9: local variable 'chkpts' is assigned to but never used
control/tests/frd_test.py:343:13: local variable 'sys' is assigned to but never used
control/tests/frd_test.py:360:13: local variable 'sys' is assigned to but never used
control/tests/frd_test.py:532:13: local variable 'sys' is assigned to but never used
control/tests/nyquist_test.py:439:9: local variable 'response' is assigned to but never used
control/tests/nyquist_test.py:515:5: local variable 'cplt' is assigned to but never used
control/tests/nyquist_test.py:551:5: redefinition of unused 'indentsys' from line 277
control/tests/iosys_test.py:1415:13: local variable 'PC' is assigned to but never used
control/tests/iosys_test.py:1749:16: local variable 'record' is assigned to but never used
control/tests/iosys_test.py:1757:9: local variable 'h' is assigned to but never used
control/tests/iosys_test.py:1782:70: local variable 'record' is assigned to but never used
control/tests/iosys_test.py:1827:9: local variable 'h' is assigned to but never used
control/tests/iosys_test.py:1903:9: local variable 'resp_short' is assigned to but never used
control/tests/iosys_test.py:1907:9: local variable 'resp_bad' is assigned to but never used
control/tests/bdalg_test.py:365:9: local variable 'sys' is assigned to but never used
control/tests/stochsys_test.py:9:1: 'control.drss' imported but unused
control/tests/stochsys_test.py:9:1: 'control.ss' imported but unused
control/tests/stochsys_test.py:228:5: local variable 'P0' is assigned to but never used
control/tests/stochsys_test.py:247:9: local variable 'estim' is assigned to but never used
control/tests/stochsys_test.py:429:5: local variable 'W' is assigned to but never used
control/tests/stochsys_test.py:481:5: 'math.log' imported but unused
control/tests/docstrings_test.py:432:5: local variable 'docstring' is assigned to but never used
control/tests/namedio_test.py:11:1: 're' imported but unused
control/tests/namedio_test.py:296:9: local variable 'res' is assigned to but never used
control/tests/namedio_test.py:338:9: local variable 'sys' is assigned to but never used
control/tests/flatsys_test.py:522:9: local variable 'T' is assigned to but never used
control/tests/flatsys_test.py:632:9: local variable 'T' is assigned to but never used
control/tests/rlocus_test.py:137:9: undefined name '_RLClickDispatcher'
control/tests/rlocus_test.py:164:9: 'signal' imported but unused
control/tests/pzmap_test.py:114:9: local variable 'pzdata' is assigned to but never used
control/tests/pzmap_test.py:117:9: local variable 'fig' is assigned to but never used
control/tests/interconnect_test.py:18:1: 'scipy as sp' imported but unused
control/tests/interconnect_test.py:57:9: local variable 'sumblk' is assigned to but never used
control/tests/interconnect_test.py:349:9: local variable 'nlios' is assigned to but never used
control/tests/optimal_test.py:84:5: local variable 't' is assigned to but never used
control/tests/optimal_test.py:189:5: local variable 'yd' is assigned to but never used
control/tests/optimal_test.py:267:9: local variable 'ctrl' is assigned to but never used
control/tests/optimal_test.py:318:5: local variable 't' is assigned to but never used
control/tests/optimal_test.py:419:9: local variable 't' is assigned to but never used
control/tests/optimal_test.py:451:9: local variable 'res' is assigned to but never used
control/tests/optimal_test.py:558:9: local variable 'res' is assigned to but never used
control/tests/optimal_test.py:652:5: local variable 't' is assigned to but never used
control/tests/optimal_test.py:736:9: local variable 'curved_seg_length' is assigned to but never used
control/tests/optimal_test.py:797:9: local variable 'res' is assigned to but never used
control/tests/optimal_test.py:810:9: local variable 'mhe' is assigned to but never used
control/tests/modelsimp_test.py:6:1: 'math' imported but unused
control/tests/modelsimp_test.py:126:9: local variable 'mrk' is assigned to but never used
control/tests/conftest.py:3:1: 'os' imported but unused
control/tests/conftest.py:4:1: 'contextlib.contextmanager' imported but unused
control/tests/conftest.py:7:1: 'numpy as np' imported but unused
control/tests/lti_test.py:15:1: '.conftest.editsdefaults' imported but unused
control/tests/lti_test.py:32:13: local variable 'pole_list' is assigned to but never used
control/tests/lti_test.py:47:13: local variable 'zero_list' is assigned to but never used
control/tests/lti_test.py:298:13: local variable 'resp' is assigned to but never used
control/tests/phaseplot_test.py:22:1: 'control.tests.conftest.mplcleanup' imported but unused
control/tests/phaseplot_test.py:130:5: local variable 'out' is assigned to but never used
control/tests/timeresp_test.py:8:1: 'scipy as sp' imported but unused
control/tests/timeresp_test.py:1181:9: local variable 'uvec' is assigned to but never used
control/tests/timeresp_test.py:1306:9: local variable 'df' is assigned to but never used
control/tests/statesp_test.py:25:1: '.conftest.editsdefaults' imported but unused
control/tests/statesp_test.py:147:50: local variable 'w' is assigned to but never used
control/tests/statesp_test.py:754:9: local variable 'array' is assigned to but never used
control/tests/statesp_test.py:1101:66: redefinition of unused 'editsdefaults' from line 25
control/tests/statesp_test.py:1144:29: redefinition of unused 'editsdefaults' from line 25
control/tests/kwargs_test.py:16:1: 'matplotlib.pyplot as plt' imported but unused
control/tests/kwargs_test.py:110:53: undefined name 'np'
control/tests/kwargs_test.py:326:5: dictionary key 'StateSpace.__init__' repeated with different values
control/tests/kwargs_test.py:331:5: dictionary key 'StateSpace.__init__' repeated with different values
control/tests/nlsys_test.py:101:9: local variable 'resp_nl' is assigned to but never used
control/tests/config_test.py:336:9: '..statesp.StateSpace' imported but unused
control/tests/config_test.py:337:9: 'numpy.array' imported but unused
control/tests/discrete_test.py:267:9: local variable 'sys' is assigned to but never used
control/tests/discrete_test.py:304:9: local variable 'sys' is assigned to but never used
control/tests/discrete_test.py:343:9: local variable 'sys' is assigned to but never used
control/tests/discrete_test.py:423:13: local variable 'plant_d_warped' is assigned to but never used
control/tests/statefbk_test.py:10:1: 'math.atan' imported but unused
control/tests/statefbk_test.py:13:1: 'control.lqe' imported but unused
control/tests/statefbk_test.py:13:1: 'control.dlqe' imported but unused
control/tests/statefbk_test.py:823:13: local variable 'Ki' is assigned to but never used
control/tests/statefbk_test.py:938:1: redefinition of unused 'pi' from line 10
control/tests/statefbk_test.py:1204:5: local variable 'points' is assigned to but never used
control/tests/ctrlplot_test.py:77:13: local variable 'default_labels' is assigned to but never used
control/tests/ctrlplot_test.py:240:9: local variable 'cplt4' is assigned to but never used
control/tests/ctrlplot_test.py:330:5: local variable 'sys1' is assigned to but never used
control/tests/ctrlplot_test.py:331:5: local variable 'sys1c' is assigned to but never used
control/tests/ctrlplot_test.py:332:5: local variable 'sys2' is assigned to but never used
control/tests/ctrlplot_test.py:338:5: local variable 'expected_labels' is assigned to but never used
control/tests/ctrlplot_test.py:341:13: local variable 'default_labels' is assigned to but never used
control/tests/ctrlplot_test.py:490:5: local variable 'sys1' is assigned to but never used
control/tests/ctrlplot_test.py:491:5: local variable 'sys1c' is assigned to but never used
control/tests/ctrlplot_test.py:492:5: local variable 'sys2' is assigned to but never used
control/tests/ctrlplot_test.py:498:5: local variable 'expected_title' is assigned to but never used
control/tests/ctrlplot_test.py:534:52: undefined name 'resp_fnc'
control/tests/ctrlplot_test.py:534:64: undefined name 'plot_fnc'
control/tests/ctrlplot_test.py:585:14: local variable 'bot_row' is assigned to but never used
control/tests/ctrlplot_test.py:589:13: local variable 'top_row' is assigned to but never used
control/tests/ctrlplot_test.py:624:5: local variable 'sys1' is assigned to but never used
control/tests/ctrlplot_test.py:625:5: local variable 'sys1c' is assigned to but never used
control/tests/ctrlplot_test.py:626:5: local variable 'sys2' is assigned to but never used
control/tests/ctrlplot_test.py:632:5: local variable 'expected_title' is assigned to but never used
control/tests/ctrlplot_test.py:635:13: local variable 'default_title' is assigned to but never used
control/matlab/__init__.py:54:1: 'scipy.signal.zpk2ss' imported but unused
control/matlab/__init__.py:54:1: 'scipy.signal.ss2zpk' imported but unused
control/matlab/__init__.py:54:1: 'scipy.signal.tf2zpk' imported but unused
control/matlab/__init__.py:54:1: 'scipy.signal.zpk2tf' imported but unused
control/matlab/__init__.py:55:1: 'numpy.linspace' imported but unused
control/matlab/__init__.py:55:1: 'numpy.logspace' imported but unused
control/matlab/__init__.py:64:1: 'from ..statesp import *' used; unable to detect undefined names
control/matlab/__init__.py:65:1: 'from ..xferfcn import *' used; unable to detect undefined names
control/matlab/__init__.py:66:1: 'from ..lti import *' used; unable to detect undefined names
control/matlab/__init__.py:67:1: 'from ..iosys import *' used; unable to detect undefined names
control/matlab/__init__.py:68:1: 'from ..frdata import *' used; unable to detect undefined names
control/matlab/__init__.py:69:1: 'from ..dtime import *' used; unable to detect undefined names
control/matlab/__init__.py:70:1: '..exception.ControlArgument' imported but unused
control/matlab/__init__.py:73:1: 'from ..ctrlutil import *' used; unable to detect undefined names
control/matlab/__init__.py:74:1: '..freqplot.gangof4' imported but unused
control/matlab/__init__.py:75:1: '..nichols.nichols' imported but unused
control/matlab/__init__.py:76:1: 'from ..bdalg import *' used; unable to detect undefined names
control/matlab/__init__.py:77:1: 'from ..pzmap import *' used; unable to detect undefined names
control/matlab/__init__.py:78:1: 'from ..statefbk import *' used; unable to detect undefined names
control/matlab/__init__.py:79:1: 'from ..delay import *' used; unable to detect undefined names
control/matlab/__init__.py:80:1: 'from ..modelsimp import *' used; unable to detect undefined names
control/matlab/__init__.py:81:1: 'from ..mateqn import *' used; unable to detect undefined names
control/matlab/__init__.py:82:1: '..margins.margin' imported but unused
control/matlab/__init__.py:83:1: '..rlocus.rlocus' imported but unused
control/matlab/__init__.py:84:1: '..dtime.c2d' imported but unused
control/matlab/__init__.py:85:1: '..sisotool.sisotool' imported but unused
control/matlab/__init__.py:86:1: '..stochsys.lqe' imported but unused
control/matlab/__init__.py:86:1: '..stochsys.dlqe' imported but unused
control/matlab/__init__.py:90:14: 'poles' may be undefined, or defined from star imports: ..bdalg, ..ctrlutil, ..delay, ..dtime, ..frdata, ..iosys, ..lti, ..mateqn, ..modelsimp, ..pzmap, ..statefbk, ..statesp, ..xferfcn
control/matlab/__init__.py:90:21: 'zeros' may be undefined, or defined from star imports: ..bdalg, ..ctrlutil, ..delay, ..dtime, ..frdata, ..iosys, ..lti, ..mateqn, ..modelsimp, ..pzmap, ..statefbk, ..statesp, ..xferfcn
control/matlab/__init__.py:91:12: 'frequency_response' may be undefined, or defined from star imports: ..bdalg, ..ctrlutil, ..delay, ..dtime, ..frdata, ..iosys, ..lti, ..mateqn, ..modelsimp, ..pzmap, ..statefbk, ..statesp, ..xferfcn
control/matlab/__init__.py:95:1: 'from .timeresp import *' used; unable to detect undefined names
control/matlab/__init__.py:96:1: 'from .wrappers import *' used; unable to detect undefined names
control/matlab/__init__.py:99:1: 'from ..config import *' used; unable to detect undefined names
control/matlab/__init__.py:100:1: 'use_matlab_defaults' may be undefined, or defined from star imports: ..bdalg, ..config, ..ctrlutil, ..delay, ..dtime, ..frdata, ..iosys, ..lti, ..mateqn, ..modelsimp, ..pzmap, ..statefbk, ..statesp, ..xferfcn, .timeresp, .wrappers
control/flatsys/bspline.py:11:1: 'scipy.interpolate.splev' imported but unused
control/flatsys/__init__.py:64:1: '.basis.BasisFamily' imported but unused
control/flatsys/__init__.py:65:1: '.poly.PolyFamily' imported but unused
control/flatsys/__init__.py:66:1: '.bezier.BezierFamily' imported but unused
control/flatsys/__init__.py:67:1: '.bspline.BSplineFamily' imported but unused
control/flatsys/__init__.py:70:1: '.systraj.SystemTrajectory' imported but unused
control/flatsys/__init__.py:71:1: '.flatsys.FlatSystem' imported but unused
control/flatsys/__init__.py:71:1: '.flatsys.flatsys' imported but unused
control/flatsys/__init__.py:72:1: '.linflat.LinearFlatSystem' imported but unused
control/flatsys/__init__.py:75:1: '.flatsys.point_to_point' imported but unused
control/flatsys/__init__.py:75:1: '.flatsys.solve_flat_ocp' imported but unused
control/flatsys/flatsys.py:248:5: '..iosys._process_iosys_keywords' imported but unused
control/flatsys/flatsys.py:486:19: undefined name 'ControlArgument'
control/flatsys/flatsys.py:520:13: redefinition of unused 'traj_cost' from line 499
control/flatsys/flatsys.py:724:5: local variable 'Tf' is assigned to but never used
control/flatsys/flatsys.py:725:46: undefined name 'T0'
@roryyorke
Copy link
Contributor Author

See python-control/Slycot#246 for applying ruff check to the much smaller Slycot Python source.

See here for CI test result failing with ruff check.

@murrayrm
Copy link
Member

Is there interest in getting and keeping the tree lint-clean?

Yes!

Are there strong preferences for a particular linter?

Not on my end.. I've tried running ruff before and it generated a lot of warnings about fairly minor things. The pyflake output seems about right (all of those items seem like things we should fix).

@slivingston
Copy link
Member

Yes, let's do this!

In the past I used pylint regularly, but I switched to ruff because it is much faster. ruff (and pylint) will require significant tuning effort to align with python-control style, so I recommend the concrete goal of requiring pyflakes to pass in CI jobs. After we try that in practice, we can consider tightening it to ruff, pylint etc.

@roryyorke
Copy link
Contributor Author

after struggling with pyflakes, I'm try ruff with "pyflakes-only" warnings, and add some "# noqa" lines to __init__.py.

@murrayrm
Copy link
Member

murrayrm commented Feb 3, 2025

Addressed in #1118. OK to close, unless there is additional discussion of what we want to do.

@murrayrm murrayrm linked a pull request Feb 3, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants