Code Monkey home page Code Monkey logo

git-stats-with-code-maat's Introduction

Git Stats with code maat

Table of Contents


การติดตั้ง maat command

เพื่ออำนวยความสะดวกในการใช้งาน เราสามารถสร้าง Command ของ code-maat ได้ดังนี้

เนื่องจากผมกำหนดแบบไฟล์ Bin ไว้ เพื่อไม่ลดความยุ่งยากในการกำหนด Path บนระบบ

  1. Copy โฟล์เดอร์ bin ไว้ที่เครื่อง ของผมจะไว้ที่ /Users/Username

  2. เข้าไปที่โฟล์เดอร์ Bin

    cd bin
  3. เปลี่ยน Permission

    chmod +x maat
    chmod +x merge
  4. สร้างหรือเปิดไฟล์ .zprofile หรือ .bashrc หรือ .bash_profile (ผมใช้ .zprofile)

       vi .zprofile
  5. กำหนด Path ใน .zprofile

       export PATH="$PATH:$HOME/Bin"
  6. Restart หรือ ปิด-เปิด Terminal ใหม่

เท่านี้ก็สามารถใช้งาน code-maat ได้แล้ว โดยใช้คำสั่ง maat แทนการเรียกใช้แบบ java -jar ไฟล์

maat -h

xlog-with-merge

เป็นไฟล์ Shell Script ที่เป็นชุดคำสั่งใช้ในการเรียกใช้งาน maat และ Merge csv ที่ทำขึ้นมาเพื่อความสะดวก

bash xlog-with-merge.sh before(YYYY-MM-DD) after(YYYY-MM-DD) : xlog 2018-10-21 2018-01-21"

ตัวอย่าง

bash xlog-with-merge.sh 2023-10-21 2023-01-21

การใช้งานแบบ ไม่ Setup maat command

คำสั่งในการดึงข้อมูลจาก Git และนำมาสร้างเป็น Report ด้วย Code-maat

Git log

git log --numstat
git log --all --numstat --date=short --pretty=format:'--%h--%ad--%aN' --no-renames --after=YYYY-MM-DD --before=YYYY-MM-DD > logfile.log
  • git legacy

    git log --pretty=format:'[%h] %aN %ad %s' --date=short --numstat --after=YYYY-MM-DD > logfile.log

Run code maat

  1. Help

    java -jar code-maat-1.1-SNAPSHOT-standalone.jar -h
  2. Analysis Options -a, --analysis

    abs-churn, age, author-churn, authors, communication, coupling, entity-churn, entity-effort, entity-ownership, fragmentation, identity, main-dev, main-dev-by-revs, messages, refactoring-main-dev, revisions, soc, summary

    • example

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a authors
  3. Run Code Maat

    1. Summary Data

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a summary
    2. Analyze Change Frequencies

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a revisions
    3. Calculate code age

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a age
    4. Mining logical coupling

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a coupling
    5. Code churn measures

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a abs-churn
    6. churn by author

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a author-churn
    7. churn by entity

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a entity-churn
    8. entity ownership

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a entity-ownership
    9. entity effort

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a entity-effort
    10. main developer

      java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a main-dev

Complexity and Frequency in Git

  1. Analyze revisions from logfile.log

    java -jar code-maat-1.1-SNAPSHOT-standalone.jar -l logfile.log -c git2 -a revisions > revisions.csv
  2. Analyze line of code with cloc

    • nodejs

      cloc ./ --by-file --csv --quiet --exclude-dir=node_modules --report-file=./lines.csv
    • .NetCore

      cloc ./ --by-file --csv --quiet --exclude-dir=bin,obj --report-file=./lines.csv
  3. Analyze complexity and frequency with merge_comp_freqs.py

    python3 merge_comp_freqs.py revisions.csv lines.csv > comp-freqs.csv

Ref: code maat

git-stats-with-code-maat's People

Contributors

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