Skip to content

Fix remaining ruff lint violations #118

@markuslf

Description

@markuslf

After applying ruff format and fixing auto-fixable issues in #117, 31 lint violations remain that require manual review. These are real code quality issues, not style problems.

By file

db_mysql.py (2 issues)

  • E402: Module level imports not at top of file (imports after __version__)

db_sqlite.py (4 issues)

  • SIM108: if/else block could be ternary (line 560)
  • SIM118: key in dict.keys() should be key in dict (lines 831, 928)
  • B007: Unused loop control variable id_ (line 968)

disk.py (1 issue)

  • E722: Bare except without exception type (line 138)

dmidecode.py (3 issues)

  • SIM103: Return condition directly instead of if/return True/return False (line 263)
  • RUF059: Unused unpacked variable first_handle (line 385)
  • RUF059: Unused unpacked variable stderr (line 520)

grassfish.py (2 issues)

  • F821: Undefined name re and compiled_custom_id_regex (line 132) - likely a real bug

human.py (2 issues)

  • SIM108: if/else block could be ternary (line 528)
  • RUF046: Redundant int() cast on already-integer value (line 531)

icinga.py (1 issue)

  • RUF005: Consider using [*a, *b] instead of concatenation (line 160)

lftest.py (1 issue)

  • RUF059: Unused unpacked variable success (line 124)

net.py (1 issue)

  • F821: Undefined name get_ip_public (line 409) - likely a real bug

rocket.py (7 issues)

  • B006: Mutable default argument params={} (line 91)
  • W291: Trailing whitespace in docstring examples (6 occurrences)

time.py (1 issue)

  • UP036: Outdated version block for sys.version_info >= (3, 9) check (min version is already 3.9)

uptimerobot.py (1 issue)

  • E721: Use isinstance() instead of type() == comparison (line 621)

url.py (5 issues)

  • B006: Mutable default arguments header={}, data={} in fetch() and fetch_json() (4 occurrences)
  • RUF034: Useless ternary timeout if digest_auth_user else timeout (line 158)

Priority

High priority (likely real bugs):

  • F821 in grassfish.py and net.py (undefined names)
  • B006 in url.py and rocket.py (mutable default arguments can cause unexpected state sharing between calls)
  • E722 in disk.py (bare except hides errors)

Lower priority (code simplification):

  • SIM108, SIM103, SIM118 (readability improvements)
  • RUF059, B007 (unused variables)
  • W291 (trailing whitespace in docstrings)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions