dojo icon indicating copy to clipboard operation
dojo copied to clipboard

Implement/derive `Debug` for public types

Open tcoratger opened this issue 10 months ago • 11 comments

Is your feature request related to a problem? Please describe.

It is convenient to expose a Debug method on all types that are public in order to make interaction with the outside easier. Some repository types like TestSequencer

https://github.com/dojoengine/dojo/blob/89a5b9eb31a32e58a0429b7d17151361cb09f746/crates/dojo-test-utils/src/sequencer.rs#L29-L35

for example do not have this implementation provided.

Describe the solution you'd like

I think we should enforce the Debug implementation for all types made public. To facilitate this and be sure of the long-term continuation of this good practice, we could add the following lint https://doc.rust-lang.org/stable/nightly-rustc/rustc_lint/builtin/static.MISSING_DEBUG_IMPLEMENTATIONS.html to the Clippy script so that a rule violation is automatically detected by the CI.

tcoratger avatar Apr 15 '24 18:04 tcoratger

hello @tcoratger, i would love to work on this

g4titanx avatar Apr 18 '24 20:04 g4titanx

hello @tcoratger, i would love to work on this

Do you have any question @g4titanx before starting on this?

  • [ ] add the clippy check.
  • [ ] derive Debug on public type. You may try to add a commit for each crate to ensure easier revision.

glihm avatar Apr 18 '24 23:04 glihm

yeah, can you elaborate the clip check issue

g4titanx avatar Apr 19 '24 13:04 g4titanx

yeah, can you elaborate the clip check issue

clippy check sorry, just reworded it. As mentioned by @tcoratger the idea is to ensure the linting step of the CI can detect a missing Debug on a public type.

glihm avatar Apr 19 '24 15:04 glihm

yeah, can you elaborate the clip check issue

clippy check sorry, just reworded it. As mentioned by @tcoratger the idea is to ensure the linting step of the CI can detect a missing Debug on a public type.

@g4titanx Yes, this check does this job for example: https://github.com/paradigmxyz/reth/blob/bd4757b3b53022f871872790c27aa571d2ec2fdb/Cargo.toml#L96

tcoratger avatar Apr 19 '24 15:04 tcoratger

yeah, can you elaborate the clip check issue

clippy check sorry, just reworded it. As mentioned by @tcoratger the idea is to ensure the linting step of the CI can detect a missing Debug on a public type.

okay, great! i would reach out to you if I need more explanation

g4titanx avatar Apr 20 '24 07:04 g4titanx

yeah, can you elaborate the clip check issue

clippy check sorry, just reworded it. As mentioned by @tcoratger the idea is to ensure the linting step of the CI can detect a missing Debug on a public type.

@g4titanx Yes, this check does this job for example: https://github.com/paradigmxyz/reth/blob/bd4757b3b53022f871872790c27aa571d2ec2fdb/Cargo.toml#L96

yeah, I would use this as a reference

g4titanx avatar Apr 20 '24 07:04 g4titanx

yeah, can you elaborate the clip check issue

clippy check sorry, just reworded it. As mentioned by @tcoratger the idea is to ensure the linting step of the CI can detect a missing Debug on a public type.

@g4titanx Yes, this check does this job for example: https://github.com/paradigmxyz/reth/blob/bd4757b3b53022f871872790c27aa571d2ec2fdb/Cargo.toml#L96

yeah, I would use this as a reference

I would say, if possible, this is better to apply this rule for the entire project.

tcoratger avatar Apr 21 '24 20:04 tcoratger

okay, great!

g4titanx avatar Apr 22 '24 06:04 g4titanx

hey man! i have fixed this issue on my PC but I am having issue compiling as I am using a low ram computer. you can unassign me as I have tried every means to make this. i used a devcontainer too

g4titanx avatar Apr 24 '24 18:04 g4titanx

hey man! i have fixed this issue on my PC but I am having issue compiling as I am using a low ram computer. you can unassign me as I have tried every means to make this. i used a devcontainer too

Arg.. sorry to hear. You can specify a package if you want to limit ram consumption using the -p option while using cargo build or cargo run.

Also, do not hesitate to open the PR, this will help anyway. Appreciate your time and effort on this.

glihm avatar Apr 24 '24 20:04 glihm