Hi, My previous team used SonarQube for detecting such issues. I saw a free version can be used. Also there is sonarlint for local checks which i found useful.
Cheers Yufei On Fri, Dec 10, 2021 at 6:08 PM Yunze Xu <y...@streamnative.io.invalid> wrote: > Hi, all > > Recently I found a bug that could be avoided if we have a CI to detect > unused > variables. See https://github.com/apache/pulsar/pull/13233 < > https://github.com/apache/pulsar/pull/13233>. We can see the > private field `recycleHandle` was not used before this PR. > > Generally, we should avoid all unused private fields except some special > cases > like `AtomicIntegerFieldUpdater`, while the warning should be suppressed by > `@SuppressWarnings(“unused”)`. > > I see checkstyle plugins are still not applied for all modules, so the > code quality > Is not guaranteed well. BTW, I found checkstyle plugin cannot detect unused > variables. > > Does anyone know any plugin to do this work? There is much work to enhance > our code quality. > > Thanks, > Yunze