Skip to content

Enforce E501 (Line Too Long) and Remove from Ignored Lint Rules #6216

@DanielRyanSmith

Description

@DanielRyanSmith

Background & Motivation

Currently, our Python formatting configuration in pyproject.toml ignores the E501 (line-too-long) Ruff lint rule. The codebase contains a multitude of violations where lines exceed the configured 80-character limit, making it exceptionally hard to fix them all at once. However, to adhere to our style guidelines and improve code readability, we need to enforce this rule and resolve the existing violations. Relying on # noqa comments to bypass the rule is discouraged, as it circumvents the underlying issue of excessively long lines.

Proposed Changes

  1. Configuration Update: Remove "E501" from the ignore list under [tool.ruff.lint] in pyproject.toml.
  2. Fix Existing Violations: Go through the Python codebase (Backend/NDB models, Flask handlers, etc.) and refactor lines that exceed 80 characters. This will involve:
    • Breaking down long strings, comments, and docstrings across multiple lines.
    • Refactoring complex statements, function signatures, or data structures (like long lists/dictionaries) to span multiple lines for better formatting.
  3. Strict Enforcement: Avoid using # noqa: E501 or similar comments to mask the issue. The lines themselves must be shortened to comply with the 80-character limit.
  4. Scope: This change targets the Backend (Python) codebase where Ruff is applied. The Frontend (Lit/JS) and API specifications are not impacted by this specific lint rule.

Acceptance Criteria

  • "E501" is removed from the ignore list in pyproject.toml.
  • Running the local linter yields no E501 errors across the Python codebase.
  • All line length violations are resolved by refactoring the code to be under 80 characters (no new # noqa suppressions are used to bypass the rule).
  • CI linting checks pass successfully with the newly enforced rule.

This issue description was drafted by Gemini

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions