Giter Site home page Giter Site logo

gerritstats's Introduction

GerritStats

This project provides tools to display statistics from a Gerrit repository. It generates output in HTML, CSV and plaintext formats.

The tool can be useful for analysing how efficiently code reviews are implemented in an organization, and how often cross-team code reviews are conducted.

There are two separate tools:

  • GerritDownloader, which downloads JSON data from the server
  • GerritStats, which parses the json output provided by GerritDownloader.

How to build

./gradlew assemble

How to execute

java -jar GerritDownloader/build/libs/GerritDownloader.jar

Lists all command line options for the data download tool.

java -jar GerritStats/build/libs/GerritStats.jar

Lists all command line options for the statistics generator.

How to execute: saving data locally

Fetching data from Gerrit can take a while. Use GerritDownloader to get the JSON output from the server so that you can parse it later:

java -jar GerritDownloader/build/libs/GerritDownloader.jar --server gerrit.instance.on.inter.nets --project YourProjectName --limit 7500 --output-file gerrit-json-out.txt

The above command will download all data from the given Gerrit server and given project, and store it in the given output file.

How to execute: plaintext output

Once you have the data, you can start to play around with the output. You can e.g. include only a particular set of developers, which can be useful when looking at e.g. team-level review practices.

java -jar GerritStats/build/libs/GerritStats.jar --file ./GerritStats/gerrit-json-out.txt --branches master --include [email protected],[email protected],[email protected],[email protected] --output-type plain

The above command will give you output as illustrated below:

[email protected]
  Commits: 1072
  Comments written: 748
  Comments received: 444
  Commit/comment ratio: 0.41417912
  Added as reviewer: 1939
  Review comment ratio: 0.38576585
  Avg. patch set count: 1.4906716
  Max patch set count: 11
  +2 reviews given: 944
  +1 reviews given: 1115
  -1 reviews given: 285
  -2 reviews given: 111
  # of people added as reviewers: 26
  Adds them as reviewers: [email protected] (900), [email protected] (875), [email protected] (1)
  They add this person as reviewer: [email protected] (300), [email protected] (217), [email protected] (1)

How to execute: CSV output

If you want to do some processing on the data with Excel or similar tools, a CSV format might be convenient for import.

java -jar GerritStats/build/libs/GerritStats.jar --file gerrit-json-out.txt --branches master --include [email protected],[email protected],[email protected] --output-type csv

The output of the command looks like this:

Project: all data from file /Users/holmsted/dev/GerritStats/out-.txt
Branches: master
From: 2014-10-23
To: 2015-08-21

Identity	            Commits	Comments written	Comments received	Commit/comment ratio	Added as reviewer	Review comment ratio	Avg. patch set count	Max patch set count	+2 reviews given	+1 reviews given	-1 reviews given	-2 reviews given	# of people added as reviewers
[email protected]	     80	               1	               14	            0.175000	              335	            0.002985	            1.487500	                 8	             35	             100	             5	             1	                                   18
[email protected]	      8	               4	                2	            0.250000	              167	            0.023952	            1.250000	                 3	             23	              23	             6	             0	                                    6
[email protected]	     50	               8	                7	            0.140000	              366	            0.021858	            1.760000	                 5	            101	              77	             7	             9	                                   11
[email protected]	    276	              19	               57	            0.206522	             1377	            0.013798	            2.246377	                13	             174	         225	            17	             8	                                   27
[email protected]	   1293	             328	              257	            0.198763	             2537	            0.129287	            1.486466	                11	            1231	        1330	           384	           136	                                   26

How to execute: HTML output

The default output of the tool is HTML.

This will generate a set of HTML files that include graphs and charts, such as a proximity graph of the developers, based on how many review comments they write to each other, as well as a per-developer page that lists all their review comments and links back to the reviews.

java -jar GerritStats/build/libs/GerritStats.jar --file gerrit-json-out.txt --branches master --include [email protected],[email protected],[email protected] --list-commits-exceeding-patch-set-count 5

The index page will provide you with a sortable overview table of some of the core statistics, similar to the plaintext CSV output.

Overview table of all developers

The index page also contais a graph that illustrates how developers are connected to each other:

Proximity graph for the given branch and given set of identities

And on the per-person page, you'll see a chart of review comments per day, a configurable list of commits that have a high number of patch sets, et cetera:

Review comment statistic written by a developer

gerritstats's People

Contributors

holmari avatar sschuberth avatar haraldf avatar

Watchers

James Cloos avatar  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.