Skip to content

Make CI disallow leftover debugging code #511

Open

Description

@niklasmohrin

See #483 (comment)

A CI job could ensure that there are no dbg! (or pr_info!, etc.) calls left in pushed code would be a nice addition to the test suite. I have three high level ideas for how to accomplish this, but I haven't checked the applicability of any of them:

  1. Use rust-analyzer to find all references of the disallowed methods
  2. I believe there are certain clippy lints similar to what we want (disallowed-methods or so, relatively new) that could potentially be used
  3. Just grep over all of the Rust code / all *.rs files

While the last option is probably simplest, it may not be the cleanest. (note that these are just my first ideas, anyone implementing this can of course diverge from them :D ).

Activity

  1. bjorn3 commented on Oct 9, 2021

    @bjorn3
    Member

    What about adding an option that will be enabled on CI replacing the definitions of these macros with compile_error!("some error message")?

  2. niklasmohrin commented on Oct 9, 2021

    @niklasmohrin
    Author

    What about adding an option that will be enabled on CI replacing the definitions of these macros with compile_error!("some error message")?

    Good idea! It could be gated by a feature or env variable

  3. riking commented on Nov 18, 2022

    @riking

    How about a checkpatch.pl rule?

  4. bjorn3 commented on Nov 18, 2022

    @bjorn3
    Member

    That would trigger on the pr_log! call in the dbg! definition too, right? Even if dbg! isn't called.

  5. nbdd0121 commented on Nov 18, 2022

    @nbdd0121
    Member

    We just need to add #[rustc_diagnostic_item = "dbg_macro"] to our dbg macro and then enable clippy's dbg_macro lint.

    (Alternatively I can add a similar lint to klint)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    • miscRelated to other topics (e.g. CI).

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions