cargo-semver-checks icon indicating copy to clipboard operation
cargo-semver-checks copied to clipboard

Duplicated failure of a lint

Open tonowak opened this issue 2 years ago • 1 comments

Steps to reproduce the bug with the above code

git clone [email protected]:bevyengine/bevy.git
cd bevy/crates/bevy_render
git checkout 1efdbb7e # for consistent output
cargo run --manifest-path=../../../cargo-semver-check/Cargo.toml -- semver-checks check-release

Actual Behaviour

   Compiling cargo-semver-checks v0.15.2 (/home/tonowak/zpp/cargo-semver-check)
    Finished dev [unoptimized + debuginfo] target(s) in 6.44s
     Running `/home/tonowak/zpp/cargo-semver-check/target/debug/cargo-semver-checks semver-checks check-release`
    Updating index
     Parsing bevy_render v0.9.0 (current)
     Parsing bevy_render v0.9.0 (baseline)
    Checking bevy_render v0.9.0 -> v0.9.0 (no change)
   Completed [ 119.804s] 33 checks; 28 passed, 5 failed, 0 unnecessary

--- failure constructible_struct_adds_field: externally-constructible struct adds field ---

Description:
A pub struct constructible with a struct literal has a new pub field. Existing struct literals must be updated to include the new field.
        ref: https://doc.rust-lang.org/reference/expressions/struct-expr.html
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.15.2/src/queries/constructible_struct_adds_field.ron

Failed in:
  field Camera.order in crates/bevy_render/src/camera/camera.rs:90

--- failure inherent_method_missing: pub method removed or renamed ---

Description:
A publicly-visible method or associated fn is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.15.2/src/queries/inherent_method_missing.ron

Failed in:
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52
  Visibility::toggle, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:52

--- failure struct_missing: pub struct removed or renamed ---

Description:
A publicly-visible struct cannot be imported by its prior path. A `pub use` may have been removed, or the struct itself may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.15.2/src/queries/struct_missing.ron

Failed in:
  struct bevy_render::FrameCountPlugin, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/lib.rs:372
  struct bevy_render::view::visibility::Visibility, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:31
  struct bevy_render::view::visibility::Visibility, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:31
  struct bevy_render::view::visibility::Visibility, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:31
  struct bevy_render::view::visibility::Visibility, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:31
  struct bevy_render::prelude::Visibility, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/view/visibility/mod.rs:31

--- failure struct_pub_field_missing: pub struct's pub field removed or renamed ---

Description:
A publicly-visible struct has at least one public field that is no longer available under its prior name. It may have been renamed or removed entirely.
        ref: https://doc.rust-lang.org/cargo/reference/semver.html#item-remove
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.15.2/src/queries/struct_pub_field_missing.ron

Failed in:
  field priority of struct Camera, previously in file /home/tonowak/.cargo/registry/src/github.com-1ecc6299db9ec823/bevy_render-0.9.0/src/camera/camera.rs:90

--- failure unit_struct_changed_kind: unit struct changed kind ---

Description:
A public unit struct has been changed to a normal (curly-braces) struct, which cannot be constructed using the same struct literal syntax.
        ref: https://github.com/rust-lang/cargo/pull/10871
       impl: https://github.com/obi1kenobi/cargo-semver-check/tree/v0.15.2/src/queries/unit_struct_changed_kind.ron

Failed in:
  struct RenderPlugin in crates/bevy_render/src/lib.rs:63
       Final [ 135.265s] semver requires new major version: 5 major and 0 minor checks failed

Expected Behaviour

The tool should only print once about the failure (or maybe zero times, if the issue is not present at all -- it needs to be checked).

Generated System Information

Software version

cargo-semver-checks 0.15.2 (bc3eb98-modified)

Operating system

Linux 6.1.4-arch1-1

Command-line

target/debug/cargo-semver-checks semver-checks --bugreport

cargo version

> cargo -V
cargo 1.66.0 (d65d197ad 2022-11-15)

Compile time information

  • Profile: debug
  • Target triple: x86_64-unknown-linux-gnu
  • Family: unix
  • OS: linux
  • Architecture: x86_64
  • Pointer width: 64
  • Endian: little
  • CPU features: fxsr,sse,sse2
  • Host: x86_64-unknown-linux-gnu

Build Configuration

No response

Additional Context

The same happens on bevy_ui, but with the lint struct_pub_field_missing. There is a high chance that it is the same issue. If it is not, a new issue needs to be created.

It might be related to https://github.com/obi1kenobi/cargo-semver-checks/issues/274, but I don't think so.

tonowak avatar Jan 09 '23 19:01 tonowak

I think this might be related to re-exports of the same item, which end up checked independently because the query "says so."

The systematic solution for this requires support for exporting @tag values across @fold boundaries, to allow a query structure like:

{
  baseline {
    item {
      importable_path @fold {
        name @tag(name: "paths")
      }
    }    
  }
  current {
    item {
      importable_path @fold @transform(op: "count") @filter(op: ">", value: ["$zero"]) {
        name @filter(op: "one_of", value: ["$paths"])
      }
    }
  }
}

In this query, the tagged paths value at the point of use is of type [String!]! because it is folded over before being used. Inside its own @fold scope, the tagged value is of type String! as normal.

This is not something Trustfall supports today: https://github.com/obi1kenobi/trustfall/issues/130

In the meantime, we may be able to ship a workaround: if a lint query result includes span info, then only report each span once for each lint. Results that lack spans should always be reported.

obi1kenobi avatar Jan 20 '23 19:01 obi1kenobi