Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Search for commented-out code across files in Eclipse

Is there a quick way to find all the commented-out code across Java files in Eclipse? Any option in Search, perhaps, or any add-on that can do this?

It should be able to find only code which is commented out, but not ordinary comments.

like image 225
akjain Avatar asked Nov 10 '10 11:11

akjain


People also ask

How do I search across files in Eclipse?

The Eclipse search dialog box allows you to search for files that contain a literal or a character pattern in the entire workspace, a set of projects, a specific project or folders selects in the package explorer view. Clicking on the Search menu and selecting Search or File or Java. Clicking Ctrl + H.

How do I get code lines in Eclipse?

By default, Eclipse's editor will not display line numbers, it's no good for debugging. Here's a tip to show you how to turn on the “display line numbers” feature in Eclipse. In Eclipse IDE, select “Windows” > “Preference” > “General” > “Editors” > “Text Editors” , check on the “Show line numbers” option. See result.


2 Answers

Sonar can do it: http://www.sonarsource.org/commented-out-code-eradication-with-sonar/

like image 117
Oliver Avatar answered Oct 01 '22 04:10

Oliver


In Eclipse, I just do a file search with the regular expression checkbox turned on:

(/\*.*;.*\*/)|(//.*;)

It will find semicolons in

// These;

and /* these; */

Works for me.

like image 35
Scott Merritt Avatar answered Oct 01 '22 02:10

Scott Merritt