Commit d60210d
committed
style: align ruff across all plugins and tools
Run ruff across the full `check-plugins/` and `tools/` tree with the
rule set already in pyproject.toml (B, C4, E, F, I, RUF, SIM, UP, W).
This clears ~400 accumulated violations so that `tools/run-static-checks`
can be used as a trustworthy gate going forward.
Categories fixed:
- I001 (324): import blocks normalized (order, grouping, blank lines).
- RUF059 (145): discarded tuple-unpack slots prefixed with `_` (`success, result = ...` ->
`_success, result = ...`) so the intent is explicit and shadowing is visible.
- UP032 (30): `.format()` calls converted to f-strings.
- F401 (9): unused imports removed.
- RUF005 (8): `[x] + list` rewritten as `[x, *list]`.
- RUF100 (6): unused `# noqa` directives removed.
- E713/E714 (7): `not x in y` and `not x is y` rewritten to `x not in y` / `x is not y`.
- F541 (5): empty f-strings demoted to regular strings.
- SIM401/118/115/108/101, RUF015/019 and a few other ruff suggestions.
Manual fixes that ruff could not auto-apply:
- E402 (39): 7 plugins had the `warnings.filterwarnings()` pattern
or an `import lib.smb` try/except in the middle of their import
block, which pushed all following imports past ruff's "module level
imports at top" rule. Reordered so all unconditional imports sit
first and the `warnings.filterwarnings()` / optional-lib try/except
blocks come after. about-me no longer imports pymysql at all, so
the stale filterwarnings call was dropped.
- F403/F405 (8): `from lib.globals import *` in `ping/unit-test/run`
replaced with the explicit set of STATE_* names actually used.
- E741 (5): single-letter variable `l` in basket-compare's compare_*
helpers renamed to `left_item` for readability.
- F821 (1): basket-compare referenced `STATE_UNKNOWN` without
importing it; the import was added. This was a latent bug that
would have crashed `sys.exit(STATE_UNKNOWN)` on any argparse
SystemExit.
- B007 (1): unused loop variable `value` in check2basket replaced
with `for key in parent_value`.
- RUF001 (5): ambiguous Unicode characters in DESCRIPTION strings and
comments (typographic minus/apostrophes/hyphens) replaced with
plain ASCII.
- SIM115 (1): path-rw-test's `tempfile.TemporaryFile()` now uses a
context manager.
Plugin fixes worth calling out:
- scanrootkit: kernel symbol matching was already tightened in the
previous commit; this pass also fixes the long-standing dead-code
directory check (covered in the scanrootkit commit that precedes
this one).
- Several plugins' inline `os.path.isfile()` checks that were
actually intended to test for directories are left alone for now
and tracked separately - this commit is scoped to style.
Also: aligned the ruff `ignore` list in `pyproject.toml` with the
equivalent list in the shared `lib` repo by adding `RUF002`, `RUF003`,
`SIM102` and `SIM105`, so the same style expectations hold in both
codebases.
No behavior change intended. Style-only, per the house rule that
pure style passes do not bump plugin `__version__`.1 parent c86b4f9 commit d60210d
File tree
267 files changed
+723
-1043
lines changed- check-plugins
- about-me
- apache-httpd-status
- unit-test
- apache-httpd-version/unit-test
- apache-solr-version/unit-test
- atlassian-statuspage/unit-test
- axenita-stats/unit-test
- by-ssh
- by-winrm
- cometsystem
- unit-test
- composer-version/unit-test
- cpu-usage
- unit-test
- crypto-policy
- csv-values
- unit-test
- deb-lastactivity
- unit-test
- deb-updates
- unit-test
- dhcp-scope-usage
- unit-test
- diacos
- unit-test
- disk-io
- disk-smart
- unit-test
- disk-usage/unit-test
- dmesg
- unit-test
- dns
- docker-info/unit-test
- docker-stats/unit-test
- example/unit-test
- fail2ban
- unit-test
- fedora-version/unit-test
- file-age
- unit-test
- file-count
- file-descriptors/unit-test
- file-size
- fortios-ha-stats
- fortios-version
- fs-ro/unit-test
- githubstatus
- unit-test
- gitlab-health
- unit-test
- gitlab-liveness
- unit-test
- gitlab-readiness
- unit-test
- grafana-version/unit-test
- grassfish-licenses
- unit-test
- grassfish-players
- unit-test
- grassfish-screens
- unit-test
- graylog-version/unit-test
- haproxy-status
- unit-test
- hin-status/unit-test
- huawei-dorado-backup-power
- unit-test
- huawei-dorado-controller
- unit-test
- huawei-dorado-disk
- unit-test
- huawei-dorado-enclosure
- unit-test
- huawei-dorado-fan
- unit-test
- huawei-dorado-host
- unit-test
- huawei-dorado-hypermetrodomain
- unit-test
- huawei-dorado-hypermetropair
- unit-test
- huawei-dorado-interface
- unit-test
- huawei-dorado-power
- unit-test
- huawei-dorado-system
- unit-test
- icinga-version/unit-test
- infomaniak-events
- unit-test
- infomaniak-swiss-backup-devices
- unit-test
- infomaniak-swiss-backup-products/unit-test
- ipmi-sel/unit-test
- ipmi-sensor
- unit-test
- jitsi-videobridge-stats/unit-test
- jitsi-videobridge-status
- unit-test
- journald-query
- unit-test
- journald-usage
- unit-test
- json-values
- kemp-services
- unit-test
- keycloak-memory-usage/unit-test
- keycloak-stats/unit-test
- keycloak-version/unit-test
- kubectl-get-pods
- unit-test
- load/unit-test
- logfile/unit-test
- mailq
- unit-test
- mediawiki-version/unit-test
- memory-usage/unit-test
- mod-qos-stats
- unit-test
- mydumper-version/unit-test
- mysql-connections/unit-test
- mysql-innodb-buffer-pool-instances/unit-test
- mysql-innodb-buffer-pool-size/unit-test
- mysql-logfile
- mysql-query
- unit-test
- mysql-storage-engines
- unit-test
- mysql-system
- mysql-traffic
- mysql-version/unit-test
- needs-restarting/unit-test
- network-bonding/unit-test
- network-connections/unit-test
- nextcloud-stats
- nextcloud-version/unit-test
- nginx-status
- unit-test
- nodebb-cache
- unit-test
- nodebb-database
- unit-test
- nodebb-errors
- unit-test
- nodebb-events
- unit-test
- nodebb-groups
- unit-test
- nodebb-info
- unit-test
- nodebb-users
- unit-test
- nodebb-version
- unit-test
- ntp-chronyd/unit-test
- ntp-ntpd/unit-test
- ntp-systemd-timesyncd/unit-test
- ntp-w32tm/unit-test
- onlyoffice-stats
- unit-test
- openjdk-redhat-version/unit-test
- openstack-swift-stat/unit-test
- openvpn-client-list
- unit-test
- openvpn-version/unit-test
- path-rw-test
- php-fpm-ping
- unit-test
- php-fpm-status/unit-test
- php-status
- php-version/unit-test
- ping
- unit-test
- pip-updates
- unit-test
- podman-info/unit-test
- podman-stats/unit-test
- postfix-version/unit-test
- postgresql-version/unit-test
- procs
- python-version/unit-test
- redfish-sel
- unit-test
- redis-status
- unit-test
- redis-version/unit-test
- restic-check
- unit-test
- restic-snapshots
- unit-test
- restic-stats
- unit-test
- rpm-updates
- unit-test
- safenet-hsm-state
- unit-test
- sap-open-concur-com
- unit-test
- scanrootkit
- icingaweb2-module-director
- unit-test
- scheduled-task
- selinux-mode
- sensors-battery/unit-test
- sensors-fans/unit-test
- sensors-temperatures
- unit-test
- service/unit-test
- snmp
- unit-test
- spring-boot-actuator-health
- unit-test
- starface-account-stats
- unit-test
- starface-backup-status
- unit-test
- starface-channel-status
- unit-test
- starface-database-stats
- unit-test
- starface-java-memory-usage
- unit-test
- starface-peer-stats
- unit-test
- starface-status
- unit-test
- statusiq/unit-test
- statuspal
- unit-test
- strongswan-connections
- unit-test
- swap-usage/unit-test
- systemd-timedate-status
- unit-test
- systemd-units-failed
- unit-test
- systemd-unit
- tuned-profile
- updates
- uptimerobot
- unit-test
- uptime/unit-test
- users/unit-test
- valkey-status
- valkey-version/unit-test
- veeam-status
- unit-test
- virustotal-scan-url
- unit-test
- whmcs-status
- unit-test
- wildfly-deployment-status
- wildfly-non-xa-datasource-stats
- wildfly-xa-datasource-stats
- xca-cert
- xml
- tools
- influxdb-remove-old-measurements
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
267 files changed
+723
-1043
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | 13 | | |
18 | 14 | | |
19 | 15 | | |
| |||
137 | 133 | | |
138 | 134 | | |
139 | 135 | | |
140 | | - | |
| 136 | + | |
141 | 137 | | |
142 | 138 | | |
143 | 139 | | |
| |||
1346 | 1342 | | |
1347 | 1343 | | |
1348 | 1344 | | |
1349 | | - | |
1350 | | - | |
1351 | | - | |
1352 | | - | |
| 1345 | + | |
1353 | 1346 | | |
1354 | 1347 | | |
1355 | 1348 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | 17 | | |
19 | | - | |
| 18 | + | |
20 | 19 | | |
21 | 20 | | |
22 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
32 | | - | |
33 | 33 | | |
34 | | - | |
| 34 | + | |
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
16 | | - | |
17 | 17 | | |
18 | | - | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
18 | | - | |
19 | 18 | | |
20 | 19 | | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | 19 | | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | | - | |
26 | 25 | | |
27 | 26 | | |
28 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | 14 | | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
| |||
174 | 173 | | |
175 | 174 | | |
176 | 175 | | |
177 | | - | |
| 176 | + | |
178 | 177 | | |
179 | 178 | | |
180 | 179 | | |
| |||
0 commit comments