Cargo.toml: Support inline tables
What does this MR do and why?
This MR extends the "cargo toml linker" to support inline tables as seen below. It also updates the linker to skip module that are loaded from sources other than the default.
This is done as to add the missing links and not link to non-existent or wrong dependencies.
Screenshots or screen recordings
Before | After |
---|---|
The things to note in the screenshots are:
- "indicatif" goes from ignored to linked
- "bracked-ignored" goes from linked to ignored
How to set up and validate locally
- Run the test
./bin/rspec spec/lib/gitlab/dependency_linker/cargo_toml_linker_spec.rb
- Create and look at a
Cargo.toml
file such as:
# See https://doc.rust-lang.org/cargo/reference/manifest.html
[package]
# Package shouldn't be matched
name = "gitlab-test"
version = "0.0.1"
authors = ["Some User <some.user@example.org>"]
description = "A GitLab test Cargo.toml."
keywords = ["gitlab", "test", "rust", "crago"]
readme = "README.md"
[dependencies]
# Default dependencies format with fixed version and version range
chrono = "0.4.7"
xml-rs = ">=0.8.0"
indicatif = { version = "0.17.5", features = ["rayon"] }
[dependencies.memchr]
# Specific dependency with optional info
version = "2.2.1"
optional = true
[dev-dependencies]
# Dev dependency with version modifier
commandspec = "~0.12.2"
[build-dependencies]
# Build dependency with version wildcard
thread_local = "0.3.*"
# Dependencies with a custom location should be ignored
path-ignored = { path = "local" }
git-ignored = { git = "https://example.com/.git" }
registry-ignored = { registry = "custom-registry" }
[build-dependencies.bracked-ignored]
path = "local"
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Ignaz Kraft