Skip to content

Feature: Update pre-commit hooks and dependencies#1

Merged
JacobPEvans merged 2 commits into
mainfrom
feat/more-default-pre-commit-hooks
Jul 12, 2025
Merged

Feature: Update pre-commit hooks and dependencies#1
JacobPEvans merged 2 commits into
mainfrom
feat/more-default-pre-commit-hooks

Conversation

@JacobPEvans
Copy link
Copy Markdown
Collaborator

@JacobPEvans JacobPEvans commented Jul 12, 2025

This pull request introduces several updates to enhance the project's development workflow, improve code quality, and modernize dependencies. Key changes include upgrading pre-commit hooks and dependencies, renaming and updating the development requirements file, refining documentation, and improving test code with type annotations and formatting.

Development Workflow and Tooling Updates:

  • Updated .pre-commit-config.yaml to use the latest versions of pre-commit hooks, added new hooks (check-toml, detect-private-key, no-commit-to-branch), and configured no-commit-to-branch to block commits to the main branch.
  • Renamed requirements.txt to requirements-dev.txt and updated it with the latest versions of development dependencies (black, flake8, isort, mypy, pytest, pre-commit).
  • Updated pyproject.toml to align with the updated development dependencies and increased the minimum supported version for pytest.

Documentation Improvements:

  • Added a new section in README.md to explain how to set up and use pre-commit hooks for code formatting, linting, and type checking.
  • Updated references in README.md to reflect the renaming of requirements.txt to requirements-dev.txt and adjusted example code to use the new greet function from hello_world.

Code Quality Enhancements:

  • Improved test code in tests/test_main.py by adding type annotations, reformatting parameterized tests for better readability, and ensuring compliance with modern Python typing standards.

Signed-off-by: JacobPEvans <20714140+JacobPEvans@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 12, 2025 17:01
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Summary of Changes

Hello @JacobPEvans, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request serves as a test case to validate the robustness and effectiveness of our automated code quality checks. It intentionally introduces formatting errors in a Python file to observe how the configured pre-commit hooks and any integrated CI/CD linters handle these violations. Additionally, the pre-commit configuration itself has been refined by reordering and adding new checks.

Highlights

  • Intentional Code Violations: I have deliberately introduced formatting and whitespace violations in src/hello_world/main.py to test how automated checks (like pre-commit hooks or CI linters) respond to non-compliant code. This includes changes to function definition syntax, docstring indentation, and excessive whitespace around operators.
  • Pre-commit Hook Configuration: I have updated the .pre-commit-config.yaml file. This change reorders existing hooks alphabetically for better readability and adds two new hooks: check-toml and detect-private-key from the pre-commit/pre-commit-hooks repository.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

Copilot AI left a comment

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 adjusts the main entrypoint signature and the module guard while also enhancing the pre-commit configuration with additional checks.

  • Broken up and modified main function definition
  • Introduced syntax error in the if __name__ guard
  • Added check-toml and detect-private-key hooks, reordered existing hooks in .pre-commit-config.yaml

Reviewed Changes

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

File Description
src/hello_world/main.py Updated main signature formatting and altered the __main__ guard
.pre-commit-config.yaml Added new pre-commit hooks (check-toml, detect-private-key) and reordered hooks
Comments suppressed due to low confidence (2)

src/hello_world/main.py:37

  • The function signature is invalid syntax: it's split across lines without a return annotation. Restore it to a single line, e.g., def main() -> None:.
def main(

src/hello_world/main.py:48

  • The conditional guard uses an assignment = instead of comparison == and missing string quoting. It should be if __name__ == "__main__":.
if __name__    =     __main__:

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

The pull request includes changes to the pre-commit configuration and the main Python file. The pre-commit changes reorder the hooks, and the Python file changes introduce formatting issues in the main function definition and the if __name__ condition. These formatting issues reduce readability and should be addressed.

Comment thread .pre-commit-config.yaml
Comment thread src/hello_world/main.py Outdated
Comment thread src/hello_world/main.py Outdated
@JacobPEvans JacobPEvans changed the title Test Failed Checks Feature: Update pre-commit hooks and dependencies Jul 12, 2025
@JacobPEvans JacobPEvans merged commit 8c4956e into main Jul 12, 2025
3 checks passed
@JacobPEvans JacobPEvans deleted the feat/more-default-pre-commit-hooks branch July 12, 2025 18:42
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