Repository navigation
fix(rules): recognize BOM-prefixed Objective-C source - #1964
Merged
Merged
Conversation
Contributor
|
✅ OpenCodeReview: Review complete: 0 finding(s) across 1 selected item(s). |
Contributor
|
@Afloat16 merge conflict |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A UTF-8 byte-order mark at the start of an Objective-C
.mfile becomes part of the first line inspected by the language sniffer. The existing#import, comment, and other Objective-C prefixes no longer match, so the file receives MATLAB review rules. The same problem affects both working-tree reads and reviews at a pinned Git ref.Remove only an initial UTF-8 BOM before inspecting the first nonblank line. A BOM-only first line can then be skipped normally. Preserve interior U+FEFF characters, the MATLAB fallback, and the existing project/global/custom rule precedence.
Type of Change
Upstream synchronization (2026-11-22)
Merged current main
d0744d31b19d9fe97ffeff78dd8fb04e0be69312ined23484aa46d0fd78d53c4c41cefb339c6ad3101(tested tree62ce003a695ab80e2472b628f27bd70d877ddcc3). The conflict resolution retains the leading-only BOM removal and upstream'sstrings.SplitSeqiterator. Against current main, the PR still changes only the original sniffer and its regression file.Validation of this merge tree:
make test PACKAGES=./internal/config/rules: passed with the race detector; all 100 top-level rule tests, including the BOM and precedence regressions, passed.make check: passed, including repository-wide license, English-text and Go vet checks.make build: passed.ocr review --audience agent --background "..."command was attempted; it could not start because this environment has no configured LLM endpoint. A separate inspection of the complete two-file change and merge-resolution interdiff found no blocking issue.Go 1.26.10 on Linux. Temporary and cache paths were placed in the workspace because this environment has no
/tmp. The earlier coverage result below belongs to the original submission; coverage was not rerun for this synchronization.Original submission verification
The new regression exercises real repositories through the public resolver in workspace mode, pinned-ref mode, and pinned-ref mode with the shared Git runner. It covers initial BOMs before imports, indentation, comments, and CRLF blank lines, plus MATLAB, Octave, BOM-only, and interior-U+FEFF controls. The working tree is changed after the commit to verify that ref-based resolution actually reads the requested revision. Additional cases preserve project override and
merge_system_rulebehavior.The original implementation fails 14 of the 28 subcases; all pass with the fix.
make check— passed.make test PACKAGES="./internal/config/rules ./internal/agent ./internal/scan"— passed, including the race detector.make coverage— the complete unit-test suite passed, with 91.7% overall coverage (90% required).make build— passed.The inherited telemetry sampler was explicitly set to
always_onfor the test suite. The requiredocr review --audience agent --background "..."command was attempted, but could not start because no LLM endpoint is configured in the environment.Checklist
Primary contributor and contribution owner: @Afloat16.
Required tool/model disclosure: OpenAI ChatGPT (GPT-6 Astra Pro).