You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pulsar.apache.org by Yunze Xu <yz...@streamnative.io.INVALID> on 2021/12/10 10:08:42 UTC
Detect unused variables in CI
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
Re: Detect unused variables in CI
Posted by Yufei Zhang <af...@gmail.com>.
Hi,
Issue has been created at : https://github.com/apache/pulsar/issues/13244
Cheers,
Yufei
On Sun, 12 Dec 2021 at 00:45, Yunze Xu <yz...@streamnative.io.invalid> wrote:
> Looks good. Could you open an issue for it so we can add it later?
>
> Thanks,
> Yunze
> > 2021年12月10日 下午8:27,Yufei Zhang <af...@gmail.com> 写道:
> >
> > From what I read it can be used in Maven projects. Basically it needs a
> > SonarScanner (different versions for multiple languages and build tools)
> > for Maven as in [1]. Then the scanner forwards the result to SonarQube
> > website for reports. It can be used with code test coverage tools as
> well.
>
>
Re: Detect unused variables in CI
Posted by Yunze Xu <yz...@streamnative.io.INVALID>.
Looks good. Could you open an issue for it so we can add it later?
Thanks,
Yunze
> 2021年12月10日 下午8:27,Yufei Zhang <af...@gmail.com> 写道:
>
> From what I read it can be used in Maven projects. Basically it needs a
> SonarScanner (different versions for multiple languages and build tools)
> for Maven as in [1]. Then the scanner forwards the result to SonarQube
> website for reports. It can be used with code test coverage tools as well.
Re: Detect unused variables in CI
Posted by Yufei Zhang <af...@gmail.com>.
Hi,
From what I read it can be used in Maven projects. Basically it needs a
SonarScanner (different versions for multiple languages and build tools)
for Maven as in [1]. Then the scanner forwards the result to SonarQube
website for reports. It can be used with code test coverage tools as well.
Cheers,
Yufei
[1]: https://docs.sonarqube.org/latest/analysis/scan/sonarscanner-for-maven/
On Fri, 10 Dec 2021 at 18:17, Yunze Xu <yz...@streamnative.io.invalid> wrote:
> Thanks for the suggestion. I just took a look at
> https://github.com/SonarSource/sonarqube <
> https://github.com/SonarSource/sonarqube>. It looks like SonarQube can
> only
> be applied for Gradle projects?
>
> Thanks,
> Yunze
>
> > 2021年12月10日 下午6:11,Yufei Zhang <af...@gmail.com> 写道:
> >
> > 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 <yz...@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
>
>
Re: Detect unused variables in CI
Posted by Yunze Xu <yz...@streamnative.io.INVALID>.
Thanks for the suggestion. I just took a look at
https://github.com/SonarSource/sonarqube <https://github.com/SonarSource/sonarqube>. It looks like SonarQube can only
be applied for Gradle projects?
Thanks,
Yunze
> 2021年12月10日 下午6:11,Yufei Zhang <af...@gmail.com> 写道:
>
> 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 <yz...@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
Re: Detect unused variables in CI
Posted by Yufei Zhang <af...@gmail.com>.
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 <yz...@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