Skip to content

Always open a unit space for the root of the tree - #1263

Merged
marco-c merged 2 commits into
masterfrom
error-root-unit
Nov 21, 2026
Merged

marco-c merged 2 commits into
masterfrom
error-root-unit

Conversation

@marco-c

@marco-c marco-c commented Nov 21, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #1260.

When error recovery makes the root of the tree an ERROR node, the root now opens a unit space, instead of the first function space below it becoming the root and absorbing all the others.

This changes the DeepSpeech snapshots of kenlm/lm/model.hh and of the two pywrapfst.cc files, whose roots were a namespace spanning a single line and a struct spanning 5 lines: mozilla/rust-code-analysis-output#7, which has to land first (the submodule currently points to its branch).

@codecov-commenter

codecov-commenter commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.43%. Comparing base (d04dc9d) to head (91d1d38).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1263      +/-   ##
==========================================
- Coverage   90.43%   90.43%   -0.01%     
==========================================
  Files          62       62              
  Lines       16438    16458      +20     
==========================================
+ Hits        14866    14884      +18     
- Misses       1572     1574       +2     

☔ View full report in Codecov by Harness.
📢 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.

marco-c added a commit to mozilla/rust-code-analysis-output that referenced this pull request Nov 21, 2026
@marco-c
marco-c marked this pull request as ready for review November 21, 2026 17:13
When error recovery makes the root of the tree an ERROR node, no space
was opened for it, so the first space found below it became the root
and absorbed all the following ones: the metrics of the whole file were
reported as the ones of its first function, spanning only that function's
lines (e.g. sloc 1 and negative blank lines).

The root now always opens a unit space, unless it's already a space.

Fixes #1260.
The roots of DeepSpeech's kenlm/lm/model.hh and of the two pywrapfst.cc
files are now units spanning the whole file
(mozilla/rust-code-analysis-output#7).
@marco-c
marco-c merged commit 52ed04e into master Nov 21, 2026
2 checks passed
@marco-c
marco-c deleted the error-root-unit branch November 21, 2026 17:50
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.

Metrics of a file are attributed to its first function space when the root of the tree is an ERROR node

2 participants