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

Replace line-parsing RegEx by manual code #26

Merged
merged 1 commit into from
Aug 30, 2019

Conversation

Swatinem
Copy link
Contributor

Replace line-parsing RegEx by manual code

This avoids pulling in regex and lazy_static and makes this a true
zero-dependency crate.

@codecov
Copy link

codecov bot commented Aug 27, 2019

Codecov Report

Merging #26 into master will increase coverage by 0.71%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
+ Coverage   91.09%   91.81%   +0.71%     
==========================================
  Files          18       18              
  Lines         584      623      +39     
==========================================
+ Hits          532      572      +40     
+ Misses         52       51       -1
Impacted Files Coverage Δ
dotenv/src/parse.rs 97.25% <100%> (+0.03%) ⬆️
dotenv_codegen_implementation/src/lib.rs 0% <0%> (ø) ⬆️
dotenv/src/iter.rs 96.15% <0%> (+3.84%) ⬆️

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 c41d4c9...2c25991. Read the comment docs.

Copy link
Contributor

@ZoeyR ZoeyR left a comment

Choose a reason for hiding this comment

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

Mostly looks great! I'm always happy to remove deps when possible. One thing I'd like though is if you undid the rustfmt run. As much as I'd like the code to be clean, it adds noise to the PR unrelated to the functional changes.

dotenv/src/parse.rs Outdated Show resolved Hide resolved
dotenv/src/parse.rs Outdated Show resolved Hide resolved
dotenv/src/parse.rs Outdated Show resolved Hide resolved
@Swatinem
Copy link
Contributor Author

Thanks for the quick review :-)
BTW, is there some kind of official spec for all of this? Allowing whitespace around the = would be a change to the regex that was there before. Also I think I made a mistake around export. I’m not sure if it is a reserved keyword or it can just as well be a var itself, like in export="some value"?

It will take some time for me to revise, this was just a quick experiment to see how far I come :-)

@ZoeyR
Copy link
Contributor

ZoeyR commented Aug 27, 2019

There is no official spec for this. It's based off of https://github.com/bkeepers/dotenv but there is no official spec. We currently implement only a subset of the parsing capabilities of the original ruby gem.

@Swatinem
Copy link
Contributor Author

I completely rewrote this with something resembling a "real" parser… And updated the tests to verify the new behavior (whitespace around =, treating export as key itself).

Copy link
Contributor

@ZoeyR ZoeyR left a comment

Choose a reason for hiding this comment

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

Looks good! The pipeline failures seem to be due to some flakiness with cargo-junit. I'm rerunning them now.

This avoids pulling in `regex` and `lazy_static` and makes this a true
zero-dependency crate.
@Swatinem
Copy link
Contributor Author

some flakiness with cargo-junit

No, it was a real failure… I added a comment why those two ifs you suggested to merge need to be separate…

@ZoeyR
Copy link
Contributor

ZoeyR commented Aug 30, 2019

Oh right, I see the logic issue now. I do need to fix the pipeline though to error out better though it seems.

@ZoeyR ZoeyR merged commit 6a400fe into dotenv-rs:master Aug 30, 2019
codemountains pushed a commit to codemountains/dotenvx that referenced this pull request Dec 20, 2023
Replace line-parsing RegEx by manual code
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.

2 participants