This 'except' was used without specifying the exception class according
to Ruff. Here, only the ValueError class is expected and handled.
This is linked to Ruff error E722 [1]:
A bare except catches BaseException which includes KeyboardInterrupt,
SystemExit, Exception, and others. Catching BaseException can make it
hard to interrupt the program (e.g., with Ctrl-C) and can disguise
other problems.
Link: https://docs.astral.sh/ruff/rules/bare-except/ [1]
Signed-off-by: Matthieu Baerts (NGI0) <matttbe@kernel.org>
---
tools/net/ynl/pyynl/ethtool.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/net/ynl/pyynl/ethtool.py b/tools/net/ynl/pyynl/ethtool.py
index cab6b576c8762e0bb4e6ff730c7cf21cd9e1fa56..44440beab62f52f240e10f0678a6564f449d26d4 100755
--- a/tools/net/ynl/pyynl/ethtool.py
+++ b/tools/net/ynl/pyynl/ethtool.py
@@ -51,7 +51,7 @@ def print_field(reply, *desc):
for spec in desc:
try:
field, name, tp = spec
- except:
+ except ValueError:
field, name = spec
tp = 'int'
--
2.51.0