Skip to content

chore(lint): exclude bidichk from test files#959

Merged
liangshuo-1 merged 1 commit into
mainfrom
fix/golangci-bidichk-exclude-tests
May 19, 2026
Merged

chore(lint): exclude bidichk from test files#959
liangshuo-1 merged 1 commit into
mainfrom
fix/golangci-bidichk-exclude-tests

Conversation

@liangshuo-1
Copy link
Copy Markdown
Collaborator

@liangshuo-1 liangshuo-1 commented May 19, 2026

Summary

  • Test files (e.g. internal/vfs/localfileio/path_test.go) need to construct strings with dangerous Unicode codepoints (RLO, ZWSP, BOM, LSEP, LRI) to verify path validation rejects them.
  • bidichk decodes -style escape literals and flags them as Trojan Source attack risks — a false positive for intentional test data.
  • Excluding bidichk for _test\.go$ keeps the production-code protection intact while unblocking lint on PRs that add such tests (e.g. fix: accept absolute paths in file flags; add dry-run chat membership warning #955).

Test plan

  • golangci-lint run ./internal/vfs/localfileio/... passes locally (0 issues)
  • CI lint job goes green

Summary by CodeRabbit

  • Chores
    • Enhanced code quality checks in the test suite to detect additional types of issues, improving code consistency and maintainability.

Review Change Stack

Test files legitimately need to construct dangerous Unicode inputs
(RLO, ZWSP, BOM, etc.) to verify validation logic rejects them.
bidichk treats decoded \u escape literals as Trojan Source risks,
which is a false positive for intentional test data.

Change-Id: I555028a992ab008da16129eb41075c333d0099b8
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 19, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7ae8b833-bf55-486b-b42d-a7d1fddbc1f8

📥 Commits

Reviewing files that changed from the base of the PR and between 2bb69d1 and dd01b0a.

📒 Files selected for processing (1)
  • .golangci.yml

📝 Walkthrough

Walkthrough

A single-line addition to .golangci.yml that enables the bidichk linter for test files alongside the existing bodyclose linter configuration.

Changes

Linter configuration update

Layer / File(s) Summary
Add bidichk linter to test files rule
.golangci.yml
The bidichk linter is added to the linters list for the _test\.go$ path rule, enabling bidirectional character checks in test files.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A linter hops in bright of day,
To catch what bidis' shadows play,
In tests where characters may hide,
They skip with code-check joyful stride! 🐰✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: excluding bidichk from test files in the linter configuration, which aligns with the core objective of the PR.
Description check ✅ Passed The description covers the motivation (test files need dangerous Unicode for validation), the problem (bidichk false positives), and the solution (exclude bidichk from tests). It includes a test plan with local verification completed.
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
  • Commit unit tests in branch fix/golangci-bidichk-exclude-tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@github-actions github-actions Bot added the size/M Single-domain feat or fix with limited business impact label May 19, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 66.96%. Comparing base (2bb69d1) to head (dd01b0a).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #959   +/-   ##
=======================================
  Coverage   66.96%   66.96%           
=======================================
  Files         568      568           
  Lines       53317    53317           
=======================================
  Hits        35703    35703           
  Misses      14649    14649           
  Partials     2965     2965           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown

🚀 PR Preview Install Guide

🧰 CLI update

npm i -g https://pkg.pr.new/larksuite/cli/@larksuite/cli@dd01b0a1fa2f882276588ab16f270f237bc65905

🧩 Skill update

npx skills add larksuite/cli#fix/golangci-bidichk-exclude-tests -y -g

@liangshuo-1 liangshuo-1 merged commit afa084e into main May 19, 2026
21 checks passed
@liangshuo-1 liangshuo-1 deleted the fix/golangci-bidichk-exclude-tests branch May 19, 2026 05:26
@liangshuo-1 liangshuo-1 mentioned this pull request May 19, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Single-domain feat or fix with limited business impact

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant