Skip to content

Re-enable Ruff linting in GitHub workflows #16

@dandye

Description

@dandye

Summary

Re-enable the Ruff linting infrastructure that was temporarily disabled during PR #10 to keep the timestamp validation changes focused.

Background

During the timestamp validation implementation (PR #10), comprehensive Ruff linting configuration was added to pyproject.toml but enforcement was removed from GitHub workflows to keep the PR scope manageable.

Current State

✅ Ready Infrastructure:

  • Complete Ruff configuration in pyproject.toml
  • Proper exclusions for cloudfunctions/, docs/, etc.
  • Per-file ignore rules for different code types:
    • Tests: Allow print statements, relaxed exception handling
    • CLI scripts: Allow complexity patterns for command-line tools
    • Cloud Functions: Allow compatibility patterns

❌ Missing Enforcement:

  • No GitHub workflow currently runs linting checks
  • Developers must run ruff check . manually

Tasks

Phase 1: Basic Linting Enforcement

  • Create .github/workflows/lint.yml workflow
  • Add basic linting check to existing test workflow
  • Ensure CI fails on linting violations
  • Test with a small PR to validate workflow

Phase 2: Enhanced Checks (Optional)

  • Add format checking with ruff format --check
  • Consider import sorting enforcement
  • Add complexity and security rule enforcement
  • Create separate jobs for different rule categories

Example Workflow

name: Lint

on:
  push:
    branches: [ main, chronicle-main ]
  pull_request:
    branches: [ main, chronicle-main ]

jobs:
  lint:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set up Python
      uses: actions/setup-python@v4
      with:
        python-version: '3.11'
    - name: Install dependencies
      run: |
        python -m pip install --upgrade pip
        pip install ruff
    - name: Run Ruff linter
      run: ruff check . --output-format=github

Benefits

  • Consistent code quality across all contributions
  • Automated enforcement prevents style regressions
  • Better maintainability with standardized code patterns
  • Improved contributor experience with clear style guidelines

Priority

Medium - This improves code quality but isn't blocking core functionality. Can be implemented when there's bandwidth for addressing any existing style issues that surface.

🤖 Generated with Claude Code

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