Skip to content

[CSV-304] Accessors for header/trailer comments#257

Merged
garydgregory merged 7 commits into
apache:masterfrom
pedro-w:csv-304-header-comments
Sep 12, 2022
Merged

[CSV-304] Accessors for header/trailer comments#257
garydgregory merged 7 commits into
apache:masterfrom
pedro-w:csv-304-header-comments

Conversation

@pedro-w

@pedro-w pedro-w commented Sep 6, 2022

Copy link
Copy Markdown
Contributor

Add accessors for header comments (before the header row)
and trailer comments (after the last record)
Also add javadoc and tests

See https://issues.apache.org/jira/browse/CSV-304

Add accessors for header comments (before the header row)
and trailer comments (after the last record)
Also add javadoc and tests
As requested in code review
@codecov-commenter

codecov-commenter commented Sep 6, 2022

Copy link
Copy Markdown

Codecov Report

Merging #257 (f926a30) into master (c51b595) will decrease coverage by 0.06%.
The diff coverage is 90.00%.

❗ Current head f926a30 differs from pull request most recent head ee7b3a7. Consider uploading reports for the commit ee7b3a7 to get more accurate results

@@             Coverage Diff              @@
##             master     #257      +/-   ##
============================================
- Coverage     96.99%   96.93%   -0.07%     
- Complexity      529      536       +7     
============================================
  Files            11       11              
  Lines          1166     1175       +9     
  Branches        204      206       +2     
============================================
+ Hits           1131     1139       +8     
  Misses           23       23              
- Partials         12       13       +1     
Impacted Files Coverage Δ
...rc/main/java/org/apache/commons/csv/CSVParser.java 95.09% <90.00%> (-0.37%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@kinow kinow requested a review from garydgregory September 6, 2022 19:13

@kinow kinow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

One comment, but the rest of the code looks good! Thanks @pedro-w!

Comment thread src/main/java/org/apache/commons/csv/CSVParser.java
Also reworded some documentation text to read better
@pedro-w

pedro-w commented Sep 7, 2022

Copy link
Copy Markdown
Contributor Author

I noticed that github is parsing the Javadoc annotation @since as a username. I apologize to the owner of that account.

@kinow kinow left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good to me. Asked a review from @garydgregory as he works on and knows a lot more about this component. Thanks @pedro-w !

@garydgregory garydgregory left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hi @pedro-w,
Is the intent to allow comments at the start and end of a file or before and after each record?
Please see my scattered comments as well.

Comment thread src/main/java/org/apache/commons/csv/CSVParser.java Outdated
Comment thread src/main/java/org/apache/commons/csv/CSVParser.java
Comment thread src/test/java/org/apache/commons/csv/CSVParserTest.java
Comment thread src/main/java/org/apache/commons/csv/CSVParser.java Outdated
@pedro-w

pedro-w commented Sep 8, 2022

Copy link
Copy Markdown
Contributor Author

Is the intent to allow comments at the start and end of a file or before and after each record?

The former. I'll explain my thinking, please correct me if I've got it wrong!

; Comment 0
A,B
; Comment 1
1,1
; Comment 2
2,2
; Comment 3

The comments attach to the following line so Comments 1 & 2 can currently be extracted from the corresponding CSVRecords and Comment 3 can never be accessed. Comment 0 is a special case. If we ask CSVParser to generate the column headings from the first record, it can't be accessed, but otherwise it's attached to "A,B" which is just a normal data record.

My intention was to allow access to Comment 0 via getHeaderComment (only in the case of generated column names) and Comment 3 via getTrailerComment (always).

I'll get onto the other issues too as they're mostly just formatting.

pedro-w and others added 4 commits September 8, 2022 21:54
Also, formatting and whitespace changes
as requested in code review.
@garydgregory garydgregory merged commit 2e851bc into apache:master Sep 12, 2022
asfgit pushed a commit that referenced this pull request Sep 12, 2022
@pedro-w pedro-w deleted the csv-304-header-comments branch September 12, 2022 21:39
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.

4 participants