-
Notifications
You must be signed in to change notification settings - Fork 11
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
Allow the specification of lint crates in a file (local path and git) #81
Comments
@Niki4tap I created an issue for this feature and for discussions Some information:
This information was gathered by @Niki4tap, thank you! |
Tasks:
Moved tasks:
|
Last point needs a bit of explanation, imagine: [workspace]
members = [
"member_a",
"member_b"
]
[workspace.metadata.marker.lints]
lint_a = { path = "lint_a" } Do we want to give the ability for [package]
# your usual keys...
[package.metadata.marker.lints]
# Should we allow adding more lints here?
lint_b = { path = "../lint_b" }
# Should `lint_a` still apply for `member_a`? |
Additionally, using the |
Thank you @Niki4tap!
I think this item will also be blocked, until v0.0.1 can be published to crates.io, since we can't upload a lint crate, without having
That would be something cool to see. Though, I'd move it to a new issue.
Development on cargo has slowed down AFAIK. So while this'll add to the maintenance cost, I'd be fine with it if it simplifies the code significantly. I fear that we'll have a weird mix of calling cargo commands where possible and link to it directly where not.
This is an important question, maybe we could have the restriction that only the main Maybe dylint could be an interesting example. It's a tool for custom rust lints, though the user has to directly interact with rustc. From the README, it looks like they only look in the main What are your thoughts on these topics? |
Oh, yeah, good point, feel free to extract this into a separate issue.
Yep, I was thinking adding a new field, something like: [workspace.metadata.marker.lints.lint_a]
path = "lint_a"
config = { ... } And passing raw toml
I haven't looked that much into it so far, but I'm aware of it, and yes, afaik you're correct that looks only in the root
For me it would ideally look like this: [workspace]
members = [
"member_a",
"member_b"
]
[workspace.metadata.marker.lints]
lint_a = { ... } # this isn't possible to override by workspace members
[package]
# ...
[package.metadata.marker.lints]
lint_a = { ... } # <- this is an error
lint_b = { ... } # but adding new lints is ok (`lint_b` won't apply to `member_b`) So the structure would be:
and then after cascading:
But that requires a lot of work, and I'm probably just overthinking it 😅, so I'm fine with root config being the only one for now :) |
84: cargo-marker: add initial configuration support r=xFrednet a=Niki4tap Tracked in #81 Adds initial configuration implementation, checking out one task :) `@xFrednet` Co-authored-by: Niki4tap <[email protected]>
I would keep it here for now, as this feels like a tracking issue. Or do you prefer it to be an extra issue?
Related to lint configs, it might make sense to move them into a separate file. I've heard now several times, that larger multilingual projects don't use cargo but integrate rustc into their toolchain directly. For Clippy they also use the driver instead of
I love to make things overly complicated as well, that's one reason for the Driver/API split. With some things, like this, I'm definitely open for the option, but would like to see a use-case first, since it might require a lot of work as you said. :) |
Btw, with CVE-2022-46176 recently being posted for Cargo, we should think about how we interact with git for fetching resources. In the report, it says that using git via the console command is fine, as git then handles everything. If we bind to cargo the same should apply. However, if we bind to a crate like gitlib2, we might have to deal with something similar. |
I think it might be better to move out:
|
Btw, I just found this fetching code Clippy uses in the lintcheck tool. It might not be the most robust, but maybe a good reference. I'm going to ask cargo to maybe add a We could consider moving the crates.io and git fetching code into a different crate and then share it with Clippy. This would also be useful, if we want a tool like lintcheck for Marker. But this is probably a bigger task for the future :) |
126: cargo-marker: add git support r=xFrednet a=Niki4tap Its been a while since I've worked on this, but I've finally took the time to finish it. This PR adds git support to marker so this now works: ```toml [workspace.metadata.marker.lints] marker_lints = { git = "https://github.com/rust-marker/marker" } ``` It makes use of [`cargo_fetch`](https://github.com/Niki4tap/cargo_fetch) library which I made for this specific use-case, which is essentially just a thin wrapper around `cargo` library (so the builds are now way slower :p). I'll try to maintain the library to my best capacity, and prioritize marker's goals whenever needed. Addition of the library also technically allows for any kind of package to be downloaded, so this also *technically* supports registries, though this PR does not implement it, because this is blocked on marker APIs being released. --- In total this checks out... *\*looks up the issue\**... one task from #81! But also *technically* closes <!-- do not close this issue github please --> #87 whenever APIs are published. review side note: most changes are from `Cargo.lock` Co-authored-by: Niki4tap <[email protected]>
126: cargo-marker: add git support r=xFrednet a=Niki4tap Its been a while since I've worked on this, but I've finally took the time to finish it. This PR adds git support to marker so this now works: ```toml [workspace.metadata.marker.lints] marker_lints = { git = "https://github.com/rust-marker/marker" } ``` It makes use of [`cargo_fetch`](https://github.com/Niki4tap/cargo_fetch) library which I made for this specific use-case, which is essentially just a thin wrapper around `cargo` library (so the builds are now way slower :p). I'll try to maintain the library to my best capacity, and prioritize marker's goals whenever needed. Addition of the library also technically allows for any kind of package to be downloaded, so this also *technically* supports registries, though this PR does not implement it, because this is blocked on marker APIs being released. --- In total this checks out... *\*looks up the issue\**... one task from #81! But also *technically* closes <!-- do not close this issue github please --> #87 whenever APIs are published. review side note: most changes are from `Cargo.lock` Co-authored-by: Niki4tap <[email protected]>
I'm guessing this issue can be closed, now that #126 has been merged. Ideally, we'll migrate to a cargo command version when the feature gets added to cargo. But until then this works well :) |
Currently, the lint crates have to be specified via console arguments. In a real world applications users most likely have a set of crates they want to run every time. Therefore, I suggest specifying lint crates in a file like Cargo does for dependencies.
There are several design decisions as part of this issue:
Cargo.toml
or a newmarker.toml
file?Generally see: https://doc.rust-lang.org/cargo/commands/index.html for cargo comments and documentation
The text was updated successfully, but these errors were encountered: