Skip to content

ci: add pre-commit config with ruff linting and formatting#130

Merged
ErikBjare merged 2 commits intoActivityWatch:masterfrom
TimeToBuildBob:bob/add-pre-commit-config
Feb 27, 2026
Merged

ci: add pre-commit config with ruff linting and formatting#130
ErikBjare merged 2 commits intoActivityWatch:masterfrom
TimeToBuildBob:bob/add-pre-commit-config

Conversation

@TimeToBuildBob
Copy link
Contributor

@TimeToBuildBob TimeToBuildBob commented Feb 27, 2026

Summary

  • Add .pre-commit-config.yaml with ruff (lint + format) hooks matching the existing CI lint checks
  • Auto-format 3 files that had minor formatting inconsistencies (aw_core/util.py, tests/test_query2.py, tests/utils.py)
  • Include standard file checks: trailing whitespace, end-of-file fixer, TOML/YAML validation, merge conflict detection

This lets developers catch lint and formatting issues locally before pushing, saving CI round-trips.

Setup

pip install pre-commit  # or: pipx install pre-commit
pre-commit install

Then ruff lint + format runs automatically on each commit.

Test plan

  • Verified ruff check . passes on current master
  • Applied ruff format to fix 3 files with minor formatting differences
  • All pre-commit hooks pass after formatting

Important

Adds pre-commit configuration with ruff for linting and formatting, and auto-formats three files for consistency.

  • Pre-commit Configuration:
    • Adds .pre-commit-config.yaml with ruff hooks for linting and formatting.
    • Includes hooks for trailing whitespace, end-of-file fixer, TOML/YAML validation, and merge conflict detection.
  • Code Formatting:
    • Auto-formats aw_core/util.py, tests/test_query2.py, and tests/utils.py for minor inconsistencies.
  • Setup Instructions:
    • Provides setup instructions for installing and using pre-commit with ruff.
  • Testing:
    • Verified ruff check . passes on current master.
    • Applied ruff format to fix formatting in 3 files.
    • All pre-commit hooks pass after formatting.

This description was created by Ellipsis for 3def291. You can customize this summary. It will automatically update as commits are pushed.

Add .pre-commit-config.yaml with:
- ruff: lint checking with auto-fix (matches CI lint.yml)
- ruff-format: code formatting
- Standard file checks: trailing whitespace, end-of-file,
  TOML/YAML validity, merge conflict markers
Auto-formatted by ruff-format:
- aw_core/util.py
- tests/test_query2.py
- tests/utils.py
Copy link

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

Important

Looks good to me! 👍

Reviewed everything up to 3def291 in 9 seconds. Click for details.
  • Reviewed 82 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_GXQRCbGTlU06NFm8

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR adds pre-commit configuration to enable local linting and formatting checks before commits, reducing CI round-trips. The setup properly integrates with the existing ruff configuration in pyproject.toml and mirrors the CI lint workflow.

  • Pre-commit hooks configured for ruff linting (with auto-fix) and formatting
  • Standard file validation hooks included (trailing whitespace, end-of-file, TOML/YAML validation, merge conflict detection)
  • Three files auto-formatted with minor style improvements (condensed empty class, removed unnecessary line breaks, corrected operator spacing)
  • All formatting changes are cosmetic and maintain code functionality

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The PR adds development tooling without modifying any runtime logic, and all auto-formatting changes are minor cosmetic improvements that don't affect functionality
  • No files require special attention

Important Files Changed

Filename Overview
.pre-commit-config.yaml Added pre-commit configuration with ruff linting and formatting hooks, plus standard file validation checks
aw_core/util.py Auto-formatted empty exception class to single line per ruff style
tests/test_query2.py Auto-formatted to remove unnecessary line breaks in format calls and raw string assignments
tests/utils.py Auto-formatted exponentiation operator to remove spaces per PEP 8 style

Last reviewed commit: 3def291

Copy link

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

4 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@ErikBjare ErikBjare merged commit 1827ebf into ActivityWatch:master Feb 27, 2026
4 checks 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.

2 participants