Code Monkey home page Code Monkey logo

gitcommitsanalysis's Introduction

GitCommitsAnalysis GitHub top language GitHub GitHub last commit

This tool can be used to generate a report showing the temporal distribution of you commits and the size and complexity of the codefiles in a Git repository.

Motivation

The inspiration for this tool is this YouTube video: Adam Tornhill - Seven Secrets of Maintainable Codebases. In the video he shows how to do a temporal analysis of your codebase to determine hotspots and candidates for refactoring.

By combining the number of lines of the code files with the number of commits and the cyclomatic complexity, you can identify codefiles that are candidates for refactoring. The ideas Adam Tornhill is presenting is that:

  • If a codefile is long (has many lines of code) then there is a good chance that it should be refactored into smaller pieces.
  • If a codefile has a large cyclomatic complexity value, then there is a good chance that it should be refactored into multiple pieces with more specific responsibilities.
  • If a codefile is changed often, then it is probably an important part of the business logic of the codebase.
  • If multiple codefiles are changed on the same dates, then they are probably tightly coupled and maybe share functionality that could be extracted into a super class shared by the candidate files.

By combining the factors you can identify the candidates where refactoring would improve the quality of your codebase the most.

The tool

The tool is a command line tool that generates a report in one of the formats:

  • HTML
  • Excel
  • Markdown
  • Text
  • Json (A dump of the collected data. Could be used as input for other tools)

The HTML report is the most detailed with various charts visualizing the statistics.

Commandline parameters

GitCommitsAnalysis 1.0.0
Copyright (C) 2019 GitCommitsAnalysis

  -r, --rootfolder             Required. The root folder of the application
                               source code

  -o, --outputfolder           Required. The output folder where the generated
                               reports will be placed

  -a, --reportfilename         The filename the report(s) will be given

  -f, --outputformat           Required. The output format(s) to generate.
                               Multiple formats should be space-separated. Eg.
                               '-f Text Json'. Valid formats: HTML, Markdown,
                               Json, Text, Excel

  -n, --numberoffilestolist    (Default: 50) Specifies the number of flies to
                               include in the list of most changes files.
                               (Ignored when output is Json)

  -t, --title                  (Default: GitCommitsAnalysis) The title to appear
                               in the top of the reports

  -i, --ignoredfiletypes       The file types to ignore when analyzing the Git
                               repository.. Eg. '-i csproj npmrc gitignore'

Credits

The calculation of the Cyclomatic Complexity i found over at Jakob Reimers ArchiMetrics repository.

Contributing

Any ideas, bug reports or help building this tool, is greatly appreciated. Have a look in the Contributing file about how to help.

Screenshots

Html report

Html report

Html report

Html report

Packages used

CommandLineParser NuGet package for parsing the commandline parameters and generating the help page.

LibGit2Sharp for reading the Git repository.

Newtonsoft.Json for generating the Json dump of the analysis data.

EPPlus for generating the Excel report.

TypeScriptAST for counting methods and functions in Typescript files.

Google charts for displaying the pie chart and the scatter charts in the HTML report.

Bootstrap for styling the HTML report.

jQuery used by the HTML report.

FontAwesome used to add icons for the file changes.

gitcommitsanalysis's People

Contributors

coderallan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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