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
Use Rc for Warning to reduce memory consumption #410
Comments
I want to do this one but is my first time trying to contribute to a project and I'm a bit lost. failures:
---- fixes::fixtures stdout ----
thread 'fixes::fixtures' panicked at 'assertion failed: `(left == right)`
left: `"\n# dotenv-linter:off UnorderedKey\n_ENV=000\nA=B\nA_ENV_11=B\nA_ENV_12=C\nA_ENV_13=D\nA_ENV_14=123\nA_ENV_15=345\nAB_ENV_16=777\nAB_ENV_17=alpha\nAB_ENV_18=beta\nAB_ENV_19=alpha12\nAB_ENV_20=beta13\nB=C\nC=D\nD=123\n# dotenv-linter:off SpaceCharacter\nE=345\nENV11=C\n# A_ENV_12=C\nSOME_ENV_WITHOUT_EQ=\nANOTHER_ENV=\nENV12_=D\n# dotenv-linter:on UnorderedKey\n\n# comment\n\n# Another\n# multiline\n# comment\n# ANOTHER_ENV=\n# A_ENV_12=C\nENV10=B\n# ENV11=C\n# ENV12_=D\n# single line comment\nENV13=123\nENV14=345\n# Multiline\n# comment\nSOME_ENV=\nVAR_1 = 1234\nVAR_2=1234\nVAR_3=1234\nVAR_4=1234\n# dotenv-linter:on SpaceCharacter\n# AB_ENV_19=alpha14\n#
AB_ENV_19=alpha12\nENV15=777\nENV16=alpha\nENV18=alpha12\nENV19=beta13\nENV21=2\nENV22=3\nENV_17=beta\nF=777\nG=alpha\nH=beta\nI=alpha12\nJ=beta13\nKEY=VALUE\n# dotenv-linter:off QuoteCharacter\nENV24=\'key56\'\nVAR_1=1234\n# VAR_2=1234\n# VAR_3=1234\n# VAR_4=1234\nVAR_5=1234\nVAR_6=1234\nVAR_7=1234\n"`,
right: `"\r\n# dotenv-linter:off UnorderedKey\r\n_ENV=000\r\nA=B\r\nA_ENV_11=B\r\nA_ENV_12=C\r\nA_ENV_13=D\r\nA_ENV_14=123\r\nA_ENV_15=345\r\nAB_ENV_16=777\r\nAB_ENV_17=alpha\r\nAB_ENV_18=beta\r\nAB_ENV_19=alpha12\r\nAB_ENV_20=beta13\r\nB=C\r\nC=D\r\nD=123\r\n# dotenv-linter:off SpaceCharacter\r\nE=345\r\nENV11=C\r\n# A_ENV_12=C\r\nSOME_ENV_WITHOUT_EQ=\r\nANOTHER_ENV=\r\nENV12_=D\r\n# dotenv-linter:on UnorderedKey\r\n\r\n# comment\r\n\r\n# Another\r\n# multiline\r\n# comment\r\n# ANOTHER_ENV=\r\n# A_ENV_12=C\r\nENV10=B\r\n# ENV11=C\r\n# ENV12_=D\r\n# single line comment\r\nENV13=123\r\nENV14=345\r\n# Multiline\r\n# comment\r\nSOME_ENV=\r\nVAR_1 = 1234\r\nVAR_2=1234\r\nVAR_3=1234\r\nVAR_4=1234\r\n# dotenv-linter:on SpaceCharacter\r\n# AB_ENV_19=alpha14\r\n# AB_ENV_19=alpha12\r\nENV15=777\r\nENV16=alpha\r\nENV18=alpha12\r\nENV19=beta13\r\nENV21=2\r\nENV22=3\r\nENV_17=beta\r\nF=777\r\nG=alpha\r\nH=beta\r\nI=alpha12\r\nJ=beta13\r\nKEY=VALUE\r\n# dotenv-linter:off QuoteCharacter\r\nENV24=\'key56\'\r\nVAR_1=1234\r\n# VAR_2=1234\r\n# VAR_3=1234\r\n# VAR_4=1234\r\nVAR_5=1234\r\nVAR_6=1234\r\nVAR_7=1234\r\n"`', tests\fixes\mod.rs:115:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
fixes::fixtures
test result: FAILED. 75 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out |
As I can see, the whole difference is in line breaks ( |
Sure
|
@PatatasDelPapa I can't reproduce this behavior (and for Windows - CI passed successfully ) 🙁 The right part of the assertion is just the content of the file from the repo (without any changes), but with additional carriage return ( |
Yes and just to be sure I cloned the repo again then run Exactly what I done was
Got pretty much the same as last time
|
I was able to reproduce this error on Windows and I found one way that the problem could be resolved. When I cloned the repo and ran I then set It appears that you can also configure the end-of-line normalization for a specific path using the |
I created a PR that adds a |
@stevetaggart good catch! Thank you 🙂 |
Hey, does this also involve changing the function in the |
@PatatasDelPapa my PR was merged, so you should be able to have tests pass on Windows now with a fresh clone of the repo. 😃 |
@stevetaggart Yes! all test pass with a fresh clone sadly I'm now occupied but will try to help again on another issue when I have time |
Hi, isn't it better to store borrowed reference to |
Feel free to do a PR 🙂 Just note that |
Getting back a bit late, but I was trying out few ideas. @DDtKey you're right that I think resolving #419 might be a better idea before I open a PR for this issue, to avoid unnecessarily repeating test changes. Should we reopen #419? If I get some time this week, I'll try to resolve that first. Also, I noticed that warning and check/fixer are compared using their |
@atsmtat Could you give an example of how would you implement this feature? 🤔 |
It could be done by defining an enum -- something like: enum Lint {
DuplicatedKey,
EndingBlankLine,
ExtraBlankLine,
// ...
} And using it in place of |
I like this idea. Could you implement it in another PR? |
I opened a new issue #426 to track it. I'm currently busy to implement it, but it'll be good first issue for someone new I think. I'm still waiting for #422 to merge, which will create conflict with the enum conversion. |
Description
The
Warning
struct has the LineEntry field which clones in every checks, e.g.: DuplicatedKeyChecker.Use the Rc type for
Warning
to reduce memory consumption.Similar issue: #388
The text was updated successfully, but these errors were encountered: