freedomlayer / offset

Offset payment engine
https://www.offsetcredit.org
Other
163 stars 20 forks source link

Stale code #220

Closed pzmarzly closed 5 years ago

pzmarzly commented 5 years ago

After stumbling upon unlinked file during development in #215 , I created a script to find other unlinked files. Here are the results for current master:

Stale files (safe to remove):

    components/common/src/async_adapter.rs
    components/common/src/frame_codec.rs
    components/common/src/wait_spawner.rs
    components/funder/src/credit_calc.rs
    components/funder/src/freeze_guard_legacy.rs
    components/stctrl/src/bin/stverify.rs

freeze_guard_legacy.rs will be removed once #215 is merged. Please decide what to do with other files. I think it would be nice to have similar analysis for unused functions, but existing utilities (like warnalyzer) are not ready for codebases as large as offst yet.

realcr commented 5 years ago

@pzmarzly : Thanks for putting this analysis. I just looked at stale-rs, pretty cool idea! I have never heard of warnalyzer. Do you have any idea why won't it work for Offst? Maybe we can file it as an issue there?

About the stale files you mentioned, you can remove everything besides stverify.rs, which is an actual binary. I wonder why it was detected as unused, but stctrl.rs wasn't.

EDIT: I know why. Because stctrl/Cargo.toml contains:

[lib]
name = "stctrl"
path = "src/lib.rs"

[[bin]]
name = "stctrl"
path = "src/bin/stctrl.rs"

But stverify.rs is not included as a binary. Could you add it? About the rest of the stuff: It's sad to see them go, but we are using git, so they will always be here with us somewhere (:

pzmarzly commented 5 years ago

warnalyzer does not support projects with multiple targets (binaries) or tests. I saw it announcement about a week ago on Reddit, it's a new project, so it needs time.

pzmarzly commented 5 years ago

I pushed into #215 , as some changes were already done there (freeze_guard_legacy.rs).