Skip to content

ci: Enforce Ruff lint and formatting - #129

Open
lelia wants to merge 3 commits into
mainfrom
lelia/enforce-ruff-lint-format
Open

lelia wants to merge 3 commits into
mainfrom
lelia/enforce-ruff-lint-format

Conversation

@lelia

@lelia lelia commented Nov 14, 2026 •

Copy link
Copy Markdown
Contributor

Ruff linting and formatting run on every pull request, with matching pre-commit hooks and Make targets. The maintained Python tree is clean under the expanded rule set and Ruff 0.17.6, preserving Python 3.10 support.

Changes

  • Add an unconditional Lint workflow for every PR and push to main. CI, make lint, and pre-commit use the exact Ruff pin and lockfile; hooks apply safe fixes and formatting for review.
  • Enforce complexity 12 and eight arguments, with individual exceptions for existing functions and RUF100 checks for stale suppressions. Ruff infers its Python target from requires-python.
  • Normalize formatting, imports, annotations, exception chaining, and subprocess handling. Keep package-relative imports and upload-stream ownership documented locally.
  • Fix repository updates to serialize keyword arguments correctly. Close files opened for report uploads on success and failure while leaving caller-provided streams open. Keep lazy-file validation active under python -O and move full-scan parameter diagnostics from stdout to debug logging.
  • Refresh mocked endpoint tests and run them alongside unit tests in local and package CI checks. Live API tests remain opt-in.
  • Prepare 3.6.5 with user-facing release notes. Contributor tooling and complexity policy are documented in CONTRIBUTING.md.

The branch includes main through 447f0b0, preserving its API-token guidance, corrected integration-events endpoint, advisory-aware deduplication, strongest policy actions, and dependency updates. The published 3.6.3 and 3.6.4 changelog entries remain intact.

Validation

  • GitHub CI passed on b716bff, including CodeQL.

  • 250 tests passed, one skipped, and 97 subtests passed on each of Python 3.10 and 3.12.

  • Ruff lint/format, pre-commit hooks, locked dependency validation, and workflow structural checks.

  • Wheel/sdist builds and twine check.

  • Fourth-wall review of added comments/docstrings, configuration policy, release notes, and this description.

This is the SDK rollout. Shared workflow extraction and the cross-repository policy floor remain separate work.

Fixes CE-504
Refs CE-451

@lelia
lelia deployed to socket-firewall November 14, 2026 02:39 — with GitHub Actions Active
@socket-security-staging

socket-security-staging Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpre-commit@​4.6.293100100100100

View full report

@socket-security

socket-security Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedpypi/​pre-commit@​4.6.293100100100100

View full report

@lelia
lelia marked this pull request as ready for review November 14, 2026 02:46
@lelia
lelia requested a review from a team as a code owner November 14, 2026 02:46
@lelia
lelia deployed to socket-firewall November 14, 2026 02:46 — with GitHub Actions Active
@cursor

cursor Bot commented Nov 14, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Wide SDK surface touched for lint, but functional risk concentrates on repository updates, report uploads, and full-scan logging—areas worth extra review despite strong test coverage.

Overview
This release 3.6.3 adds mandatory Ruff lint and format via a new CI workflow, pre-commit hooks, and Makefile targets, all pinned to Ruff 0.17.4 through uv.lock. The Ruff configuration is expanded (complexity 12, 8 args, broader rule sets) with documented suppressions for legacy hot spots.

CI and contributor workflow shifts to uv sync, make lint / make test, and package check now runs mocked endpoint tests alongside unit tests.

Behavior fixes (not just style): Repos.update and Repos.post correctly serialize **kwargs into the JSON body; Report.create closes path-opened files with ExitStack after upload (including failures); full-scan parameter cleanup messages move from print to debug logging; lazy file I/O hardens error handling so validation stays effective under python -O.

The bulk of the diff is mechanical normalization (PEP 604 types, imports, formatting) across the SDK plus changelog and docs updates.

Reviewed by Cursor Bugbot for commit 1062f55. Configure here.

@lelia

lelia commented Nov 14, 2026

Copy link
Copy Markdown
Contributor Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 1062f55. Configure here.

An explicit `target-version` has to be edited by hand whenever the
supported Python floor moves. Without it, Ruff reads the minimum version
from `requires-python`, which resolves to the same `py310` today.

This branch was successfully deployed

1 active deployment
socket-firewall — b716bff7 Deployed Dec 5, 2026 by lelia via python-sfw-smoke-enterprise #170
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant