Giter VIP home page Giter VIP logo

loctool's Introduction

LOCTool

LOCTool is a tool (in Java) that measures the physical length of a Java project. Source lines of code (SLOC), also known as lines of code (LOC), is a common software metric to indicate the efforts for developing and maintaining software.There are several tools (e.g. CLOC, pygount, Understand, etc.) that can measure LOC.

In this code, they are 5 metrics that are calculated:

  1. Total number of Java files This is calculated by reading all the file names that end with .java extension. They are stored in ** and this will give the value of total java files in any given directory.
  2. Total number of distinct java files To calculate the number of distinct files in the given directory, it need to evaluate the content in the files. Just measuring the size and name does not help. So SHA hashing is performed to generate the unique hash values of each file[1]. This hashvalues would be same for identical files. The identical files are not considered in this metric, just considering all the unique files based on their respective hash values serves the purpose.
  3. Total number of Blank lines in the distinct files This is obtained by trimming the lines and checking if they are empty.
  4. Total number of Comment lines in the distinct files Following all the comment conventions, the comment lines are considered. The comment lines that are appended with a code line are not considered.
  5. Total number of code lines in the file.
    Any line which is neither a comment nor a code line nor a blank line is considered as a code line in this scenario[2].
Sample output

Output_1

How to run the program:
(you need the Maven (3.6.3) and Java (13.0.2) versions)

  • Clean the project and generate an executable JAR with dependencies.
  • mvn clean
  • mvn install
  • Now, there should be a new folder called target and the executable JAR with dependencies named assignment-1.0.jar should be inside the target folder.
  • Now, run the jar file and get the results ๐Ÿ‘

References:
1.http://www.assafelovic.com/
2.http://www.stackoverflow.com/

loctool's People

Contributors

mutesham avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.