Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(csv): remove dead code #5269

Closed
wants to merge 1 commit into from
Closed

refactor(csv): remove dead code #5269

wants to merge 1 commit into from

Conversation

iuioiua
Copy link
Contributor

@iuioiua iuioiua commented Jul 3, 2024

Brings @std/csv coverage to 100%.

Towards #3713

@github-actions github-actions bot added the csv label Jul 3, 2024
Copy link

codecov bot commented Jul 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.74%. Comparing base (735609e) to head (b968c2f).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5269      +/-   ##
==========================================
+ Coverage   95.70%   95.74%   +0.03%     
==========================================
  Files         459      459              
  Lines       38025    38012      -13     
  Branches     5563     5562       -1     
==========================================
+ Hits        36393    36394       +1     
+ Misses       1591     1577      -14     
  Partials       41       41              

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

Comment on lines -178 to -191
} else {
// Abrupt end of file (EOF on error).
if (!opt.lazyQuotes) {
const col = runeCount(fullLine);
quoteError = new ParseError(
startLine + 1,
lineIndex,
col,
ERR_QUOTE,
);
break parseField;
}
fieldIndexes.push(recordBuffer.length);
break parseField;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is unreachable, as line.length === 0 and line.length > 0 are both involved in logical OR expressions above. It's impossible for line.length < 0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't confirm your reasoning. This else-block seems a part of the below structure. Is line.length === 0 involved in these conditions?

if (i >= 0) {
  // ...
} else if (line.length > 0 || !reader.isEOF()) {
  // ...
} else {
  // ...
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

line variable is modified in the below part. https://github.com/denoland/deno_std/blob/b968c2fe21063030f972d71f846930cb9a98ceb8/csv/_io.ts#L119

I don't think that reasoning works if line is modified in the middle

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe #5277 might help for more clarity

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll close this until CSV simplification changes are made.

@iuioiua iuioiua marked this pull request as ready for review July 3, 2024 05:26
@iuioiua iuioiua requested a review from kt3k as a code owner July 3, 2024 05:26
@iuioiua iuioiua enabled auto-merge (squash) July 3, 2024 05:26
@iuioiua iuioiua closed this Jul 3, 2024
auto-merge was automatically disabled July 3, 2024 22:36

Pull request was closed

@iuioiua iuioiua deleted the csv-dead-code branch July 3, 2024 22:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants