[bot] Fix Layout/LineEndStringConcatenationIndentation#869
Closed
[bot] Fix Layout/LineEndStringConcatenationIndentation#869
Conversation
Contributor
Author
|
Agent failed. See run: https://github.com/6/nitrocop/actions/runs/23729223545 |
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.
Task prompt (6273 tokens)
Fix Layout/LineEndStringConcatenationIndentation — 1 FP, 193 FN
Instructions
You are fixing ONE cop in nitrocop, a Rust Ruby linter that uses Prism for parsing.
Current state: 5,821 matches, 1 false positives, 193 false negatives.
Focus on: FN (RuboCop flags code nitrocop misses).
⚠ 5,821 existing matches must not regress. Validate with
check_cop.pybefore committing.Workflow
behavior on BOTH the specific FP case AND the general pattern:
tests/fixtures/cops/layout/line_end_string_concatenation_indentation/offense.rbwith^annotationtests/fixtures/cops/layout/line_end_string_concatenation_indentation/no_offense.rbcargo test --lib -- cop::layout::line_end_string_concatenation_indentationsrc/cop/layout/line_end_string_concatenation_indentation.rscargo test --lib -- cop::layout::line_end_string_concatenation_indentation///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 isLayout/LineEndStringConcatenationIndentation: <message text>.See the Current Fixture sections below for real examples from this cop.
Mixed issues: some code bugs, some config issues
Pre-diagnostic shows SOME patterns are correctly detected in isolation (config issues)
and SOME are genuinely missed (code bugs). See the per-example diagnosis below.
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/layout/line_end_string_concatenation_indentation.rsandtests/fixtures/cops/layout/line_end_string_concatenation_indentation/cargo test --lib -- cop::layout::line_end_string_concatenation_indentationto verify your fix (do NOT run the full test suite)python3 scripts/check_cop.py Layout/LineEndStringConcatenationIndentation --rerun --clone --sample 15before committing to catch regressionsgit stashCurrent Fixture: offense.rb
tests/fixtures/cops/layout/line_end_string_concatenation_indentation/offense.rbCurrent Fixture: no_offense.rb
tests/fixtures/cops/layout/line_end_string_concatenation_indentation/no_offense.rbKey Source Files
src/cop/layout/line_end_string_concatenation_indentation.rsvendor/rubocop/lib/rubocop/cop/layout/line_end_string_concatenation_indentation.rbvendor/rubocop/spec/rubocop/cop/layout/line_end_string_concatenation_indentation_spec.rbRead these files before making changes.
Start Here
Use the existing corpus data to focus on the most concentrated regressions first.
Helpful local commands:
python3 scripts/investigate_cop.py Layout/LineEndStringConcatenationIndentation --repos-onlypython3 scripts/investigate_cop.py Layout/LineEndStringConcatenationIndentation --contextpython3 scripts/verify_cop_locations.py Layout/LineEndStringConcatenationIndentationTop FP repos:
skyborn-industries__ffxiv-collect__b25e5ac(1 FP) — exampleapp/helpers/collections_helper.rb:529Top FN repos:
felixbuenemann__xlsxtream__62e4836(182 FN) — exampletest/xlsxtream/workbook_test.rb:54ruby-ldap__ruby-net-ldap__de197ea(10 FN)amahi__platform__38a1d1f(1 FN) — exampleapp/models/server.rb:117Representative FP examples:
skyborn-industries__ffxiv-collect__b25e5ac: app/helpers/collections_helper.rb:529— Align parts of a string concatenated with backslash.Representative FN examples:
amahi__platform__38a1d1f: app/models/server.rb:117— Indent the first part of a string concatenated with backslash.felixbuenemann__xlsxtream__62e4836: test/xlsxtream/workbook_test.rb:54— Align parts of a string concatenated with backslash.felixbuenemann__xlsxtream__62e4836: test/xlsxtream/workbook_test.rb:55— Align parts of a string concatenated with backslash.Pre-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:
amahi__platform__38a1d1f: app/models/server.rb:117NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Full-file enclosing chain: method body (line 115:
def cmd_file) > enclosing line 84:protectedMessage:
Indent the first part of a string concatenated with backslash.Ready-made test snippet (add to offense.rb, adjust
^count):Full file context (30 lines before offense):
FN #2:
felixbuenemann__xlsxtream__62e4836: test/xlsxtream/workbook_test.rb:55NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Full-file enclosing chain: enclosing line 53:
'xl/workbook.xml' =>> block ({..}) (line 52:expected = {) > method body (line 49:def test_empty_workbook) > class body (line 8:class WorksheetTest < Minitest::Test) > module body (line 7:module Xlsxtream)Message:
Align parts of a string concatenated with backslash.Ready-made test snippet (add to offense.rb, adjust
^count):Full file context (30 lines before offense):
FN #3:
felixbuenemann__xlsxtream__62e4836: test/xlsxtream/workbook_test.rb:59NOT DETECTED — CODE BUG
The cop fails to detect this pattern. Fix the detection logic.
Full-file enclosing chain: enclosing line 53:
'xl/workbook.xml' =>> block ({..}) (line 52:expected = {) > method body (line 49:def test_empty_workbook) > class body (line 8:class WorksheetTest < Minitest::Test) > module body (line 7:module Xlsxtream)Message:
Align parts of a string concatenated with backslash.Ready-made test snippet (add to offense.rb, adjust
^count):Full file context (30 lines before offense):
FP #1:
skyborn-industries__ffxiv-collect__b25e5ac: app/helpers/collections_helper.rb:529NOT REPRODUCED — CONFIG/CONTEXT issue
nitrocop does not flag this in isolation or in the full file
(with default config). The FP is caused by the target repo's
config (e.g., different Max value, Include/Exclude patterns).
Source context:
Message:
Align parts of a string concatenated with backslash.Full file context (30 lines before offense):