Code Monkey home page Code Monkey logo

gitaligned's Introduction

Go Report Card go.dev reference codecov

gitaligned

Find out where you fall on the Open-Source Character Alignment Chart

Binaries available in releases.

If you prefer to install from source, run the following in your command line (requires Go)

go install github.com/soypat/gitaligned@latest

How to use (requires git)

Run gitaligned -h for help.

Running gitaligned in this repo:

gitaligned -u soypat

Output:

Author soypat is Neutral Good
Commits: 6
Accumulated:{-0.2 2}

Planned

Output:

Steve -- Chaotic Neutral (89.9% confidence)
  82 commits
  99 % Lean towards Chaotic
  10 % Lean towards Good

How it works (sort of)

For now gitaligned does some basic natural language processing using prose and has some ad-hoc rules based on typical git commit message mannerisms.

Opinions of commit messages and their alignment

Commit Message Alignment
Fixed bug Neutral Evil
Correct edge case in http response where long frames would overflow Lawful Good
Steve's parser was really bad. Optimize and now works with extended unicode Chaotic Good
Jacobian not singular True Neutral
f*cking BNF Chaotic Evil

"Good" commit messages seek to inform the reader of what changed and why.

"Evil" commit messages hide away what changed.

Author alignments on this repo

Author Alignment
soypat Chaotic Good
frenata Lawful Neutral

gitaligned's People

Contributors

frenata avatar soypat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

gitaligned's Issues

Allow passing log files directly instead of scanning

Hi there,

I want to try building a GUI for gitaligned to run against arbitrary projects for fun. However, cloning entire repositories just for their logs seems a little heavy-handed (even with the --bare flag). It would be nice if I could, for example, pull a list of commits from the GitHub API, massage it into the git log format and pass it to the program.

As far as I can tell, this would only require to expose this function on the command line:

func GitLogScan(r io.Reader) (commits []commit, authors []author, err error) {

Hope you consider it. Thank you.

gitaligned always crashes

panic: runtime error: index out of range [200] with length 200

goroutine 1 [running]:
main.walkCommits(0xc0001c6000, 0xc8, 0xc8, 0x11c5a70, 0x11b793e, 0x3)
	/home/pato/src/gitaligned/nlp.go:36 +0x5b0
main.SetAuthorAlignments(0xc0001c6000, 0xc8, 0xc8, 0xc0001ca000, 0x2, 0x14, 0x0, 0x0)
	/home/pato/src/gitaligned/align.go:51 +0x4f
main.run(0xc00003e748, 0x1724320)
	/home/pato/src/gitaligned/main.go:43 +0x2c8
main.main()
	/home/pato/src/gitaligned/main.go:48 +0x26

I get this whether I run without parameters, or with specifying a username, or -k or -y. I've tried it against two different repos, and it dies with exactly the same error, down to the length/index values. I tried it on a third repo and got a similar result but the index/length is 55 instead. And so on.

I've tried it on a bunch of repos and I've only gotten it to run on a handful.

I was able to get things working by creating a dummy repo with a couple empty commits:

git init .
git commit --allow-empty -m "Initial commit."
git commit --allow-empty -m "Hello, world."

I also got it running against a relatively trivial repo (19 commits, 1 author, no branches/tags), and a couple other repos that are mostly forks. For some reason though, any of the repos I'm actually primary contributor on it seems to really not like.

Allow specifying branch

First of all, great idea. :)

Second, I noticed once I ramped the -n flag up that the commit count is way higher than I expected, then I realized that the tool must be looking at all branches in the repo. Since I frequently use less than optimal commit messages while working on a branch before cleaning it up to propose a change, it'd be great to add a flag that allowed specifying the branch(s) to scan.

Crawl into directories to find multiple repositories

First off, this is awesome. Thank you for making the internet a better place by creating this fun tool. It made my day.

Just as an idea, what if we could have this take a directory, and then upon not finding a .git repo, crawl into the child directories and collect commits from any it finds and analyze them together. Just thinking about that since our teams are often working across many repos. Just a thought.

If I have some time this week, maybe I'll take a crack at it.

๐Ÿ˜

Evaluating a single commit does not seem to work

mshantz@kit-mshantz:~/code$ git log -1
commit b2fb39cf3eddfef3ea23a403d1c5b42b57f0c19b (HEAD -> blast-stats, origin/blast-stats)
Author: Mike Shantz <[email protected]>
Date:   Wed Oct 14 10:42:54 2020 -0400

    Track a series of blast stats in redis.
mshantz@kit-mshantz:~/code$ ~/gitaligned -b blast-stats -n 1
Author Mike Shantz is True Neutral
Commits: 0
Accumulated:{0 0}
mshantz@kit-mshantz:~/code$ ~/gitaligned -b blast-stats -n 1 -k
mshantz@kit-mshantz:~/code$ ~/gitaligned -b blast-stats -n 1 -y
Commit True Neutral
{+0 +0}
        track a series of blast stats in redis

In particular I would expect the output with -k and -y to be (respectively):

track a series of blast stats in redis
VB    DT NN     IN JJ    NNS   IN NN
Commit Neutral Good
{+0.225 +1}
        track a series of blast stats in redis

as seen in longer outputs.

This result was seen with v0.3.2 using the linux binary from WSL2 (Ubuntu), git version 2.25.1.

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.