Skip to content

feat(ci): Add Python linting CI workflow with ruff #889

@WilliamBerryiii

Description

@WilliamBerryiii

Summary

The repository has no CI enforcement for Python code quality. All existing languages (Markdown, PowerShell, YAML) have dedicated linting workflows called from the pr-validation.yml orchestrator. Adding a Python linting workflow with ruff closes this gap and satisfies the OSSF Best Practices coding_standards_enforced MUST criterion for silver badge compliance.

Context

The CI architecture uses reusable workflows stored at .github/workflows/.yml called by a pr-validation.yml orchestrator. Each reusable workflow accepts standard inputs like soft-fail (boolean, allows workflow to pass even if linting fails) and changed-files-only (boolean, scopes checks to files changed in the PR). This pattern was established through prior CI expansion work (#634, closed).

Ruff is the project's chosen Python linter and formatter, as configured in uv-projects.instructions.md and the Python coding standards. It provides both linting (ruff check) and format checking (ruff format --check) in a single fast tool.

This workflow has HIGH OSSF impact. Without CI-enforced linting for Python, adding Python as a supported language puts the coding_standards_enforced MUST criterion at risk, potentially affecting the silver badge.

Architecture: Multi-Skill Working Directory

The reusable workflow should accept a working-directory input parameter so the orchestrator can call it once per Python skill directory:

on:
  workflow_call:
    inputs:
      working-directory:
        type: string
        required: false
        default: ".github/skills/experimental/powerpoint"
      soft-fail:
        type: boolean
        required: false
        default: false
      changed-files-only:
        type: boolean
        required: false
        default: false

The orchestrator (pr-validation.yml) calls this workflow once per Python skill directory. When a second Python skill is added, the orchestrator gains another job pointing to that skill's directory, with no changes to the reusable workflow itself. Each skill's pyproject.toml contains its own [tool.ruff] configuration, so ruff discovers the correct settings when run in the skill's working directory.

Changes Required

File Action Change
.github/workflows/python-lint.yml CREATE New reusable workflow running ruff check and ruff format --check
.github/workflows/pr-validation.yml MODIFY Add job calling python-lint.yml with standard inputs

The new workflow should follow the established reusable workflow pattern:

  • Accept soft-fail, changed-files-only, and working-directory inputs
  • Install uv and run uv sync --locked in the specified working directory for dependencies
  • Run ruff check with appropriate configuration
  • Run ruff format --check to verify formatting
  • Output results in a structured format consistent with other linting workflows

Acceptance Criteria

  • .github/workflows/python-lint.yml exists as a reusable workflow
  • Workflow accepts soft-fail, changed-files-only, and working-directory standard inputs
  • ruff check runs against Python files and reports violations
  • ruff format --check verifies formatting compliance
  • pr-validation.yml calls the new workflow as a job in the validation matrix
  • Workflow passes when no Python files are changed (changed-files-only mode)
  • Workflow correctly reports failures when ruff finds violations
  • soft-fail mode allows the workflow to pass with warnings rather than failures
  • Adding a new Python skill requires only a new orchestrator job entry, no workflow changes

OSSF Impact

Criterion Status Impact
coding_standards_enforced MUST (silver) Satisfied by this workflow — ruff enforces coding standards for Python

Dependencies

Related

Metadata

Metadata

Labels

featureNew feature triggering minor version bumpinfrastructureRepository infrastructure and tooling

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions