nushell / nufmt

MIT License
64 stars 8 forks source link

:white_check_mark: restore testing, add CI workflow and `README.md` #16

Closed AucaCoyan closed 1 year ago

AucaCoyan commented 1 year ago

Hi! I pushed a bit more the repo and I think it's ready to move to the nushell org. Maybe nushell/nufmt?

Some comments:

fdncred commented 1 year ago

maybe we should leave the examples? i put them there are test cases. We'll also want to have benchmarks eventually. I mean we can delete it now but we'll need to bring it back at some point.

AucaCoyan commented 1 year ago

Mmm I'm not sure. What do you think if we do examples in markdown documentation?

For bench marking, initially I was thinking on doing multi threading, but after looking on other big projects I realized they don't go that deep. I assume it's because it's a fast process in general. On top of that, performance in rust is rarely an issue.

If we start waiting more that 2 seconds to format a file, then yes, we should lookout for performance. But initially it's not among my concerns. I've never written performant software, or ever have to worry about memory management even, so bear in mind I'm not an expert

fdncred commented 1 year ago

i'm fine with having markdown docs but what i'm saying was that in order to test whether the software is formatting things properly, i had examples to test on.

as far as performance, it all depends on the size of the file. i have a > 4000 line script that takes a while to parse. so if parsing takes a while, reformatting could take longer.

i'm also fine with having lots of smaller tests to test in small bits.

AucaCoyan commented 1 year ago

Sounds good to me. I copied the example.nu which has 2400 lines and also ajust the bench for the current format_single_file function

How about now? should I add more changes? 🙌🏼

fdncred commented 1 year ago

We can change it later when we get around to it, but example.nu is not a valid script. It's just a dump of all the examples from nushell. So, the syntax isn't correct in it. Although, I think it's a good test to see what nufmt does with an invalid script.

amtoine commented 1 year ago

@AucaCoyan i do not see tests in there, am i missing something? :open_mouth:

AucaCoyan commented 1 year ago

Mayhaps. The tests are below lib.rs and main.rs, to test both you can clone the project and run cargo test --workspace. The workflows are in main.yml

amtoine commented 1 year ago

Mayhaps. The tests are below lib.rs and main.rs, to test both you can clone the project and run cargo test --workspace.

ohh wow i just did not see them, my bad :laughing:

The workflows are in main.yml

:ok_hand: