Skip to content

fix: resolve ruff lint errors in validation.py and test_validation.py#1

Merged
SummerOneTwo merged 1 commit intomasterfrom
copilot/fix-ci-failure-issue
Apr 24, 2026
Merged

fix: resolve ruff lint errors in validation.py and test_validation.py#1
SummerOneTwo merged 1 commit intomasterfrom
copilot/fix-ci-failure-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 23, 2026

CI was failing due to 6 ruff lint errors introduced with the new validation.py and its test file.

Changes

  • B905 — Added strict=False to three zip() calls (lines 319, 367, 395 in validation.py) where input/output list lengths may legitimately differ
  • B007 — Renamed unused loop variable i_i in the enumerate(zip(...)) pairing loop
  • W292 — Added missing trailing newline at EOF in validation.py
  • F401 — Removed unused import pytest from tests/test_validation.py

Agent-Logs-Url: https://github.com/SummerOneTwo/AutoCode/sessions/19d466ad-96c0-4698-97c3-ab82894be926

Co-authored-by: SummerOneTwo <89140025+SummerOneTwo@users.noreply.github.com>
@SummerOneTwo SummerOneTwo marked this pull request as ready for review April 23, 2026 18:03
Copilot AI review requested due to automatic review settings April 23, 2026 18:03
Copy link
Copy Markdown

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 fixes CI failures by addressing Ruff lint issues introduced in the new validation tool and its unit tests.

Changes:

  • Add explicit strict=False to zip() calls to satisfy B905.
  • Rename an unused loop index variable and remove an unused test import to satisfy B007/F401.
  • Ensure the source file ends with a trailing newline (W292).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
tests/test_validation.py Removes an unused pytest import to satisfy Ruff (F401).
src/autocode_mcp/tools/validation.py Updates zip() calls to be explicit about strict, renames an unused loop var, and fixes trailing newline.

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

actual_nums = [float(x) for x in actual_tokens]
expected_nums = [float(x) for x in expected_tokens]
return all(abs(a - e) < tolerance for a, e in zip(actual_nums, expected_nums))
return all(abs(a - e) < tolerance for a, e in zip(actual_nums, expected_nums, strict=False))
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

Here you already guard on len(actual_tokens) == len(expected_tokens), so using zip(..., strict=False) is redundant and slightly undermines the intent of being explicit about length mismatches. Consider strict=True (or rely on strict=True and drop the manual length check) to keep this float-compare path self-consistent.

Suggested change
return all(abs(a - e) < tolerance for a, e in zip(actual_nums, expected_nums, strict=False))
return all(abs(a - e) < tolerance for a, e in zip(actual_nums, expected_nums, strict=True))

Copilot uses AI. Check for mistakes.

# 配对
for i, (inp, out) in enumerate(zip(input_blocks, output_blocks)):
for _i, (inp, out) in enumerate(zip(input_blocks, output_blocks, strict=False)):
Copy link

Copilot AI Apr 23, 2026

Choose a reason for hiding this comment

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

_i is unused in this loop; since the index isn’t used, dropping enumerate(...) entirely (or using _ instead of _i) would make the intent clearer and avoid carrying an unused variable.

Suggested change
for _i, (inp, out) in enumerate(zip(input_blocks, output_blocks, strict=False)):
for inp, out in zip(input_blocks, output_blocks, strict=False):

Copilot uses AI. Check for mistakes.
@SummerOneTwo SummerOneTwo merged commit e338ad1 into master Apr 24, 2026
10 checks passed
@SummerOneTwo SummerOneTwo deleted the copilot/fix-ci-failure-issue branch April 25, 2026 19:20
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.

3 participants