Page MenuHomePhabricator

[Chronik] Add lint macro to prevent having to repeat common lints in every crate
ClosedPublic

Authored by tobias_ruck on Jul 21 2022, 21:46.

Details

Summary

Manually checking that all lints are the same for all the crates in the repo is an unnecessary burden on developers and reviewers.

With this macro, common lints are applied to all the items contained in it. This way lints can be defined in one place.

Naturally, it doesn't cover anything outside the macro (e.g. the docs for the crate itself are not enforced anymore), however this is
something that is reasonable to be checked manually by a reviewer.

Test Plan
  1. ninja check-bitcoinsuite
  2. Add pub struct S; into hash.rs
  3. Make sure ninja check-bitcoinsuite gives a bunch of lints (missing docs, missing Debug)
  4. Revert

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Fabien requested changes to this revision.Jul 22 2022, 08:00
Fabien added inline comments.
chronik/bitcoinsuite-core/Cargo.toml
11 ↗(On Diff #34460)

Imo chronik-lint or just lint seems more appropriated, especially when other parts like chronik-db are added it's weird that it uses bitcoinsuite-lint

chronik/bitcoinsuite-lint/src/lib.rs
1 ↗(On Diff #34460)

Copyright is missing

This revision now requires changes to proceed.Jul 22 2022, 08:00
  • Add copyright
  • Rename crate to abc-lint
This revision is now accepted and ready to land.Jul 22 2022, 08:39