Skip to content

chore: up pre-commit-hooks version and fixes - #2668

Merged
IsmaelMartinez merged 8 commits into
The-PR-Agent:mainfrom
even-even:up_pre-commit-hooks_and_fixes
Aug 29, 2026
Merged

IsmaelMartinez merged 8 commits into
The-PR-Agent:mainfrom
even-even:up_pre-commit-hooks_and_fixes

Conversation

@even-even

Copy link
Copy Markdown
Contributor

Hello

In PR:

  1. up pre-commit hooks to 6.0
  2. add new rules
  3. fixes in code

Also:
Commented pre-commit isort (fixing more than 60 files that are not related to this PR)

@qodo-code-review

Copy link
Copy Markdown
Contributor

PR Summary by Qodo

Bump pre-commit-hooks to v6.0.0 and apply repo-wide lint/whitespace fixes

⚙️ Configuration changes 📝 Documentation 🕐 20-40 Minutes

Grey Divider

AI Description

• Upgrade pre-commit-hooks to v6.0.0 and enable additional validation hooks.
• Apply whitespace/EOF/line-ending cleanups across docs, source, and tests to pass hooks.
• Keep isort disabled (commented) to avoid unrelated large-scale reformatting.
Diagram

graph TD
  Dev(Developer) --> PreCommit["pre-commit"] --> Config[".pre-commit-config.yaml"] --> HooksRepo["pre-commit-hooks v6"] --> Checks["New validations"] --> RepoFiles["Docs & Python files"] --> Gate["Local/CI gate"]
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Split into two PRs (pre-commit upgrade vs formatting-only)
  • ➕ Easier review: config change can be evaluated independently of mass whitespace churn
  • ➕ Reduces risk of hidden semantic changes being missed in large diffs
  • ➖ Adds process overhead (two PRs, two merges)
  • ➖ May require rebase if formatting depends on new hooks
2. Enable isort with targeted excludes (instead of fully commenting it out)
  • ➕ Keeps import ordering enforcement while avoiding huge one-time repo rewrite
  • ➕ Gradually improves consistency without unrelated file churn
  • ➖ Requires careful exclude patterns to avoid ongoing noise
  • ➖ May still touch some files and trigger discussions about formatting baseline
3. Add a formatter/linter baseline (e.g., ruff/black) to reduce future whitespace-only diffs
  • ➕ More deterministic formatting, fewer manual whitespace edits
  • ➕ Can replace multiple small hooks with a single consistent toolchain
  • ➖ Bigger tooling decision; could cause a large initial reformat PR
  • ➖ Needs team agreement on style and CI integration

Recommendation: The chosen approach (upgrade hooks + minimal cleanups) is fine, but consider splitting config vs formatting in future to improve review signal-to-noise. If import ordering is desired, re-enable isort in a dedicated PR or with excludes to avoid unrelated mass changes.

Files changed (36) +181 / -176

Refactor (13) +43 / -45
pr_agent.pyWhitespace cleanup in extra instructions handling +1/-1

Whitespace cleanup in extra instructions handling

• Removes stray whitespace line inside the language-specific extra-instructions logic without changing behavior.

pr_agent/agent/pr_agent.py

langchain_ai_handler.pyWhitespace normalization in LangChain handler +3/-3

Whitespace normalization in LangChain handler

• Removes trailing whitespace and normalizes formatting in async chat creation and error handling paths.

pr_agent/algo/ai_handlers/langchain_ai_handler.py

cli_args.pyRemove trailing blank lines at file end +0/-2

Remove trailing blank lines at file end

• Trims unnecessary trailing lines to satisfy end-of-file and whitespace hooks.

pr_agent/algo/cli_args.py

token_handler.pyWhitespace-only cleanup in token counting logic +7/-7

Whitespace-only cleanup in token counting logic

• Normalizes blank lines and removes trailing whitespace in model type validation and Claude token counting paths.

pr_agent/algo/token_handler.py

azuredevops_provider.pyWhitespace cleanup around Azure DevOps comment utilities +5/-5

Whitespace cleanup around Azure DevOps comment utilities

• Removes trailing whitespace and normalizes spacing in thread/comment helper methods and PR URL parsing.

pr_agent/git_providers/azuredevops_provider.py

bitbucket_server_provider.pyWhitespace normalization in Bitbucket Server provider init +1/-1

Whitespace normalization in Bitbucket Server provider init

• Removes trailing whitespace in the PR URL parsing/initialization flow without changing behavior.

pr_agent/git_providers/bitbucket_server_provider.py

github_provider.pyWhitespace cleanup in GitHub thread comment retrieval and sub-issues fetch +8/-8

Whitespace cleanup in GitHub thread comment retrieval and sub-issues fetch

• Normalizes docstring spacing and blank lines; no functional changes to the thread-building logic.

pr_agent/git_providers/github_provider.py

aws_secrets_manager_provider.pyRemove trailing whitespace in exception re-raise +1/-1

Remove trailing whitespace in exception re-raise

• Trims a trailing space on the raised exception line to satisfy whitespace hooks.

pr_agent/secret_providers/aws_secrets_manager_provider.py

github_lambda_webhook.pyEnsure newline at EOF in GitHub lambda webhook +1/-1

Ensure newline at EOF in GitHub lambda webhook

• Adds the missing newline at end-of-file to comply with end-of-file-fixer.

pr_agent/servers/github_lambda_webhook.py

gitlab_lambda_webhook.pyEnsure newline at EOF in GitLab lambda webhook +1/-1

Ensure newline at EOF in GitLab lambda webhook

• Adds the missing newline at end-of-file to comply with end-of-file-fixer.

pr_agent/servers/gitlab_lambda_webhook.py

gitlab_webhook.pyWhitespace cleanup in GitLab webhook push handling +1/-1

Whitespace cleanup in GitLab webhook push handling

• Removes trailing whitespace in the push-event handling branch without changing control flow.

pr_agent/servers/gitlab_webhook.py

pr_line_questions.pyWhitespace normalization in thread history formatting +11/-11

Whitespace normalization in thread history formatting

• Cleans up blank lines and normalizes a multiline join expression while keeping conversation history output unchanged.

pr_agent/tools/pr_line_questions.py

pr_update_changelog.pyWhitespace-only cleanup in changelog update tool +3/-3

Whitespace-only cleanup in changelog update tool

• Normalizes blank lines/spacing in changelog preparation and file decoding logic; behavior remains the same.

pr_agent/tools/pr_update_changelog.py

Tests (13) +86 / -90
langchain_ai_handler.pyFix EOF/newline and whitespace in e2e LangChain test script +15/-17

Fix EOF/newline and whitespace in e2e LangChain test script

• Normalizes blank lines and ensures proper newline at EOF to satisfy pre-commit formatting hooks.

tests/e2e_tests/langchain_ai_handler.py

test_gitea_app.pyWhitespace and EOF fixes in Gitea e2e test +23/-23

Whitespace and EOF fixes in Gitea e2e test

• Removes trailing whitespace across the test and ensures newline at EOF; no behavior changes intended.

tests/e2e_tests/test_gitea_app.py

test_gitlab_webhook.pyRemove unused import and normalize log message formatting +1/-2

Remove unused import and normalize log message formatting

• Drops an unused import and converts a log f-string with no interpolation to a plain string; minor cleanup for linting.

tests/e2e_tests/test_gitlab_webhook.py

test_aws_secrets_manager_provider.pyTrim trailing whitespace in unit test +1/-1

Trim trailing whitespace in unit test

• Removes a trailing space at end of an assertion line to satisfy whitespace hooks.

tests/unittest/test_aws_secrets_manager_provider.py

test_azure_devops_comment.pyEnsure newline at EOF in Azure DevOps unit test +1/-1

Ensure newline at EOF in Azure DevOps unit test

• Adds newline at end-of-file to comply with end-of-file-fixer.

tests/unittest/test_azure_devops_comment.py

test_azure_devops_parsing.pyRemove trailing whitespace and blank line in parsing tests +1/-2

Remove trailing whitespace and blank line in parsing tests

• Cleans up extra blank line/trailing whitespace to satisfy formatting hooks.

tests/unittest/test_azure_devops_parsing.py

test_clip_tokens.pyEnsure newline at EOF in token clipping tests +1/-1

Ensure newline at EOF in token clipping tests

• Adds missing newline at end-of-file to comply with end-of-file-fixer.

tests/unittest/test_clip_tokens.py

test_config_loader_secrets.pyWhitespace cleanup in secrets config loader tests +2/-2

Whitespace cleanup in secrets config loader tests

• Normalizes blank lines and removes trailing whitespace in unit tests without changing assertions.

tests/unittest/test_config_loader_secrets.py

test_extend_patch.pyAdjust expected diff header formatting in tests +3/-3

Adjust expected diff header formatting in tests

• Updates expected patch header strings and ensures newline at EOF, aligning test expectations with normalized diff formatting.

tests/unittest/test_extend_patch.py

test_file_filter.pyWhitespace cleanup in file filter tests +1/-1

Whitespace cleanup in file filter tests

• Removes trailing whitespace and normalizes spacing to satisfy pre-commit whitespace rules.

tests/unittest/test_file_filter.py

test_ignore_repositories.pyEnsure newline at EOF in ignore repositories test +1/-1

Ensure newline at EOF in ignore repositories test

• Adds missing newline at end-of-file to comply with end-of-file-fixer.

tests/unittest/test_ignore_repositories.py

test_pr_update_changelog.pyWhitespace and EOF normalization in changelog tool tests +32/-32

Whitespace and EOF normalization in changelog tool tests

• Cleans up trailing whitespace, normalizes blank lines, and ensures newline at EOF; test logic remains the same.

tests/unittest/test_pr_update_changelog.py

test_secret_provider_factory.pyWhitespace cleanup in secret provider factory tests +4/-4

Whitespace cleanup in secret provider factory tests

• Removes trailing whitespace in test blocks to satisfy formatting hooks.

tests/unittest/test_secret_provider_factory.py

Documentation (7) +32 / -32
README.mdFix markdown whitespace and formatting consistency +4/-4

Fix markdown whitespace and formatting consistency

• Removes trailing spaces and normalizes blank lines/heading punctuation to satisfy whitespace hooks and markdown formatting consistency.

README.md

fetching_ticket_context.mdNormalize whitespace in documentation code blocks +10/-10

Normalize whitespace in documentation code blocks

• Cleans up blank lines/whitespace around embedded Python examples to satisfy trailing-whitespace and EOF rules.

docs/docs/core-abilities/fetching_ticket_context.md

index.mdRemove trailing whitespace in FAQ markdown +4/-4

Remove trailing whitespace in FAQ markdown

• Normalizes blank lines and removes trailing whitespace in FAQ sections to comply with stricter pre-commit checks.

docs/docs/faq/index.md

describe.mdTidy markdown headings and spacing +2/-2

Tidy markdown headings and spacing

• Fixes heading spacing and removes trailing whitespace to align with markdown/whitespace lint rules.

docs/docs/tools/describe.md

improve.mdFix trailing whitespace and tip block spacing +9/-9

Fix trailing whitespace and tip block spacing

• Removes trailing spaces and normalizes blank lines inside admonition/tip blocks to satisfy formatting hooks.

docs/docs/tools/improve.md

automations_and_usage.mdNormalize whitespace in usage guide +2/-2

Normalize whitespace in usage guide

• Removes trailing whitespace and adjusts spacing around emphasized text for consistent markdown rendering.

docs/docs/usage-guide/automations_and_usage.md

configuration_options.mdRemove trailing whitespace in configuration docs +1/-1

Remove trailing whitespace in configuration docs

• Cleans up a trailing space and normalizes line endings to satisfy whitespace checks.

docs/docs/usage-guide/configuration_options.md

Other (3) +20 / -9
.pre-commit-config.yamlUpgrade pre-commit-hooks to v6 and enable additional checks +18/-7

Upgrade pre-commit-hooks to v6 and enable additional checks

• Bumps pre-commit-hooks from v5.0.0 to v6.0.0 and enables multiple new validation hooks (AST, JSON, merge conflict markers, symlinks, debug statements, line endings). Adds args for YAML unsafe parsing and enforces LF line endings. Leaves isort configuration commented out to avoid broad unrelated changes.

.pre-commit-config.yaml

generated_code_ignore.tomlTrim trailing whitespace in generated code ignore config +1/-1

Trim trailing whitespace in generated code ignore config

• Normalizes comment spacing in TOML to satisfy whitespace hooks and keep config consistent.

pr_agent/settings/generated_code_ignore.toml

pr_reviewer_prompts.tomlFix trailing whitespace in prompt template +1/-1

Fix trailing whitespace in prompt template

• Removes trailing whitespace from a Jinja/TOML template line to satisfy whitespace linting.

pr_agent/settings/pr_reviewer_prompts.toml

@qodo-code-review

qodo-code-review Bot commented Aug 15, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (3) 📜 Skill insights (0)

Grey Divider


Action required

1. Incorrect diff header expected ✓ Resolved 🐞 Bug ≡ Correctness
Description
TestLoadLargeDiff.test_no_newline now expects diff headers ---/+++ without the trailing space,
but load_large_diff() uses difflib.unified_diff() (with default empty from/to filenames) which
emits --- \n and +++ \n. This PR change will cause that unit test to fail against the current
implementation.
Code

tests/unittest/test_extend_patch.py[R181-182]

+---
++++
Relevance

●●● Strong

Deterministic failing-test mismatch with difflib unified_diff header spacing; typically fixed
immediately.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test’s expected string no longer includes the trailing space in the --- / +++ lines, while
load_large_diff() still uses difflib.unified_diff() defaults that produce --- \n and +++ \n
(note the space). Another test in the same file still expects the spaced form, reinforcing that the
implementation hasn’t changed to the new header format.

tests/unittest/test_extend_patch.py[168-196]
pr_agent/algo/utils.py[685-701]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`tests/unittest/test_extend_patch.py::TestLoadLargeDiff.test_no_newline` expects unified-diff header lines that do not match what `pr_agent.algo.utils.load_large_diff()` currently returns.

`load_large_diff()` calls `difflib.unified_diff()` without passing `fromfile`/`tofile`, so the generated header lines include a trailing space before the newline (`"--- \n"`, `"+++ \n"`). The updated test expects `"---\n"` and `"+++\n"`, causing a deterministic test failure.

## Issue Context
There is already an assertion in `test_empty_inputs` that expects `'--- \n+++ \n...'`, which matches the current `difflib.unified_diff` output format.

## Fix Focus Areas
- tests/unittest/test_extend_patch.py[168-196]
- pr_agent/algo/utils.py[685-701]

## Suggested fix
Update `patch_expected` in `test_no_newline` to match the existing behavior (`--- ` and `+++ ` with trailing spaces), or (if you intentionally want to normalize headers) change `load_large_diff()` to generate the new header format and update *all* related tests consistently.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. Whitespace check skips test file 📘 Rule violation ⚙ Maintainability ⭐ New
Description
The new exclusion disables trailing-whitespace for an entire source file that contains physical
trailing spaces in its expected diff headers. This preserves the rule violation and permits
unrelated trailing whitespace in that file to bypass pre-commit checks.
Code

.pre-commit-config.yaml[27]

+        exclude: ^tests/unittest/test_extend_patch\.py$ # trailing space; stripping it breaks the test.
Relevance

●●● Strong

Recent precedents consistently accept removing trailing whitespace to preserve repository-wide
pre-commit enforcement.

PR-#2545
PR-#2637
PR-#2454

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2694658 requires changed source files to contain no spaces or tabs immediately
before line breaks. The new pre-commit exclusion skips the whole test file, while its expected `---
 and +++ ` lines contain the trailing spaces the exclusion was added to preserve.

Rule 2694658: Disallow trailing whitespace in source files
.pre-commit-config.yaml[26-27]
tests/unittest/test_extend_patch.py[182-185]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The `trailing-whitespace` hook excludes all of `tests/unittest/test_extend_patch.py` because expected diff headers contain significant trailing spaces.

## Issue Context
Keep the expected spaces without physical end-of-line whitespace by constructing or escaping those header strings explicitly, then remove the file-wide hook exclusion.

## Fix Focus Areas
- .pre-commit-config.yaml[27-27]
- tests/unittest/test_extend_patch.py[182-185]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. store_secret arguments use single quotes 📘 Rule violation ⚙ Maintainability
Description
The modified test line retains single-quoted string literals for test-secret and test-value,
contrary to the required Python quote style. This creates avoidable style inconsistency in a line
changed by the PR.
Code

tests/unittest/test_aws_secrets_manager_provider.py[90]

+            provider.store_secret('test-secret', 'test-value')
Relevance

●●● Strong

Team has accepted double-quote style fixes in changed test lines multiple times, including in test
files.

PR-#2569
PR-#2526

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 2694657 requires Python string literals to use double quotes. The changed line calls
provider.store_secret('test-secret', 'test-value'), and neither literal qualifies for the escaping
exception.

Rule 2694657: Use double quotes for all Python string literals
tests/unittest/test_aws_secrets_manager_provider.py[90-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The modified `store_secret` call uses single-quoted string literals, violating the required Python string style.

## Issue Context
PR Compliance ID 2694657 requires double quotes for Python string literals unless double quotes would require additional escaping; these literals need no escaping.

## Fix Focus Areas
- tests/unittest/test_aws_secrets_manager_provider.py[90-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. load_large_diff uses single quotes 📘 Rule violation ⚙ Maintainability
Description
Modified lines use single-quoted Python string literals even though the checklist requires double
quotes, which can lead to inconsistent style and unnecessary formatting churn. This may cause style
drift across the codebase and automated formatting noise in future changes.
Code

tests/unittest/test_extend_patch.py[196]

+                '--- \n+++ \n@@ -1 +1 @@\n-\n+content\n')
Relevance

●●● Strong

Repo often enforces double-quote Ruff style in touched tests/strings; similar fixes were accepted
recently.

PR-#2569
PR-#2526

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2694657 requires double quotes for Python string literals, but the cited modified
code does not follow that rule: the changed assertion in tests/unittest/test_extend_patch.py
compares against a single-quoted string literal, and the changed line in
tests/unittest/test_aws_secrets_manager_provider.py uses single quotes for the test-secret and
test-value strings. Because these lines were touched in the PR (including whitespace/newline
adjustments), they must be updated to double quotes to meet the stated compliance requirement.

Rule 2694657: Use double quotes for all Python string literals
tests/unittest/test_extend_patch.py[195-196]
tests/unittest/test_aws_secrets_manager_provider.py[89-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Modified Python lines use single-quoted string literals, but the project checklist (PR Compliance ID 2694657) requires double quotes for Python string literals.

## Issue Context
These lines were included in touched hunks (including whitespace/newline adjustments) and should be updated to match the codebase convention to avoid style drift and formatting noise.

## Fix Focus Areas
- tests/unittest/test_extend_patch.py[195-196]
- tests/unittest/test_aws_secrets_manager_provider.py[90-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


View medium (1)
5. Unsafe YAML pre-commit parse 🐞 Bug ⛨ Security
Description
The pre-commit check-yaml hook is configured with args: [--unsafe], opting into an unsafe YAML
parsing mode during hook runs. This increases risk when running hooks on YAML content that may not
be fully trusted (e.g., when checking out external contributions).
Code

.pre-commit-config.yaml[R16-17]

      - id: check-yaml
+        args: [--unsafe]
Relevance

●● Moderate

Security concern plausible, but no close repo precedent on pre-commit check-yaml --unsafe removal vs
need for it.

PR-#2501

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR explicitly adds args: [--unsafe] under the check-yaml hook, which is the configuration
change that enables the unsafe behavior.

.pre-commit-config.yaml[10-25]
.github/workflows/pre-commit.yml[1-17]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.pre-commit-config.yaml` enables `check-yaml` with `--unsafe`, which opts into an explicitly unsafe parsing/validation mode.

Even though this is “only” a dev/CI hook, it is still executable code that processes repository content; enabling unsafe parsing broadens the attack surface when hooks are run on less-trusted branches or contributions.

## Issue Context
If there are YAML files in this repo that require non-standard tags/constructs, they should be handled in a narrowly-scoped way rather than enabling unsafe parsing globally.

## Fix Focus Areas
- .pre-commit-config.yaml[10-25]

## Suggested fix
- Remove `args: [--unsafe]` from the `check-yaml` hook.
- If unsafe parsing is truly required for a small subset of YAML files, restrict the hook with `files:` (and/or `exclude:`) to only those known-safe paths, and add a short comment explaining why unsafe mode is necessary.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


  • Author self-review: I have reviewed the code review findings, and addressed the relevant ones.

Grey Divider

Context sources
✅ Compliance rules (platform): 34 rules
Review mode: 🧠 Deep: This push contains substantial, non-mechanical logic changes across AI handlers, provider integrations, tooling, utilities, and configuration, creating many independent paths where a redundant review is materially useful.

Grey Divider

Tip of the day
💡 Did you know, you can group findings by type and pick your Finding display, from Minimal to Full

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Previous reviews

Review updated until commit 5eaff83

Results up to commit 26f355d ⚖️ Balanced


🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 📜 Skill insights (0)


Action required
1. Incorrect diff header expected ✓ Resolved 🐞 Bug ≡ Correctness
Description
TestLoadLargeDiff.test_no_newline now expects diff headers ---/+++ without the trailing space,
but load_large_diff() uses difflib.unified_diff() (with default empty from/to filenames) which
emits --- \n and +++ \n. This PR change will cause that unit test to fail against the current
implementation.
Code

tests/unittest/test_extend_patch.py[R181-182]

+---
++++
Relevance

●●● Strong

Deterministic failing-test mismatch with difflib unified_diff header spacing; typically fixed
immediately.

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The test’s expected string no longer includes the trailing space in the --- / +++ lines, while
load_large_diff() still uses difflib.unified_diff() defaults that produce --- \n and +++ \n
(note the space). Another test in the same file still expects the spaced form, reinforcing that the
implementation hasn’t changed to the new header format.

tests/unittest/test_extend_patch.py[168-196]
pr_agent/algo/utils.py[685-701]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`tests/unittest/test_extend_patch.py::TestLoadLargeDiff.test_no_newline` expects unified-diff header lines that do not match what `pr_agent.algo.utils.load_large_diff()` currently returns.

`load_large_diff()` calls `difflib.unified_diff()` without passing `fromfile`/`tofile`, so the generated header lines include a trailing space before the newline (`"--- \n"`, `"+++ \n"`). The updated test expects `"---\n"` and `"+++\n"`, causing a deterministic test failure.

## Issue Context
There is already an assertion in `test_empty_inputs` that expects `'--- \n+++ \n...'`, which matches the current `difflib.unified_diff` output format.

## Fix Focus Areas
- tests/unittest/test_extend_patch.py[168-196]
- pr_agent/algo/utils.py[685-701]

## Suggested fix
Update `patch_expected` in `test_no_newline` to match the existing behavior (`--- ` and `+++ ` with trailing spaces), or (if you intentionally want to normalize headers) change `load_large_diff()` to generate the new header format and update *all* related tests consistently.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended
2. load_large_diff uses single quotes 📘 Rule violation ⚙ Maintainability
Description
Modified lines use single-quoted Python string literals even though the checklist requires double
quotes, which can lead to inconsistent style and unnecessary formatting churn. This may cause style
drift across the codebase and automated formatting noise in future changes.
Code

tests/unittest/test_extend_patch.py[196]

+                '--- \n+++ \n@@ -1 +1 @@\n-\n+content\n')
Relevance

●●● Strong

Repo often enforces double-quote Ruff style in touched tests/strings; similar fixes were accepted
recently.

PR-#2569
PR-#2526

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
PR Compliance ID 2694657 requires double quotes for Python string literals, but the cited modified
code does not follow that rule: the changed assertion in tests/unittest/test_extend_patch.py
compares against a single-quoted string literal, and the changed line in
tests/unittest/test_aws_secrets_manager_provider.py uses single quotes for the test-secret and
test-value strings. Because these lines were touched in the PR (including whitespace/newline
adjustments), they must be updated to double quotes to meet the stated compliance requirement.

Rule 2694657: Use double quotes for all Python string literals
tests/unittest/test_extend_patch.py[195-196]
tests/unittest/test_aws_secrets_manager_provider.py[89-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Modified Python lines use single-quoted string literals, but the project checklist (PR Compliance ID 2694657) requires double quotes for Python string literals.

## Issue Context
These lines were included in touched hunks (including whitespace/newline adjustments) and should be updated to match the codebase convention to avoid style drift and formatting noise.

## Fix Focus Areas
- tests/unittest/test_extend_patch.py[195-196]
- tests/unittest/test_aws_secrets_manager_provider.py[90-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Unsafe YAML pre-commit parse 🐞 Bug ⛨ Security
Description
The pre-commit check-yaml hook is configured with args: [--unsafe], opting into an unsafe YAML
parsing mode during hook runs. This increases risk when running hooks on YAML content that may not
be fully trusted (e.g., when checking out external contributions).
Code

.pre-commit-config.yaml[R16-17]

      - id: check-yaml
+        args: [--unsafe]
Relevance

●● Moderate

Security concern plausible, but no close repo precedent on pre-commit check-yaml --unsafe removal vs
need for it.

PR-#2501

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The PR explicitly adds args: [--unsafe] under the check-yaml hook, which is the configuration
change that enables the unsafe behavior.

.pre-commit-config.yaml[10-25]
.github/workflows/pre-commit.yml[1-17]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`.pre-commit-config.yaml` enables `check-yaml` with `--unsafe`, which opts into an explicitly unsafe parsing/validation mode.

Even though this is “only” a dev/CI hook, it is still executable code that processes repository content; enabling unsafe parsing broadens the attack surface when hooks are run on less-trusted branches or contributions.

## Issue Context
If there are YAML files in this repo that require non-standard tags/constructs, they should be handled in a narrowly-scoped way rather than enabling unsafe parsing globally.

## Fix Focus Areas
- .pre-commit-config.yaml[10-25]

## Suggested fix
- Remove `args: [--unsafe]` from the `check-yaml` hook.
- If unsafe parsing is truly required for a small subset of YAML files, restrict the hook with `files:` (and/or `exclude:`) to only those known-safe paths, and add a short comment explaining why unsafe mode is necessary.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Results up to commit da680e6 ⚖️ Balanced


🐞 Bugs (0) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 📜 Skill insights (0)


Remediation recommended
1. store_secret arguments use single quotes 📘 Rule violation ⚙ Maintainability
Description
The modified test line retains single-quoted string literals for test-secret and test-value,
contrary to the required Python quote style. This creates avoidable style inconsistency in a line
changed by the PR.
Code

tests/unittest/test_aws_secrets_manager_provider.py[90]

+            provider.store_secret('test-secret', 'test-value')
Relevance

●●● Strong

Team has accepted double-quote style fixes in changed test lines multiple times, including in test
files.

PR-#2569
PR-#2526

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
Compliance rule 2694657 requires Python string literals to use double quotes. The changed line calls
provider.store_secret('test-secret', 'test-value'), and neither literal qualifies for the escaping
exception.

Rule 2694657: Use double quotes for all Python string literals
tests/unittest/test_aws_secrets_manager_provider.py[90-90]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The modified `store_secret` call uses single-quoted string literals, violating the required Python string style.

## Issue Context
PR Compliance ID 2694657 requires double quotes for Python string literals unless double quotes would require additional escaping; these literals need no escaping.

## Fix Focus Areas
- tests/unittest/test_aws_secrets_manager_provider.py[90-90]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment thread tests/unittest/test_extend_patch.py Resolved
@even-even even-even changed the title up pre-commit-hooks version and fixes chore: up pre-commit-hooks version and fixes Aug 15, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit a675bb4

@IsmaelMartinez

Copy link
Copy Markdown
Collaborator

Thanks, this is close. Qodo caught the trailing-whitespace hook eating the expected diff headers in test_no_newline, and your exclude: is the pragmatic fix; I confirmed it's load-bearing. It does disable the check for that whole file, so a note in the config would stop someone re-enabling it blind.

Merged onto main the suite matches main exactly: 2381 passing, plus the one pre-existing litellm-pin failure that also fails on clean main. The three conflicts are whitespace-only on your side but sit on main's newer code, so they resolve by keeping main's content. Happy to rebase it for you.

Two to settle. Qodo suggested targeted isort excludes; the broader question is that commenting it out leaves nothing sorting imports, while #2511 hands that to the ruff hook. Keep isort here, or land this after ruff? Also check-added-large-files is dropped, which looks unintended, and AGENTS.md:37 still advertises isort.

@even-even
even-even force-pushed the up_pre-commit-hooks_and_fixes branch from a675bb4 to da680e6 Compare August 26, 2026 19:34
@github-actions github-actions Bot added the chore label Aug 26, 2026
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit da680e6

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit ceab9f9

Comment thread pr_agent/algo/cli_args.py Fixed
Comment thread tests/e2e_tests/test_gitea_app.py Fixed
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 0ae2388

@even-even

Copy link
Copy Markdown
Contributor Author

Thanks, this is close. Qodo caught the trailing-whitespace hook eating the expected diff headers in test_no_newline, and your exclude: is the pragmatic fix; I confirmed it's load-bearing. It does disable the check for that whole file, so a note in the config would stop someone re-enabling it blind.

Merged onto main the suite matches main exactly: 2381 passing, plus the one pre-existing litellm-pin failure that also fails on clean main. The three conflicts are whitespace-only on your side but sit on main's newer code, so they resolve by keeping main's content. Happy to rebase it for you.

Two to settle. Qodo suggested targeted isort excludes; the broader question is that commenting it out leaves nothing sorting imports, while #2511 hands that to the ruff hook. Keep isort here, or land this after ruff? Also check-added-large-files is dropped, which looks unintended, and AGENTS.md:37 still advertises isort.

Hello, Ismael.

I uncommented isort in pre-commits and fixed the warnings.

To move isort in ruff is great idea, but if we do it in this PR the diff would be too big and there will be even more unconnected changes.

@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit 1fff27e

Comment thread tests/e2e_tests/test_bitbucket_app.py Resolved
Comment thread .pre-commit-config.yaml Resolved
Comment thread .pre-commit-config.yaml Resolved
even-even added 2 commits August 28, 2026 18:44
…_and_fixes

# Conflicts:
#	pr_agent/tools/pr_line_questions.py
@qodo-code-review

Copy link
Copy Markdown
Contributor

Code review by qodo was updated up to the latest commit f815851

#2880 replaced isort with ruff, so this branch's import reordering is
already in main; what remains is the v6.0.0 hook additions and the
whitespace they produce. Excludes uv.lock from check-added-large-files,
since #2509 added it at 686 KB and the hook rejects it otherwise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@qodo-code-review

qodo-code-review Bot commented Aug 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Review by Qodo

Grey Divider

Sorry, something went wrong

We weren't able to complete the code review on our side. Please try again manually by commenting /agentic_review on this PR.

Grey Divider

Qodo Logo

@IsmaelMartinez IsmaelMartinez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Approving and merging. Thanks for this, and for staying with it through the review rounds.

One note on what changed. #2880 landed in the meantime and swapped isort for ruff, so the import reordering here was already in main and had turned into conflicts. I brought main in and dropped that duplicated part, which leaves the hook additions and the whitespace they actually produce: 31 files instead of 79. It is a merge rather than a rebase, so your commits keep their authorship.

I also excluded uv.lock from check-added-large-files, since #2509 landed it at 686 KB today and the hook rejects it otherwise.

All four checks green.

@IsmaelMartinez
IsmaelMartinez merged commit 01b7e83 into The-PR-Agent:main Aug 29, 2026
5 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.

3 participants