List of unused code in Jenkins

112 views
Skip to first unread message

Vernat Emeric

unread,
Dec 13, 2015, 6:07:14 PM12/13/15
to jenkin...@googlegroups.com
Hi all,

After the tool to find the deprecated Jenkins api used by plugins, I have written yet another tool.
The unused code detector finds Jenkins methods unused in Jenkins and in latest plugins, including potential usage in jelly. (Getters, setters, do*, deprecated methods and unit tests are ignored. Unused deprecated api is already reported here.)

Current result is that 184 Jenkins methods are never used. Perhaps, some of them could be deprecated or removed right away.
There are certainly false positives in the report, but I think that a majority is really dead code. To be sure that a method is never used, it's possible to grep all sources or to search in github directly.

If you are ok, the tool could be forked into jenkins-infra with a job in CI (If yes, I suggest a daily schedule.)

By the way, I have fixed a bug in the first tool above, there are in fact 560 plugins using a deprecated Jenkins api, not 430.

bye,
Emeric

Oleg Nenashev

unread,
Dec 14, 2015, 2:57:24 AM12/14/15
to Jenkins Developers
Hi Emeric,

Thanks a lot for your efforts! +1 from me for forking the additional tool.

Since we plan to add the API deprecation and removal policy in Jenkins 2.0, such tools should become very important in the middle-term.

Best regards,
Oleg

понедельник, 14 декабря 2015 г., 2:07:14 UTC+3 пользователь evernat написал:

Andrew Bayer

unread,
Dec 14, 2015, 7:49:50 AM12/14/15
to jenkin...@googlegroups.com
Yeah. This is really fascinating stuff - thanks for the work!
--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-dev/7c5f8267-a91d-4ddd-b853-fe49e79711f7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Baptiste Mathus

unread,
Dec 17, 2015, 7:32:58 AM12/17/15
to jenkin...@googlegroups.com
+1 thanks and congrats Emeric!

Gonna use it to make the plugins I maintain disappear from this list (using deprecated code) :-).


For more options, visit https://groups.google.com/d/optout.



--
Baptiste <Batmat> MATHUS - http://batmat.net
Sauvez un arbre,
Mangez un castor !

evernat

unread,
Dec 22, 2015, 6:46:07 AM12/22/15
to Jenkins Developers, m...@batmat.net
Thanks for the kind words Oleg, Andrew and Baptiste.

While waiting for the unused code detector to be eventually forked into jenkins-infra with a job in CI (I suggest a daily schedule),
I have created a job in another jenkins and you can see the result of this unused code detector at:
https://javamelody.ci.cloudbees.com/job/unused-code-detector/lastSuccessfulBuild/artifact/target/output.html
(191 unused methods. The result is updated weekly.)

bye,
Emeric



Le jeudi 17 décembre 2015 13:32:58 UTC+1, Baptiste Mathus a écrit :
+1 thanks and congrats Emeric!

Gonna use it to make the plugins I maintain disappear from this list (using deprecated code) :-).
2015-12-14 13:49 GMT+01:00 Andrew Bayer <andrew...@gmail.com>:
Yeah. This is really fascinating stuff - thanks for the work!


On Monday, December 14, 2015, Oleg Nenashev <o.v.ne...@gmail.com> wrote:
Hi Emeric,

Thanks a lot for your efforts! +1 from me for forking the additional tool.

Since we plan to add the API deprecation and removal policy in Jenkins 2.0, such tools should become very important in the middle-term.

Best regards,
Oleg

понедельник, 14 декабря 2015 г., 2:07:14 UTC+3 пользователь evernat написал:
Hi all,

After the tool to find the deprecated Jenkins api used by plugins, I have written yet another tool.
The unused code detector finds Jenkins methods unused in Jenkins and in latest plugins, including potential usage in jelly. (Getters, setters, do*, deprecated methods and unit tests are ignored. Unused deprecated api is already reported here.)

Current result is that 184 Jenkins methods are never used. Perhaps, some of them could be deprecated or removed right away.
There are certainly false positives in the report, but I think that a majority is really dead code. To be sure that a method is never used, it's possible to grep all sources or to search in github directly.

If you are ok, the tool could be forked into jenkins-infra with a job in CI (If yes, I suggest a daily schedule.)

By the way, I have fixed a bug in the first tool above, there are in fact 560 plugins using a deprecated Jenkins api, not 430.

bye,
Emeric

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-dev+unsubscribe@googlegroups.com.

--
You received this message because you are subscribed to the Google Groups "Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-de...@googlegroups.com.

evernat

unread,
Jan 3, 2016, 7:33:19 AM1/3/16
to Jenkins Developers, m...@batmat.net
Hi all,

With help from Daniel, Tyler and Andrew, both tools are now in jenkins-infra with a job in CI

You can now see the list of unused methods in Jenkins api at:
https://ci.jenkins-ci.org/view/Infrastructure/job/infra_unused-code-detector/lastSuccessfulBuild/artifact/target/output.html

And the deprecated api used for each plugin is now at:
https://ci.jenkins-ci.org/view/Infrastructure/job/infra_deprecated-usage-in-plugins/lastSuccessfulBuild/artifact/target/output.html
The list of deprecated api which is probably not used in plugins is at:
https://ci.jenkins-ci.org/view/Infrastructure/job/infra_deprecated-usage-in-plugins/lastSuccessfulBuild/artifact/target/output.html#deprecatedApiNotUsed

I hope that it can help to reduce complexity in Jenkins api and perhaps fix bugs.

Happy new year !
Emeric

Jesse Glick

unread,
Jan 5, 2016, 11:35:34 AM1/5/16
to Jenkins Dev
Many thanks for your initiative on this. Since I will never remember
how to get to those URLs, could you make sure they are listed
prominently in wiki pages relating to core development? (If we have
any?!)
Reply all
Reply to author
Forward
0 new messages