-
-
Notifications
You must be signed in to change notification settings - Fork 7
chore(lib): fully refactor the library for v3 #117
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
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
* fix!: adjustments after refactor * Update README.md Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * docs(changelog): remove mention of support for markdown and typst files for now * refactor: use `check::Request`, `check::Response` and `check::ResponseWithContext` * chore: formatting * fix: minimum Rust version needs to be higher for `clap` * fix: doc test * refactor: use crate's result type for the `check` method on `Client` * refactor: use crate's result type for the `languages` method on `Client` * Update src/api/mod.rs Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * Update src/api/mod.rs Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * fix: convert `reqwest` error --------- Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
This comment was marked as outdated.
This comment was marked as outdated.
* fix!: adjustments after refactor * Update README.md Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * docs(changelog): remove mention of support for markdown and typst files for now * refactor: use `check::Request`, `check::Response` and `check::ResponseWithContext` * chore: formatting * fix: minimum Rust version needs to be higher for `clap` * fix: doc test * refactor: use crate's result type for the `check` method on `Client` * refactor: use crate's result type for the `languages` method on `Client` * Update src/api/mod.rs Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * Update src/api/mod.rs Co-authored-by: Jérome Eertmans <jeertmans@icloud.com> * fix: convert `reqwest` error --------- Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
CodSpeed Performance ReportMerging #117 will degrade performances by 50.78%Comparing Summary
Benchmarks breakdown
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #117 +/- ##
===========================================
+ Coverage 15.30% 31.55% +16.25%
===========================================
Files 15 19 +4
Lines 732 824 +92
===========================================
+ Hits 112 260 +148
+ Misses 620 564 -56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hi @Rolv-Apneseth! So I just did some efforts to clean the CI, and also slightly updated the main comment of this PR. What would you like to work on? I don't have much time to actually implement things, as I have other work to do for my thesis ^^', but I am happy to perform reviews :-) |
Hi! I don't mind, what do you think is a reasonable next step here? Also best of luck with your thesis |
Thanks! Can you just check the to-do list above, and see what you can do? |
Sure, so maybe for the first one I can just move all API code to a Also would you mind explaining the reasoning behind the |
Sure, looks good!
Of course :-)
Did I answer your question? |
Not quite sorry. I understand being able to disable it, but what is the benefit of enabling it? Why not just have the CLI stuff separated entirely from the library side, and only used in the binary |
There is too much things to be put inside just main.rs Creating a sub crate allows to have a cleaner workspace, and testing libraries is also easier. Finally, people could be interested to have the CLI tools exposed in the public API, e.g., to create a wrapper application. There may be better project organization, and I am of course open to suggestion. |
I think it's ready to be merged, what do you think @Rolv-Apneseth? |
Just a couple things I think:
|
Codacy errors are not really meaningful, because it is just complaining about lines being too long in Markdown files, but I don't know how to ignore those globally.
Yep, I wrote that quickly and have probably left some typos :'-)
Good point! I'll fix this, but can you add the necessary information for insta snapshots?
Yes, most messages can be ignored (it's a bit painful to check all messages, but I did try my best). |
What actually is codacy? Is there not configuration for the line length? And I see there's errors coming from the
I think it says on the action that you need to acknowledge the performance decrease.
So should I add it to where we run the readme through
Sure yeah, but all there is to say is that running tests might create changes to the snapshots, and you'll need to accept changes (assuming they are intentional) with
Would we turn off whatever action is causing that or you want to keep it? |
It's a code-quality checker, but it runs online. I am disabling line-length checks locally (see the config files), but for some reason it is not taken into account by Codacy, and I couldn't find documentation about this online.
Yes, you're correct! I just acknowledged them.
Not sure to understand this, could you clarify?
Makes sense, let's just add this at the end of the Testing section in
I think it would make sense to turn this off for at least some code files. I'll try first to disable a few rules, similar to what I did for another repository I own. If that spamming again the PRs, I'll disable checking code files. |
Sure. In our own CLI tests, we snapshot test the
Alright
Sounds good |
Yes, good idea! |
…t error due to old version)
If that action is just checking the readme, do we still need it? It's pointing out that "GitHub" misspelling in links... |
At the moment it is also checking the text found in Rust files, so likely checking the documentation too, but I disabled a few rules to avoid false positives. |
Alright fair enough. Overall, LGTM anyway |
Nice, thanks for your help @Rolv-Apneseth! I've merged this and will soon release an alpha version. Hopefully, it will work just fine, and we can release the v3 in one or two weeks. |
Fantastic |
The goal of this PR is to reorganize the crate so that:
src/lib/
. This folder should not contain anything else, except a few mandatory CLI related features, guarded behind#[cfg_attr(feature = "cli", derive(...))]
and similar;WordsAdd
andWordsDelete
inside submodules;src/cli
, and renamedcli.rs
tosrc/lib/mod.rs
;src/cli/check.rs
, prepare the necessary logic to (1) read multiple filenames, (2) detect file type and use correct parser (i.e., Typst, Markdown, or raw text), and (3) generate a many requests as needed, splitting long text if needed.Error::ResponseEncode
andError::RequestEncode
are remove and onlyError::Request
is used.languagetool-rust/.github/workflows/rustlib.yml
Line 33 in a217b40
ltrs check README.md
work (so basic splitting must be implemented)CHANGELOG.md
inside the docs?src/cli/check.rs
so thatthis or 'data' is required
is changed tothis, 'data', or [FILENAMES...]
cannot be passed simultaneously. If nothing is specified, input will be read from stdin.