cargo-semver-checks 0.4.4

Scan your Rust crate for semver violations.
SemverQuery(
    id: "enum_variant_added",
    human_readable_name: "enum variant added on exhaustive enum",
    description: "A publicly-visible enum has a new variant. The enum is not marked #[non_exhaustive], so this is a major breaking change for code that depends on it.",
    required_update: Major,
    reference_link: Some("https://doc.rust-lang.org/cargo/reference/semver.html#enum-variant-new"),
    query: r#"
    {
        CrateDiff {
            current {
                item {
                    ... on Enum {
                        enum_name: name @output @tag
                        visibility_limit @filter(op: "=", value: ["$public"]) @output
                        attrs @filter(op: "not_contains", value: ["$non_exhaustive"])

                        path {
                            path @output @tag
                        }

                        variant {
                            variant_name: name @output @tag

                            span_: span @optional {
                                filename @output
                                begin_line @output
                            }
                        }
                    }
                }
            }
            baseline {
                item {
                    ... on Enum {
                        name @filter(op: "=", value: ["%enum_name"])
                        visibility_limit @filter(op: "=", value: ["$public"])
                        attrs @filter(op: "not_contains", value: ["$non_exhaustive"])

                        path {
                            path @filter(op: "=", value: ["%path"])
                        }

                        variant @fold @transform(op: "count") @filter(op: "=", value: ["$zero"]) {
                            name @filter(op: "=", value: ["%variant_name"])
                        }
                    }
                }
            }
        }
    }"#,
    arguments: {
        "public": "public",
        "zero": 0,
        "non_exhaustive": "#[non_exhaustive]",
    },
    error_message: "A publicly-visible enum without #[non_exhaustive] has a new variant.",
    per_result_error_template: Some("variant {{enum_name}}:{{variant_name}} in {{span_filename}}:{{span_begin_line}}"),
)