Skip to content

Adding unified linting/formatting using Ruff#54

Merged
fosdickio merged 3 commits into
mainfrom
fosdickio/linting-formatting
Dec 22, 2025
Merged

Adding unified linting/formatting using Ruff#54
fosdickio merged 3 commits into
mainfrom
fosdickio/linting-formatting

Conversation

@fosdickio

Copy link
Copy Markdown
Owner

Problem

We need to move to a unified way of linting and formatting on the codebase. It's been difficult to do code reviews when there are hundreds of formatting changes.

What Was Changed

I've setup Ruff and a GitHub Action to check on pushes and for PRs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces Ruff as a unified linting and formatting tool for the codebase to address the issue of inconsistent code reviews caused by numerous formatting changes. The configuration targets Python 3.12 and includes common linting rules along with import sorting.

Key changes:

  • Added Ruff configuration with line length of 100, pycodestyle, pyflakes, isort, pyupgrade, and Ruff-specific rules
  • Implemented GitHub Actions workflow to automatically check linting and formatting on pushes and PRs to main
  • Documented Ruff usage and CI integration in the README

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
ruff.toml Configures Ruff with Python 3.12 target, linting rules (E, W, F, I, UP, RUF), isort settings for first-party packages, and per-file ignores for __init__.py and scripts
.github/workflows/lint-format.yml Adds CI workflow to run Ruff linter and formatter checks on pushes and PRs targeting main branch
README.md Adds Development section documenting Ruff commands for manual usage and explaining the GitHub Actions integration

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread ruff.toml

[lint.per-file-ignores]
"__init__.py" = ["F401"] # Allow unused imports in __init__.py files
"scripts/*" = ["T201"] # Allow print statements in scripts

Copilot AI Dec 22, 2025

Copy link

Choose a reason for hiding this comment

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

The T201 rule (which flags print statements) is being ignored for scripts, but T201 is not included in the select list above. This ignore will have no effect since the rule is not enabled. If you want to allow print statements in scripts while enforcing this rule elsewhere, you need to add "T" (flake8-print) to the select list in the [lint] section.

Copilot uses AI. Check for mistakes.
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment on lines +246 to +247
- Every push to `main` branches
- Every pull request targeting `main` branches

Copilot AI Dec 22, 2025

Copy link

Choose a reason for hiding this comment

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

The phrase "main branches" should be "main branch" (singular) since there is only one main branch being referenced.

Suggested change
- Every push to `main` branches
- Every pull request targeting `main` branches
- Every push to the `main` branch
- Every pull request targeting the `main` branch

Copilot uses AI. Check for mistakes.
@fosdickio

Copy link
Copy Markdown
Owner Author

TODO: run the linter and formatter after #53 goes in to avoid causing merge conflicts.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@fosdickio fosdickio merged commit 4f974ad into main Dec 22, 2025
1 check passed
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.

3 participants