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

Please tag a new stable release #67

Open
sjackman opened this issue Dec 13, 2023 · 11 comments
Open

Please tag a new stable release #67

sjackman opened this issue Dec 13, 2023 · 11 comments

Comments

@sjackman
Copy link

sjackman commented Dec 13, 2023

The current stable release version 1.0.9 fails with this error message:

$ cargo install cargo-sort

$ cargo sort -w           
Checking rust...
Finished: Cargo.toml for "rust" has been rewritten
Checking mycrate...
thread 'main' panicked at /Users/shaun.jackman/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cargo-sort-1.0.9/src/sort.rs:113:46:
called `Result::unwrap()` on an `Err` value: TomlError { message: "TOML parse error at line 13, column 6\n   |\n13 | serde.workspace = true\n   |      ^\nUnexpected `.`\nExpected `=`\n" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

and this issue is fixed on the current main branch. Please tag a new stable release. Thank you!

The workaround is to install cargo-sort from Git:

cargo install --git=https://github.com/DevinR528/cargo-sort --branch=main cargo-sort
@mlegner
Copy link

mlegner commented Apr 19, 2024

@DevinR528 This would be super helpful!

@orhun
Copy link
Contributor

orhun commented Jun 4, 2024

Any progress on this? 👀

sveitser added a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 18, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
tbro pushed a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 18, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
tbro pushed a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 20, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
tbro pushed a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 20, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
tbro pushed a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 23, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
tbro pushed a commit to EspressoSystems/espresso-sequencer that referenced this issue Sep 23, 2024
The released version of `cargo sort` does not support syntax like

    version.workspace = true

DevinR528/cargo-sort#67
@ikrivosheev
Copy link
Contributor

Well, after merge: #81 we can close the issue.

@ikrivosheev
Copy link
Contributor

@jplatte maybe it's time for new release after upgrade toml_edit?

@ikrivosheev
Copy link
Contributor

I read changelog toml_edit, I don't see any breaking changes for this crate: https://github.com/toml-rs/toml/blob/main/crates/toml_edit/CHANGELOG.md#0220---2024-02-05

@jplatte
Copy link
Collaborator

jplatte commented Nov 19, 2024

The upgrade of toml_edit you just did has nothing to do with why the release was yanked. I think it was related to the previous upgrade.

You already observed that running cargo sort on its own repository rewrites a three-line comment to a single line, right? That would need to be fixed before making another release. And I think there are more issues like that. If you are interested in working on fixing those, I can spend some time on creating test cases.

@ikrivosheev
Copy link
Contributor

The upgrade of toml_edit you just did has nothing to do with why the release was yanked. I think it was related to the previous upgrade.

You already observed that running cargo sort on its own repository rewrites a three-line comment to a single line, right? That would need to be fixed before making another release. And I think there are more issues like that. If you are interested in working on fixing those, I can spend some time on creating test cases.

Now I see. Yes, I'll help with the new release. I'll review current test cases and improve them.

If you have test cases it'll be great.

@jplatte
Copy link
Collaborator

jplatte commented Nov 19, 2024

Okay so good news: In Ruma, the project that originally spawned cargo-sort, there seems to be only one thing that regresses formatting with the latest version: A trailing comma on the last item of a multi-line arrays is removed. For the following input:

[package]
name = "cargo-sort-test"
version = "0.1.0"
edition = "2021"

[features]
default = [
    "feature-a",
    "feature-b",
    "feature-c",
    "feature-d",
    "feature-e",
]
feature-a = []
feature-b = []
feature-c = []
feature-d = []
feature-e = []

the latest cargo sort from main will remove the comma in "feature-e",, whereas v1.0.9 will leave it as-is.

If that bug and the one with cargo sorts own multiline comment are fixed, I'm happy to publish another release :)

@ssrlive
Copy link
Contributor

ssrlive commented Nov 30, 2024

Hi @jplatte, Please Publish it. Because Taplo, like cargo-sort, also uses the Toml crate library, Taplo can format a toml file as you expect. If using cargo-sort doesn't meet your expectations, you can use Taplo to process it again without delaying any work at all.

image

Here is the code slice processed by cargo- sort:

[workspace.package]
homepage = "https://github.com/toml-rs/toml"
repository = "https://github.com/toml-rs/toml"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.65" # MSRV
include = ["build.rs", "src/**/*", "Cargo.toml", "Cargo.lock", "LICENSE*", "README.md", "benches/**/*", "examples/**/*", "tests/**/*"]

And Here is the code slice processed by Taplo:

[workspace.package]
homepage = "https://github.com/toml-rs/toml"
repository = "https://github.com/toml-rs/toml"
license = "MIT OR Apache-2.0"
edition = "2021"
rust-version = "1.65" # MSRV
include = [
  "build.rs",
  "src/**/*",
  "Cargo.toml",
  "Cargo.lock",
  "LICENSE*",
  "README.md",
  "benches/**/*",
  "examples/**/*",
  "tests/**/*",
]

@jplatte
Copy link
Collaborator

jplatte commented Nov 30, 2024

Sorry, but no. I'm not going to ship a patch release with known regressions.

@ssrlive
Copy link
Contributor

ssrlive commented Nov 30, 2024

Well, I have to install cargo-sort like this:

cargo install cargo-sort --git https://github.com/DevinR528/cargo-sort.git

I hope the command can help other persons.

ssrlive added a commit to ssrlive/cargo-sort that referenced this issue Dec 1, 2024
ssrlive added a commit to ssrlive/cargo-sort that referenced this issue Dec 1, 2024
ssrlive added a commit to ssrlive/cargo-sort that referenced this issue Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants