KEMBAR78
Replace PathBuf with FileEntry for LineEntry by mgrachev · Pull Request #203 · dotenv-linter/dotenv-linter · GitHub
Skip to content

Conversation

@mgrachev
Copy link
Member

@mgrachev mgrachev commented May 25, 2020

✔ Checklist:

  • This PR has been added to CHANGELOG.md (at the top of the list);
  • Tests for the changes have been added (for bug fixes / features).

@codecov-commenter
Copy link

codecov-commenter commented May 25, 2020

Codecov Report

Merging #203 into master will increase coverage by 0.52%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #203      +/-   ##
==========================================
+ Coverage   96.34%   96.87%   +0.52%     
==========================================
  Files          14       14              
  Lines        1178     1377     +199     
==========================================
+ Hits         1135     1334     +199     
  Misses         43       43              
Impacted Files Coverage Δ
src/checks.rs 100.00% <100.00%> (ø)
src/checks/duplicated_key.rs 100.00% <100.00%> (ø)
src/checks/ending_blank_line.rs 86.36% <100.00%> (+2.15%) ⬆️
src/checks/extra_blank_line.rs 92.00% <100.00%> (+0.33%) ⬆️
src/checks/incorrect_delimiter.rs 97.08% <100.00%> (+0.61%) ⬆️
src/checks/key_without_value.rs 94.33% <100.00%> (+1.00%) ⬆️
src/checks/leading_character.rs 97.16% <100.00%> (+0.57%) ⬆️
src/checks/lowercase_key.rs 93.75% <100.00%> (+0.89%) ⬆️
src/checks/quote_character.rs 96.25% <100.00%> (+0.79%) ⬆️
src/checks/space_character.rs 96.70% <100.00%> (+0.70%) ⬆️
... and 3 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 3dccaf3...406f795. Read the comment docs.

Signed-off-by: Mikhail Grachev <work@mgrachev.com>
@mgrachev mgrachev changed the title Replace with PathBuf to FileEntry for LineEntry Replace PathBuf with FileEntry for LineEntry May 25, 2020
@mgrachev mgrachev requested a review from a team May 25, 2020 19:42
DDtKey
DDtKey previously approved these changes May 26, 2020
pub struct LineEntry {
pub number: usize,
pub file_path: PathBuf,
pub file: FileEntry,
Copy link
Member

@DDtKey DDtKey May 25, 2020

Choose a reason for hiding this comment

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

This is a great solution!
But what do you think about the use of reference to FileEntry?
This will allow him not to clone and refer to 1 entity.
I look towards Rc<FileEntry> or reference with lifetime, but maybe this is not the best solution.

Copy link
Member Author

Choose a reason for hiding this comment

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

It would be great, but right now I don't know how to implement it with less code.
Maybe I will do it later or you may help me with it 😉
What do you think about it?

Copy link
Member

@DDtKey DDtKey May 26, 2020

Choose a reason for hiding this comment

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

It would be great, but right now I don't know how to implement it with less code.
Maybe I will do it later or you may help me with it wink
What do you think about it?

Manually setting the lifetime really seems rather complicated in this case, Rc seems to be a faster option, but there are still a lot of changes in the code ...

I tried to implement everything on Rc and it's really big changes, but fortunately, all the tests pass, but I do not risk doing a pull request out of expediency 😱

I propose to accept your option and possibly revise it in future iterations if need.

Signed-off-by: Mikhail Grachev <work@mgrachev.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants