Skip to content
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

Run cargo sort-ck on the workspace #544

Merged
merged 2 commits into from
May 11, 2021
Merged

Run cargo sort-ck on the workspace #544

merged 2 commits into from
May 11, 2021

Conversation

DevinR528
Copy link
Member

@DevinR528 DevinR528 commented May 2, 2021

I'm just waiting on toml-rs/toml#104 to be merged then I can publish a new version of cargo sort-ck and add it to CI, but first I wanted to see what everyone thinks of the output?

@DevinR528 DevinR528 requested a review from jplatte as a code owner May 2, 2021 11:43
Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, except for ruma/Cargo.toml. Does cargo-sort-ck also do the reordering? In that case shouldn't it be called cargo sort (with --check being an optional flag)?

ruma/Cargo.toml Outdated
Comment on lines 22 to 35
ruma-common = { version = "0.5.0", path = "../ruma-common" }
ruma-identifiers = { version = "0.19.0", path = "../ruma-identifiers", features = ["serde"] }
ruma-serde = { version = "0.3.1", path = "../ruma-serde" }

ruma-client = { version = "=0.5.0-alpha.2", path = "../ruma-client", optional = true }
ruma-events = { version = "=0.22.0-alpha.3", path = "../ruma-events", optional = true }
ruma-signatures = { version = "0.7.0", path = "../ruma-signatures", optional = true }

ruma-api = { version = "=0.17.0-alpha.4", path = "../ruma-api", optional = true }
ruma-appservice-api = { version = "=0.2.0-alpha.3", path = "../ruma-appservice-api", optional = true }

ruma-client = { version = "=0.5.0-alpha.2", path = "../ruma-client", optional = true }
ruma-client-api = { version = "=0.10.0-alpha.3", path = "../ruma-client-api", optional = true }

ruma-common = { version = "0.5.0", path = "../ruma-common" }
ruma-events = { version = "=0.22.0-alpha.3", path = "../ruma-events", optional = true }
ruma-federation-api = { version = "=0.1.0-alpha.2", path = "../ruma-federation-api", optional = true }
ruma-identifiers = { version = "0.19.0", path = "../ruma-identifiers", features = ["serde"] }
ruma-identity-service-api = { version = "=0.1.0-alpha.1", path = "../ruma-identity-service-api", optional = true }
ruma-push-gateway-api = { version = "=0.1.0-alpha.1", path = "../ruma-push-gateway-api", optional = true }
ruma-serde = { version = "0.3.1", path = "../ruma-serde" }
ruma-signatures = { version = "0.7.0", path = "../ruma-signatures", optional = true }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't make sense. The entries were grouped, now entries from different groups have been switched around. I want the dependencies sorted inside the group, but definitely not across groups.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I would imagine this is common enough to warrant a new --grouped flag or something like this I'll add it to cargo-sort-ck.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to keep "full" sorting as the default, I would recommend that it should at least remove the grouping entirely then (remove the empty lines between dependencies), the current output is just confusing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the --grouped option and a config file this now works perfectly. I'm not crazy about the config file but that many cli flags is worse 🤷

@DevinR528
Copy link
Member Author

It's the opposite, the default behaviour is just to exit with a nonzero and print an error. When --print or --write are on it writes the string.

@jplatte
Copy link
Member

jplatte commented May 3, 2021

It's the opposite, the default behaviour is just to exit with a nonzero and print an error. When --print or --write are on it writes the string.

That's the opposite default from cargo fmt, is there a specific reason? Anyways, that's not really relevant to this PR. Should I open an issue about it?

@DevinR528
Copy link
Member Author

Yeah, open an issue. The reason was it satisfied dtolnay/request-for-implementation#29 which was why I wrote it.

Copy link
Member

@jplatte jplatte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In addition to the review comment below, please remove the extra config file as discussed.

xtask/src/ci.rs Outdated Show resolved Hide resolved
@jplatte jplatte enabled auto-merge (squash) May 11, 2021 19:52
@jplatte jplatte merged commit dcff455 into ruma:main May 11, 2021
@DevinR528 DevinR528 deleted the sort-toml branch May 11, 2021 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants