Skip to content

Add pre-commit hooks with Black formatter and flake8 linter#88

Merged
thawn merged 5 commits intomasterfrom
copilot/add-pre-commit-hooks
Dec 31, 2025
Merged

Add pre-commit hooks with Black formatter and flake8 linter#88
thawn merged 5 commits intomasterfrom
copilot/add-pre-commit-hooks

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Dec 31, 2025

Add Pre-commit Hooks with Black Formatter

Completed:

  • Add pre-commit and black to dev dependencies in pyproject.toml
  • Add flake8 and isort for linting and import sorting
  • Create .pre-commit-config.yaml with hooks configuration
  • Create .flake8 configuration file for flake8 settings
  • Configure black settings in pyproject.toml (line-length: 88, target Python 3.11+)
  • Configure isort with Black-compatible profile
  • Update .gitignore for pre-commit cache
  • Test pre-commit hooks installation and execution
  • Apply auto-formatting to all Python files (Black, isort)
  • Fix critical tab/space mixing issues in SQL strings
  • Create CONTRIBUTING.md with pre-commit usage documentation
  • Verify all pre-commit hooks pass successfully
  • Address code review feedback (removed duplicate config, fixed spelling)
  • Fix all flake8 linting issues:
    • Removed all unused imports (F401)
    • Removed all unused variables (F841)
    • Fixed loop variables not used (B007)
    • Fixed bare except clauses (E722, B001)
    • Fixed mutable default arguments (B006)
    • Fixed redundant exception types (B014)
    • Fixed f-strings without placeholders (F541)
    • Fixed unused global declarations (F824)
    • Added spacing around arithmetic operators (E226)
    • Configured E501 ignore for Black compatibility
  • All tests passing:
    • 112 unit tests passed
    • 8 integration tests passed
    • Code coverage maintained at 58%
  • All pre-commit hooks passing

Summary:

Pre-commit hooks are now fully functional with:

  • Black formatting all Python code
  • isort organizing imports
  • flake8 with bugbear catching code quality issues
  • All existing code cleaned up and passing linting
  • Zero linting errors or warnings
Original prompt

add pre-commit hooks that run code linter and formatter (black)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Dec 31, 2025
Copilot AI and others added 2 commits December 31, 2025 03:21
Co-authored-by: thawn <1308449+thawn@users.noreply.github.com>
Co-authored-by: thawn <1308449+thawn@users.noreply.github.com>
Copilot AI changed the title [WIP] Add pre-commit hooks for code linter and formatter Add pre-commit hooks with Black formatter and flake8 linter Dec 31, 2025
Copilot AI requested a review from thawn December 31, 2025 03:25
@thawn
Copy link
Copy Markdown
Owner

thawn commented Dec 31, 2025

@copilot Fix the flake8 issues and run all tests afterwards to make sure nothing broke

Copilot AI and others added 2 commits December 31, 2025 03:43
…clean up code

Co-authored-by: thawn <1308449+thawn@users.noreply.github.com>
…remove unused Dict import

Co-authored-by: thawn <1308449+thawn@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot Fix the flake8 issues and run all tests afterwards to make sure nothing broke

Fixed all flake8 issues in commits 8cd83b0 and 220c2ce. All linting errors have been resolved:

  • Removed unused imports (F401)
  • Removed unused variables (F841)
  • Fixed loop variables (B007)
  • Fixed bare except clauses (E722, B001)
  • Fixed mutable defaults (B006)
  • Fixed redundant exceptions (B014)
  • Fixed f-strings without placeholders (F541)
  • Fixed unused global declarations (F824)
  • Added spacing around operators (E226)

All 112 unit tests and 8 integration tests pass successfully. Pre-commit hooks now run cleanly with Black, isort, and flake8.

@thawn thawn marked this pull request as ready for review December 31, 2025 04:04
@thawn thawn merged commit 74df04e into master Dec 31, 2025
10 of 11 checks passed
@thawn thawn deleted the copilot/add-pre-commit-hooks branch December 31, 2025 04:04
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