Skip to content

chore: add ruff, markdownlint, and file-hygiene pre-commit hooks#91

Merged
sanafayyaz315 merged 3 commits into
red-hat-data-services:mainfrom
sanafayyaz315:pre-commit-hooks-clean
May 5, 2026
Merged

chore: add ruff, markdownlint, and file-hygiene pre-commit hooks#91
sanafayyaz315 merged 3 commits into
red-hat-data-services:mainfrom
sanafayyaz315:pre-commit-hooks-clean

Conversation

@sanafayyaz315
Copy link
Copy Markdown
Contributor

Description

Adds ruff linting/formatting, markdownlint, and file-hygiene hooks to .pre-commit-config.yaml, building on the conventional commits hook from #85. Documents all pre-commit hooks in CONTRIBUTING.md with a new "Pre-commit hooks" section. Auto-fixes trailing whitespace and missing end-of-file newlines across 24 files via pre-commit run --all-files.

Jira Ticket

RHAIENG-4061

Testing

  • No testing required (documentation/config change only)
  • pre-commit run --all-files passes all 15 hooks

Checklist

  • I have read CONTRIBUTING.md
  • No .env or secret files are included in this PR
  • All changes are within scope of the linked Jira ticket

Review Guidance

  • .pre-commit-config.yaml — main deliverable. Review the hook selection and args (e.g., --fix for markdownlint, exclude: ^charts/ for check-yaml, --maxkb=1000 for large files, --branch=main for no-commit-to-branch)
  • CONTRIBUTING.md — new "Pre-commit hooks" section documents all hooks with a table for file-hygiene hooks
  • Remaining 24 files are auto-fixes (trailing whitespace, missing EOF newlines) — safe to skim

Related PRs

sanafayyaz315 and others added 2 commits May 5, 2026 09:45
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 5, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 446a132c-6db6-450e-85f2-f99bfc56b614

📥 Commits

Reviewing files that changed from the base of the PR and between 417e505 and 6214c46.

📒 Files selected for processing (1)
  • .pre-commit-config.yaml
✅ Files skipped from review due to trivial changes (1)
  • .pre-commit-config.yaml

📝 Walkthrough

Walkthrough

Repository pre-commit configuration is expanded (Ruff, ruff-format, markdownlint-cli2, and standard pre-commit-hooks with exclusions). Documentation (CONTRIBUTING.md) clarifies pre-commit usage. Numerous whitespace/EOF, minor formatting, license, and pyproject build-backend adjustments applied across agents and templates.

Changes

Pre-commit Hooks Setup and Repository Hygiene

Layer / File(s) Summary
Hook Configuration
.pre-commit-config.yaml
Adds ruff (runs with --fix and non-zero-on-fix), ruff-format, markdownlint-cli2 (with --fix), and pre-commit-hooks (whitespace/EOF, YAML/JSON/TOML checks, merge-conflict/large-file checks, debug-statement/case-conflict detection, mixed line endings, branch protection, private-key detection). Excludes ^charts/ for YAML checks.
Developer Docs
CONTRIBUTING.md
Expands development setup: explains that hooks validate staged files, notes hooks won't auto-run unless pre-commit install --install-hooks is executed, and adds pre-commit run --all-files as a manual verification command.
Build-system Normalization
agents/.../pyproject.toml (multiple)
Adds/ensures [build-system] build-backend = "setuptools.build_meta" in several agent pyproject.toml files; no dependency/version changes except whitespace edits.
Whitespace / EOF / Formatting Fixes
agents/.../pyproject.toml, agents/.../playground/templates/index.html, agents/.../.env.example, run_llama_server.yaml, etc.
Trailing whitespace removed, end-of-file newlines normalized/added, minor JSON/HTML EOF token adjustments, trivial placeholder/comment whitespace changes.
License and Text Adjustments
agents/.../LICENSE (multiple), agents/langgraph/agentic_rag/data/sample_knowledge.txt
Normalized license header lines (formatting/copyright line adjustments) and added a single doc bullet: “A/B test different configurations.”
Ignore and Git Hygiene
agents/langgraph/react_with_database_memory/.gitignore
Added trailing slash to inference_engine_cache/ ignore entry.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding three categories of pre-commit hooks (ruff, markdownlint, and file-hygiene), which aligns with the primary deliverable in the PR.
Description check ✅ Passed The description is comprehensive and directly related to the changeset, explaining the hooks added, documentation changes, auto-fixes applied, testing verification, and related PRs.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added the size/m label May 5, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
agents/langgraph/agentic_rag/LICENSE (1)

3-3: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing copyright holder name in MIT License.

The copyright line specifies only the year but omits the copyright holder's name. The MIT License requires the format Copyright (c) <year> <copyright holder>.

Add the appropriate copyright holder name (e.g., "Red Hat, Inc." or the relevant entity) to complete the license declaration and ensure legal compliance.

📋 Suggested fix
-Copyright (c) 2026
+Copyright (c) 2026 Red Hat, Inc.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agents/langgraph/agentic_rag/LICENSE` at line 3, Update the MIT License
header line in the LICENSE file so it includes the copyright holder name;
replace the existing line "Copyright (c) 2026" with the full required format,
e.g. "Copyright (c) 2026 Red Hat, Inc." (or the appropriate entity), ensuring
the LICENSE file's top copyright declaration in
agents/langgraph/agentic_rag/LICENSE is corrected.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@agents/langgraph/react_agent/LICENSE`:
- Line 3: Update the MIT License header by adding the copyright holder name
after the year on the copyright line (currently "Copyright (c) 2026"); for
example change it to "Copyright (c) 2026 Red Hat, Inc." (or the appropriate
entity) so the LICENSE file conforms to the required `Copyright (c) <year>
<copyright holder>` format.

In `@agents/llamaindex/websearch_agent/LICENSE`:
- Line 3: Update the LICENSE file's copyright line to include the copyright
holder name in the MIT license header (currently "Copyright (c) 2026"); replace
or augment that line to the required format such as "Copyright (c) 2026 Red Hat,
Inc." (or the correct entity name) so the MIT license header is complete and
legally compliant.

In `@agents/vanilla_python/openai_responses_agent/LICENSE`:
- Line 3: The LICENSE file's copyright line only has the year and must include
the copyright holder; open the LICENSE file and update the copyright line (the
single line that currently reads "Copyright (c) 2026") to include the owner name
(for example: "Copyright (c) 2026 Red Hat, Inc."); ensure the exact change is
applied in the LICENSE file and any other identical headers in the repo if
present.

---

Outside diff comments:
In `@agents/langgraph/agentic_rag/LICENSE`:
- Line 3: Update the MIT License header line in the LICENSE file so it includes
the copyright holder name; replace the existing line "Copyright (c) 2026" with
the full required format, e.g. "Copyright (c) 2026 Red Hat, Inc." (or the
appropriate entity), ensuring the LICENSE file's top copyright declaration in
agents/langgraph/agentic_rag/LICENSE is corrected.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 50714a96-36cb-4de9-be16-d2000608d4e3

📥 Commits

Reviewing files that changed from the base of the PR and between e537e34 and 417e505.

⛔ Files ignored due to path filters (4)
  • agents/a2a/langgraph_crewai_agent/src/a2a_langgraph_crewai/images/rh_logo.svg is excluded by !**/*.svg
  • agents/autogen/mcp_agent/images/rh_logo.svg is excluded by !**/*.svg
  • images/langgraph_logo.svg is excluded by !**/*.svg
  • images/rh_logo.svg is excluded by !**/*.svg
📒 Files selected for processing (23)
  • .pre-commit-config.yaml
  • CONTRIBUTING.md
  • agents/autogen/mcp_agent/mcp_automl_template/AUTOML_DEPLOYMENT.md
  • agents/autogen/mcp_agent/mcp_automl_template/pyproject.toml
  • agents/crewai/websearch_agent/.env.example
  • agents/crewai/websearch_agent/pyproject.toml
  • agents/google/adk/.env.example
  • agents/langflow/simple_tool_calling_agent/flows/outdoor-activity-agent.json
  • agents/langgraph/agentic_rag/LICENSE
  • agents/langgraph/agentic_rag/data/sample_knowledge.txt
  • agents/langgraph/react_agent/LICENSE
  • agents/langgraph/react_agent/playground/templates/index.html
  • agents/langgraph/react_with_database_memory/.gitignore
  • agents/langgraph/react_with_database_memory/playground/templates/index.html
  • agents/langgraph/react_with_database_memory/pyproject.toml
  • agents/llamaindex/websearch_agent/LICENSE
  • agents/llamaindex/websearch_agent/playground/templates/index.html
  • agents/llamaindex/websearch_agent/pyproject.toml
  • agents/vanilla_python/openai_responses_agent/.env.example
  • agents/vanilla_python/openai_responses_agent/LICENSE
  • agents/vanilla_python/openai_responses_agent/playground/templates/index.html
  • agents/vanilla_python/openai_responses_agent/pyproject.toml
  • run_llama_server.yaml
💤 Files with no reviewable changes (2)
  • agents/crewai/websearch_agent/.env.example
  • agents/vanilla_python/openai_responses_agent/.env.example

MIT License

Copyright (c) 2026 No newline at end of file
Copyright (c) 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing copyright holder name in MIT License.

The copyright line specifies only the year but omits the copyright holder's name. The MIT License requires the format Copyright (c) <year> <copyright holder>.

Add the appropriate copyright holder name (e.g., "Red Hat, Inc." or the relevant entity) to complete the license declaration and ensure legal compliance.

📋 Suggested fix
-Copyright (c) 2026
+Copyright (c) 2026 Red Hat, Inc.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Copyright (c) 2026
Copyright (c) 2026 Red Hat, Inc.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agents/langgraph/react_agent/LICENSE` at line 3, Update the MIT License
header by adding the copyright holder name after the year on the copyright line
(currently "Copyright (c) 2026"); for example change it to "Copyright (c) 2026
Red Hat, Inc." (or the appropriate entity) so the LICENSE file conforms to the
required `Copyright (c) <year> <copyright holder>` format.

MIT License

Copyright (c) 2026 No newline at end of file
Copyright (c) 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing copyright holder name in MIT License.

The copyright line specifies only the year but omits the copyright holder's name. The MIT License requires the format Copyright (c) <year> <copyright holder>.

Add the appropriate copyright holder name (e.g., "Red Hat, Inc." or the relevant entity) to complete the license declaration and ensure legal compliance.

📋 Suggested fix
-Copyright (c) 2026
+Copyright (c) 2026 Red Hat, Inc.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Copyright (c) 2026
Copyright (c) 2026 Red Hat, Inc.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agents/llamaindex/websearch_agent/LICENSE` at line 3, Update the LICENSE
file's copyright line to include the copyright holder name in the MIT license
header (currently "Copyright (c) 2026"); replace or augment that line to the
required format such as "Copyright (c) 2026 Red Hat, Inc." (or the correct
entity name) so the MIT license header is complete and legally compliant.

MIT License

Copyright (c) 2026 No newline at end of file
Copyright (c) 2026
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

Missing copyright holder name in MIT License.

The copyright line specifies only the year but omits the copyright holder's name. The MIT License requires the format Copyright (c) <year> <copyright holder>.

Add the appropriate copyright holder name (e.g., "Red Hat, Inc." or the relevant entity) to complete the license declaration and ensure legal compliance.

📋 Suggested fix
-Copyright (c) 2026
+Copyright (c) 2026 Red Hat, Inc.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Copyright (c) 2026
Copyright (c) 2026 Red Hat, Inc.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@agents/vanilla_python/openai_responses_agent/LICENSE` at line 3, The LICENSE
file's copyright line only has the year and must include the copyright holder;
open the LICENSE file and update the copyright line (the single line that
currently reads "Copyright (c) 2026") to include the owner name (for example:
"Copyright (c) 2026 Red Hat, Inc."); ensure the exact change is applied in the
LICENSE file and any other identical headers in the repo if present.

tarun-etikala added a commit to tarun-etikala/agentic-starter-kits that referenced this pull request May 5, 2026
…a-services#91

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Comment thread .pre-commit-config.yaml
@@ -20,3 +20,41 @@ repos:
- --subject-min-length=10
- --subject-max-length=72
- --allow-breaking
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggestion: move file-hygiene hooks before ruff/markdownlint

Convention is to put the fast normalizers (trailing-whitespace, end-of-file-fixer, etc.) before language-specific linters so they see already-clean files. With the current order, if a Python file has trailing whitespace, both ruff and trailing-whitespace try to fix it — potentially causing a confusing double-modification on the first run.

Suggested repo order in the config:

  1. conventional-commits (commit-msg stage — order doesn't matter)
  2. pre-commit/pre-commit-hooks (file-hygiene)
  3. ruff-pre-commit
  4. markdownlint-cli2

Copy link
Copy Markdown
Contributor

@tarun-etikala tarun-etikala left a comment

Choose a reason for hiding this comment

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

Looks good overall

Move pre-commit-hooks (trailing-whitespace, end-of-file-fixer, etc.)
before ruff and markdownlint so normalizers see already-clean files.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@tarun-etikala
Copy link
Copy Markdown
Contributor

LGTM

@sanafayyaz315 sanafayyaz315 merged commit 615c91e into red-hat-data-services:main May 5, 2026
3 checks passed
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