Skip to content

fix: trivy-action version and gourmand violations#4

Merged
fatherlinux merged 1 commit into
mainfrom
fix/gha-gourmand
Mar 21, 2026
Merged

fix: trivy-action version and gourmand violations#4
fatherlinux merged 1 commit into
mainfrom
fix/gha-gourmand

Conversation

@fatherlinux
Copy link
Copy Markdown
Member

Summary

  • Bump trivy-action from 0.34.1 (non-existent tag) to 0.35.0 — fixes container build workflow
  • Remove verbose comments flagged by gourmand in database.py, tools/status.py, and tests/test_tools.py
  • Add lint_suppression exception for legitimate noqa: S608 in query_errors()

Test plan

  • CI passes (gourmand, ruff, mypy, pytest, container build)
  • Container push to Quay.io succeeds on merge

🤖 Generated with Claude Code

Bump trivy-action 0.34.1→0.35.0 (tag didn't exist), remove verbose
comments flagged by gourmand, add lint_suppression exception for
legitimate noqa: S608 in query_errors().

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@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 primarily focuses on enhancing the continuous integration process and improving code quality by addressing linting violations. It updates a critical CI action to ensure container builds function correctly and refines the codebase by removing unnecessary comments that were flagged by a static analysis tool. Additionally, it formalizes an existing lint suppression with a clear justification, ensuring that intentional code patterns do not trigger false positives in future linting runs.

Highlights

  • CI Workflow Fix: The trivy-action version has been updated from a non-existent tag (0.34.1) to 0.35.0, resolving issues in the container build workflow.
  • Gourmand Linting Compliance: Verbose comments flagged by the gourmand linter have been removed from database.py, tools/status.py, and tests/test_tools.py to improve code cleanliness.
  • Lint Suppression Exception: An exception has been added for lint_suppression to gourmand-exceptions.toml for a legitimate noqa: S608 directive in the query_errors() function within database.py, where f-string SQL is safely constructed.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/container.yml
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.

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 effectively resolves the gourmand linter violations by removing unnecessary comments and correctly suppressing a false positive for a SQL-related check. The changes are straightforward and improve code clarity. I've added one comment regarding a potential performance and correctness issue in the trove_quality tool, which became apparent during this review. Addressing it would significantly improve the tool's robustness.

resolved_filter: bool | None = None if show_resolved else False
errors = db.query_errors(resolved=resolved_filter, path=path, limit=limit)

# Compute aggregate counts across all errors (not just the page returned)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

While this PR removes a verbose comment, the underlying implementation for computing aggregate counts has a significant performance issue and a potential bug. Fetching up to 10,000 error records just to count them in Python is inefficient and will report incorrect statistics if the actual number of errors exceeds this limit.

A more scalable and performant approach is to compute these aggregates directly in the database. I recommend adding new functions to database.py to handle this, using SQL's COUNT(*) and GROUP BY. This avoids transferring large amounts of data and ensures the counts are always correct.

For example, you could replace the fetch-and-process logic with two more efficient queries:

  1. To get total and resolved counts:
SELECT COUNT(*) AS total, SUM(resolved) AS resolved_count
FROM index_errors
WHERE path LIKE ?; -- Optional path filter
  1. To get counts by error type:
SELECT error_type, COUNT(*)
FROM index_errors
WHERE path LIKE ? -- Optional path filter
GROUP BY error_type;

This would be a valuable improvement for the tool's robustness.

@fatherlinux fatherlinux merged commit f264ccd into main Mar 21, 2026
12 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.

1 participant