Find number of lines in a project in eclipse? - eclipse

Is there a pluging/feature to count the number of lines in a project?

This may be what you're looking for: http://metrics2.sourceforge.net/

A very simplistic way is to do a regular expression search for '\n' in your project. It will give you a good idea on the number of lines in your project without installing any extra plug-ins.

Instead of installing a new eclipse plugin; If you are on a linux system:
cd to the eclispe project source directory(workspace/project-name/src)
and enter in termianl:
wc -l *.java
This will show you total number of lines as well as number of lines in each file

A quick way to do it is based on this tutorial I found: http://stephendnicholas.com/posts/eclipse-quick-line-count
To summarize, do the following (to use search in Eclipse press Ctrl+H):
Find the total amount of lines: Search your code for \n using 'regular expression' under your code files (e.g. if you develop in java only then search only *.java files).
Find the total amount of blank lines: Search your code for ^\s*\n
Find the total amount of commented lines: search your code for //.*(\n{1})?
Finally: Get the total amount of lines of code by subtracting 2 and 3 from 1.

Related

Search in VS Code for occurrences of term greater than N

Here's an example:
My search term is myTermABC
I have 100 files in my project
10 files contain myTermABC
Only two of those files contain myTermABC more than once (the other 8 contain it only once)
I only want VS Code to return the two files that contain myTermABC more than once.
How to do this?
Is this even possible?
Maybe there's an extension that enables this functionality?
In vscode search across files you have to specifically tell it to include newlines. The dot doesn't do this in a search in vscode.
So this find should work: (myTermABC[.\n]*){2,}

In BBEdit, how can I search for a pattern and then copy all the lines found with that pattern?

In BBEdit (11.6.9), using find with grep checked on I'm looking for lines in a large file containing this pattern:
registeredTd="11/\d\d/2017
It stands for a registered date of November, 2017 in my file.
If I "find all" I get correctly see 69 occurrences of the pattern in the file i the results window.
But how, then, can I copy those found lines?
I can copy the results of the results window itself, but that copy (1) contains extra junk at the beginning and most importantly (2) does not contain the complete line. The lines in the result window are truncated.
Is there a way of copying all the complete lines containing the pattern?
Thanks,
doug
For what it's worth, the answer to this was to use the Text > Process Lines Containing... menu. There you can enter the same registeredTd="11/\d\d/2017 search parameter, and there is a checkbox option to copy the lines with the search results. It works perfectly.

Eclipse navigator and project explorer sort the numbers in files names wrong

For instance, when I have the following files:
pro0.cpp
pro1.cpp
pro2.cpp
pro3.cpp
pro10.cpp
pro11.cpp
I expect to see them in the above-mentioned order. But Eclipse would sort them like the following:
pro0.cpp
pro1.cpp
pro10.cpp
pro11.cpp
pro2.cpp
pro3.cpp
I made a lookup but I failed to find any related information about that issue. Is not it an issue at all? Or did this problem only occurred to me?
This is working as intended. These views just sort the file names using the result of the Java String.compareTo method. This just compares the strings character by character left to right. It does not try and look for numbers in the strings. This gives the result you see.
Some file viewers (macOS Finder for one) do look for numbers in the file names and sort using the whole number. This is quite a bit more complex and the Eclipse views don't try to do this.

how to find the number of lines which got changed from one label to another in clear case?

I would like to find the number of lines of code which got added/modified/deleted between two releases. I have a label which is applied at the end of release.
There is ClearCase Report Viewer which shows list of elements which got modified between two labels. But I am looking for number of files which got changed.
Any solution to this?
The easiest way (without involving any commercial third-party tool) is to use linux commands diff and diffstat and apply it to two dynamic views, each one with their own config spec selecting a label:
element * LABELx
element * /main/LATEST
That way, you can get a full report of the differences between the two diffstat reports.
See "Difference between two versions in ClearCase dynamic view" for a concrete example.
diff -u /view/VIEW1/SOMEVOB/some/dir /view/VIEW2/SOMEVOB/some/dir | diffstat
Note: this is valid for Windows as well, since any Git distribution includes diff.exe, and diffstat is available for Windows.

Number of lines in Parsed file by PMD

I am using PMD for the first time. So I am not very sure about all the usage of it.
My goal is to find the total number of lines in all the files which are parsed by PMD.
Is there any way I can achieve that?