Skip to content

fix: other Makefiles issues#2441

Merged
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:fix-makefile
Feb 2, 2026
Merged

fix: other Makefiles issues#2441
chmouel merged 1 commit intotektoncd:mainfrom
chmouel:fix-makefile

Conversation

@chmouel
Copy link
Copy Markdown
Member

@chmouel chmouel commented Feb 2, 2026

Address code review feedback from PR #2440:

  • Fix macro to pass command as second argument to xargs
  • Fix .PHONE typo to .PHONY for fix-python-errors target
  • Fix git status --porcelain usage (doesn't read from stdin)
  • Add || true to sed for consistency with other fix targets
  • Add -- separator to sed to prevent filename injection

Assisted-by: Claude Opus 4.5 (via Claude Code)

📝 Description of the Change

👨🏻‍ Linked Jira

🔗 Linked GitHub Issue

Fixes #

🚀 Type of Change

  • 🐛 Bug fix (fix:)
  • ✨ New feature (feat:)
  • 💥 Breaking change (feat!:, fix!:)
  • 📚 Documentation update (docs:)
  • ⚙️ Chore (chore:)
  • 💅 Refactor (refactor:)
  • 🔧 Enhancement (enhance:)
  • 📦 Dependency update (deps:)

🧪 Testing Strategy

  • Unit tests
  • Integration tests
  • End-to-end tests
  • Manual testing
  • Not Applicable

🤖 AI Assistance

  • I have not used any AI assistance for this PR.
  • I have used AI assistance for this PR.

If you have used AI assistance, please provide the following details:

Which LLM was used?

  • GitHub Copilot
  • ChatGPT (OpenAI)
  • Claude (Anthropic)
  • Cursor
  • Gemini (Google)
  • Other: ____________

Extent of AI Assistance:

  • Documentation and research only
  • Unit tests or E2E tests only
  • Code generation (parts of the code)
  • Full code generation (most of the PR)
  • PR description and comments
  • Commit message(s)

Important

If the majority of the code in this PR was generated by an AI, please add a Co-authored-by trailer to your commit message.
For example:

Co-authored-by: Gemini gemini@google.com
Co-authored-by: ChatGPT noreply@chatgpt.com
Co-authored-by: Claude noreply@anthropic.com
Co-authored-by: Cursor noreply@cursor.com
Co-authored-by: Copilot Copilot@users.noreply.github.com

**💡You can use the script ./hack/add-llm-coauthor.sh to automatically add
these co-author trailers to your commits.

✅ Submitter Checklist

  • 📝 My commit messages are clear, informative, and follow the project's How to write a git commit message guide. The Gitlint linter ensures in CI it's properly validated
  • ✨ I have ensured my commit message prefix (e.g., fix:, feat:) matches the "Type of Change" I selected above.
  • ♽ I have run make test and make lint locally to check for and fix any
    issues. For an efficient workflow, I have considered installing
    pre-commit and running pre-commit install to
    automate these checks.
  • 📖 I have added or updated documentation for any user-facing changes.
  • 🧪 I have added sufficient unit tests for my code changes.
  • 🎁 I have added end-to-end tests where feasible. See README for more details.
  • 🔎 I have addressed any CI test flakiness or provided a clear reason to bypass it.
  • If adding a provider feature, I have filled in the following and updated the provider documentation:
    • GitHub App
    • GitHub Webhook
    • Gitea/Forgejo
    • GitLab
    • Bitbucket Cloud
    • Bitbucket Data Center

Address code review feedback from PR tektoncd#2440:
- Fix macro to pass command as second argument to xargs
- Fix .PHONE typo to .PHONY for fix-python-errors target
- Fix git status --porcelain usage (doesn't read from stdin)
- Add || true to sed for consistency with other fix targets
- Add -- separator to sed to prevent filename injection

Signed-off-by: Chmouel Boudjnah <chmouel@redhat.com>
Assisted-by: Claude Opus 4.5 (via Claude Code)
Copilot AI review requested due to automatic review settings February 2, 2026 13:41
@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @chmouel, 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 refines several Makefile targets, primarily focusing on improving the reliability and correctness of linting and code-fixing operations. It addresses issues identified in a previous code review, enhancing the GIT_LS_FILES macro for better command execution with xargs, correcting git status --porcelain usage, and fixing minor but important details like a .PHONY typo and adding robustness to sed commands. The overall impact is a more robust and consistent build and linting process.

Highlights

  • Improved GIT_LS_FILES Macro: The GIT_LS_FILES macro in Makefile has been enhanced to correctly pass commands as a second argument to xargs, ensuring proper execution of linting and fixing tools. It also includes xargs -r to prevent running commands on empty input and -- for git ls-files for robust argument handling.
  • Corrected Makefile Targets: Several linting and fixing targets (lint-yaml, lint-md, lint-python, lint-shell, fix-markdownlint, fix-trailing-spaces, fix-python-errors) have been updated to utilize the improved GIT_LS_FILES macro, ensuring consistent and correct command invocation.
  • Fixed git status --porcelain Usage: The git status --porcelain command within fix-trailing-spaces and fix-python-errors targets has been corrected to properly identify changed files without relying on xargs for input, making the status checks more reliable.
  • Makefile Typo and Robustness: A typo .PHONE was corrected to .PHONY for the fix-python-errors target, and || true was added to the sed command in fix-trailing-spaces for consistency and to prevent build failures on non-zero exit codes.
  • Enhanced sed Command Safety: The sed command in fix-trailing-spaces now includes a -- separator to prevent potential filename injection vulnerabilities.
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.

@pipelines-as-code
Copy link
Copy Markdown

🔍 PR Lint Feedback

Note: This automated check helps ensure your PR follows our contribution guidelines.

⚠️ Items that need attention:

🎫 Jira reference

Add a Jira reference in the description using one of the following formats:

  • https://issues.redhat.com/browse/SRVKP-<number>

If no SRVKP ticket exists yet, link a GitHub issue instead (e.g., Fixes #123).
Minor housekeeping PRs without Jira coverage can skip this after confirming with reviewers.


ℹ️ Next Steps

  • Review and address the items above
  • Push new commits to update this PR
  • This comment will be automatically updated when issues are resolved
🔧 Admin Tools (click to expand)

Automated Issue/Ticket Creation:

  • /issue-create - Generate a GitHub issue from this PR content using AI
  • /jira-create - Create a SRVKP Jira ticket from this PR content using AI

⚠️ Important: Always review and edit generated content before finalizing tickets/issues.
The AI-generated content should be used as a starting point and may need adjustments.

These commands are available to maintainers and will post the generated content as PR comments for review.

🤖 This feedback was generated automatically by the PR CI system

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 introduces several fixes and improvements to the Makefile, primarily focused on standardizing how file lists are passed to various linting and fixing commands. The new GIT_LS_FILES macro is a good step towards more robust and readable recipes. My review focuses on a regression introduced in the git status commands. While most changes are positive, I've identified that the new implementation for checking file status is not safe for filenames containing spaces and have suggested a fix that leverages the new macro to address this. Other changes, such as typo fixes and ensuring command consistency, are well-implemented.

@$(call GIT_LS_FILES,$(MD_YAML_PATTERNS)) sed --in-place 's/[[:space:]]\+$$//'
@STATUS=$$($(call GIT_LS_FILES,$(MD_YAML_PATTERNS)) git status --porcelain) && \
@$(call GIT_LS_FILES,$(MD_YAML_PATTERNS),sed --in-place 's/[[:space:]]\+$$//' --) || true
@STATUS=$$(git status --porcelain -- $$(git ls-files -- $(MD_YAML_PATTERNS))) && \
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

This change introduces a potential issue with filenames containing spaces. The $$() command substitution is subject to word splitting by the shell, which can break the command if any file path contains spaces. The previous implementation using xargs -0 was safer. I recommend using the new GIT_LS_FILES macro here to ensure the command remains robust.

@STATUS=$$($(call GIT_LS_FILES,$(MD_YAML_PATTERNS),git status --porcelain)) && \

@STATUS=$$($(call GIT_LS_FILES,$(PY_PATTERNS)) git status --porcelain) && \
@$(call GIT_LS_FILES,$(PY_PATTERNS),ruff check --fix) || true
@$(call GIT_LS_FILES,$(PY_PATTERNS),ruff format) || true
@STATUS=$$(git status --porcelain -- $$(git ls-files -- $(PY_PATTERNS))) && \
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

Similar to the fix-trailing-spaces target, this change is not robust against filenames containing spaces due to shell word splitting. Please use the GIT_LS_FILES macro for safety and consistency.

@STATUS=$$($(call GIT_LS_FILES,$(PY_PATTERNS),git status --porcelain)) && \

Copy link
Copy Markdown
Contributor

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 addresses code review feedback from PR #2440 by fixing several issues in the Makefile related to file list handling and target declarations.

Changes:

  • Fixed the GIT_LS_FILES macro to properly accept patterns and command as separate parameters and pass them correctly to xargs
  • Corrected .PHONE typo to .PHONY for the fix-python-errors target
  • Fixed git status --porcelain commands to properly use command substitution instead of incorrect piping from xargs

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@chmouel chmouel merged commit db52515 into tektoncd:main Feb 2, 2026
8 checks passed
@chmouel chmouel deleted the fix-makefile branch February 2, 2026 13:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants