Merged
Conversation
47f87c7 to
9516a2e
Compare
Contributor
Author
Auto-repair Started
|
Contributor
Author
Auto-repair Succeeded
Auto-repair succeeded with backend Validated locally before push using |
6
approved these changes
Mar 22, 2026
Owner
6
left a comment
There was a problem hiding this comment.
Reviewed locally: the fix correctly broadens Ruby RangeNode handling while keeping regexp classes on the narrower accepted behavior, matching the added fixtures and green cop-check.
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.
Automated fix fix for
Lint/MixedCaseRangecorpus conformance.Details
Lint/MixedCaseRangeResult
Changes
Agent conversation excerpt
I’m checking the existing cop and fixtures first, then I’ll add the missing FN cases to the fixture and verify the test fails before touching detection logic.
I’m checking the existing cop and fixtures first, then I’ll add the missing FN cases to the fixture and verify the test fails before touching detection logic.
The fixture already has the four FN snippets in the worktree, so I’m treating that as existing user-side state and checking how the current cop behaves before I edit anything. I’m also verifying RuboCop on the relevant range shapes so the fix matches ground truth, not just the corpus examples.
The fixture already has the four FN snippets in the worktree, so I’m treating that as existing user-side state and checking how the current cop behaves before I edit anything. I’m also verifying RuboCop on the relevant range shapes so the fix matches ground truth, not just the corpus examples.
I’ve confirmed the new cases are in the fixture and I’m waiting on two things in parallel: RuboCop’s verdict on each missed pattern, and the targeted Rust test to see whether failure is from detection or just bad annotations.
I’ve confirmed the new cases are in the fixture and I’m waiting on two things in parallel: RuboCop’s verdict on each missed pattern, and the targeted Rust test to see whether failure is from detection or just bad annotations.
RuboCop is consistent with the corpus: it flags all four missing range shapes, including non-letter-to-letter bounds like
'0'..'z'and'['..'z'. The current test run is still finishing, but the detection gap already looks clear: our range logic only treats opposite-case letters as unsafe and misses “symbol/digit to letter” bounds that RuboCop treats as unsafe too.RuboCop is consistent with the corpus: it flags all four missing range shapes, including non-letter-to-letter bounds like
'0'..'z'and'['..'z'. The current test run is still finishing, but the detection gap already looks clear: our range logic only treats opposite-case letters as unsafe and misses “symbol/digit to letter” bounds that RuboCop treats as unsafe too.I have enough context to make the fix narrowly.
Plan:
offense.rbannotations so the fixture reflects RuboCop’s actual offense spans, then rerun the targeted test to lock in a failing baseline.src/cop/lint/mixed_case_range.rsso range objects follow RuboCop’srange_for(start) != range_for(end)behavior, not just “upper vs lower letter” comparisons.///note on the cop struct, reruncargo test --lib -- cop::lint::mixed_case_range, then commit only the cop file and its fixture.I have enough context to make the fix narrowly.
Plan:
offense.rbannotations so the fixture reflects RuboCop’s actual offense spans, then rerun the targeted test to lock in a failing baseline.src/cop/lint/mixed_case_range.rsso range objects follow RuboCop’srange_for(start) != range_for(end)behavior, not just “upper vs lower letter” comparisons.///note on the cop struct, reruncargo test --lib -- cop::lint::mixed_case_range, then commit only the cop file and its fixture.The baseline failure is clean: expected 10 offenses, actual 6. That confirms a real detection bug rather than config noise. I’m reading the fixture parser next so I can correct the new marker spans precisely once the cop reports the missing ranges.
The baseline failure is clean: expected 10 offenses, actual 6. That confirms a real detection bug rather than config noise. I’m reading the fixture parser next so I can correct the new marker spans precisely once the cop reports the missing ranges.
I’m measuring the exact start columns on the real fixture lines now, then I’ll patch the fixture and the cop together so the next test run is meaningful instead of bouncing on annotation mismatches.
I’m measuring the exact start columns on the real fixture lines now, then I’ll patch the fixture and the cop together so the next test run is meaningful instead of bouncing on annotation mismatches.
I’m editing the cop now. The code change is minimal: make “unsafe” mean the two single-character bounds belong to different ASCII letter buckets, including
Nonefor digits/symbols, which is what RuboCop does. I’m also fixing the marker columns inoffense.rbso the fixture matches the real spans.I’m editing the cop now. The code change is minimal: make “unsafe” mean the two single-character bounds belong to different ASCII letter buckets, including
Nonefor digits/symbols, which is what RuboCop does. I’m also fixing the marker columns inoffense.rbso the fixture matches the real spans.The patch is in. I’m rerunning the targeted cop test now; if it still fails, it should be down to exact marker columns or an edge case in the updated range comparison, not the original FN.
The patch is in. I’m rerunning the targeted cop test now; if it still fails, it should be down to exact marker columns or an edge case in the updated range comparison, not the original FN.
The targeted test is in the verification phase now. If it comes back green, I’ll inspect the exact diff and make the requested single-cop commit; if not, I’ll use the failure to correct only the remaining marker alignment.
The targeted test is in the verification phase now. If it comes back green, I’ll inspect the exact diff and make the requested single-cop commit; if not, I’ll use the failure to correct only the remaining marker alignment.
Task prompt (6732 tokens)
Fix Lint/MixedCaseRange — 0 FP, 4 FN
Instructions
You are fixing ONE cop in nitrocop, a Rust Ruby linter that uses Prism for parsing.
Current state: 68 matches, 0 false positives, 4 false negatives.
Focus on: FN (RuboCop flags code nitrocop misses).
Workflow
behavior on BOTH the specific FP case AND the general pattern:
tests/fixtures/cops/lint/mixed_case_range/offense.rbwith^annotationtests/fixtures/cops/lint/mixed_case_range/no_offense.rbcargo test --lib -- cop::lint::mixed_case_rangesrc/cop/lint/mixed_case_range.rscargo test --lib -- cop::lint::mixed_case_range///doc comment on the cop struct documenting what you found and fixedFixture Format
Mark offenses with
^markers on the line AFTER the offending source line:The
^characters must align with the offending columns. The message format isLint/MixedCaseRange: <message text>.If your test passes immediately
If you add a test case and it passes without code changes, the corpus mismatch is
caused by config/context differences, not a detection bug.
Do NOT loop trying to make the test fail. Instead:
src/config/or the cop's config handling, not detection logica
///comment on the cop struct and commitCRITICAL: Avoid regressions in the opposite direction
When fixing FPs, your change MUST NOT suppress legitimate detections. When fixing FNs,
your change MUST NOT flag code that RuboCop accepts. A fix that eliminates a few issues
in one direction but introduces hundreds in the other is a catastrophic regression.
Before exempting a category of patterns, verify with RuboCop that the general case
is still an offense:
If RuboCop flags the general pattern but not your specific case, the difference is in
a narrow context (e.g., enclosing structure, receiver type, argument count) — your fix
must target that specific context, not the broad category.
Rule of thumb: if your fix adds an early
returnorcontinuethat skips a wholenode type, operator class, or naming pattern, it's probably too broad. Prefer adding a
condition that matches the SPECIFIC differentiating context.
Rules
src/cop/lint/mixed_case_range.rsandtests/fixtures/cops/lint/mixed_case_range/cargo test --lib -- cop::lint::mixed_case_rangeto verify your fix (do NOT run the full test suite)git stashPre-diagnostic Results
Diagnosis Summary
Each example was tested by running nitrocop on the extracted source in isolation
with
--force-default-configto determine if the issue is a code bug or config issue.Note: source context is truncated and may not parse perfectly. If a diagnosis
seems wrong (e.g., your test passes immediately for a 'CODE BUG'), treat it as
a config/context issue instead.
FN #1:
ffleming__timing_attack__a7f4e5e: lib/timing_attack/brute_forcer.rb:13NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Message:
Ranges from upper to lower case ASCII letters may include unintended characters. Instead ofA-z(which also includes several symbols) specify each range individually:A-Za-zand individually specify any symbols.Ready-made test snippet (add to offense.rb, adjust
^count):Full source context:
FN #2:
gdelugre__origami__ac1df80: lib/origami/obfuscation.rb:29NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Enclosing structure: module body (line:
module Obfuscator)The offense is inside this structure — the cop may need
to handle this context to detect the pattern.
Message:
Ranges from upper to lower case ASCII letters may include unintended characters. Instead ofA-z(which also includes several symbols) specify each range individually:A-Za-zand individually specify any symbols.Ready-made test snippet (add to offense.rb, adjust
^count):Full source context:
FN #3:
mjackson__citrus__e68d892: test/grammars/email_test.rb:109NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Enclosing structure: method body (line:
def test_dtext)The offense is inside this structure — the cop may need
to handle this context to detect the pattern.
Message:
Ranges from upper to lower case ASCII letters may include unintended characters. Instead ofA-z(which also includes several symbols) specify each range individually:A-Za-zand individually specify any symbols.Ready-made test snippet (add to offense.rb, adjust
^count):Full source context:
FN #4:
neo4jrb__neo4j-core__4b649fc: Rakefile:35NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Message:
Ranges from upper to lower case ASCII letters may include unintended characters. Instead ofA-z(which also includes several symbols) specify each range individually:A-Za-zand individually specify any symbols.Ready-made test snippet (add to offense.rb, adjust
^count):Full source context:
Current Rust Implementation
src/cop/lint/mixed_case_range.rsRuboCop Ruby Implementation (ground truth)
vendor/rubocop/lib/rubocop/cop/lint/mixed_case_range.rbRuboCop Test Excerpts
vendor/rubocop/spec/rubocop/cop/lint/mixed_case_range_spec.rbCurrent Fixture: offense.rb
tests/fixtures/cops/lint/mixed_case_range/offense.rbCurrent Fixture: no_offense.rb
tests/fixtures/cops/lint/mixed_case_range/no_offense.rb