Skip to content

Start applying Repo-Review rule#711

Open
DimitriPapadopoulos wants to merge 7 commits intoReproNim:masterfrom
DimitriPapadopoulos:repo-review
Open

Start applying Repo-Review rule#711
DimitriPapadopoulos wants to merge 7 commits intoReproNim:masterfrom
DimitriPapadopoulos:repo-review

Conversation

@DimitriPapadopoulos
Copy link
Copy Markdown
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Mar 4, 2026

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 focuses on improving code quality, documentation consistency, and static analysis configurations. It introduces new pre-commit hooks for reStructuredText (RST) formatting, standardizes RST syntax in the user guides, refines Python type hinting by specifying ignore reasons, and enhances mypy and pytest configurations to catch more potential issues early. These changes align with applying a "Repo-Review rule" to maintain a higher standard of code and documentation.

Highlights

  • Enhanced Code Quality Checks: Integrated pygrep-hooks into the pre-commit configuration to enforce reStructuredText (RST) formatting rules, ensuring consistent documentation style.
  • Improved Documentation Consistency: Standardized RST syntax across several user guide files by correcting backtick usage and directive formatting, making the documentation more readable and compliant.
  • Refined Type Hinting: Updated Python type ignore comments with specific error codes and removed unnecessary generic type ignores, improving the accuracy and utility of static analysis.
  • Strengthened Static Analysis Configuration: Configured mypy to enable specific error codes and warn about unreachable code, and added pytest to treat warnings as errors, catching more potential issues early in the development cycle.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .pre-commit-config.yaml
    • Added pygrep-hooks repository with rst-backticks, rst-directive-colons, and rst-inline-touching-normal hooks.
  • docs/user_guide/cli.rst
    • Corrected backtick usage for docker and singularity subcommands.
  • docs/user_guide/examples.rst
    • Fixed .. note :: directive spacing.
  • docs/user_guide/installation.rst
    • Corrected backtick usage for --yes option and latest version tag.
  • docs/user_guide/quickstart.rst
    • Corrected backtick usage for various code snippets and commands.
  • neurodocker/cli/minify/_prune.py
    • Removed a redundant isinstance check for directories_to_prune.
  • neurodocker/reproenv/renderers.py
    • Removed type: ignore comments in env and label methods.
  • neurodocker/reproenv/state.py
    • Updated type: ignore to type: ignore[assignment] for SafeLoader import.
  • neurodocker/reproenv/template.py
    • Updated type: ignore to type: ignore[unreachable] in __init__ and type: ignore[return-value] in dependencies.
  • pyproject.toml
    • Enabled mypy error codes ignore-without-code, redundant-expr, truthy-bool, and warn_unreachable.
    • Added filterwarnings = ["error"] to pytest configuration.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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

@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

This pull request improves code quality by enabling stricter static analysis with mypy and pre-commit hooks for RST files, and applies the necessary fixes. However, a critical security vulnerability was identified: potential injection vulnerabilities in the SingularityRenderer class within neurodocker/reproenv/renderers.py. The env and label methods lack proper sanitization of user-supplied input, which could lead to remote code execution. While the overall code changes are solid and address issues found by the new rules, it is imperative to implement sanitization to prevent these injection attacks. Additionally, consider aligning type hints in neurodocker/reproenv/template.py to eliminate a type: ignore.

Filter warnings specified
Uses PyGrep hooks (only needed if rST present)
MyPy warn unreachable
MyPy enables ignore-without-code
MyPy enables redundant-expr
MyPy enables truthy-bool
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