Inspiration

GitHub's language bar was the spark. That thin bar fully of colors that represent the languages we love! I though "It MUST be in Bitbucket" so I started to code... After that I realize that there are others great features, like GitHub Insights, that are awesome and are not available for Bitbucket users so I thought that I would be a good idea to bring also those features to the blue platform... and here I am :D!

What it does

At the moment, it can show you the number of commits, number of contributors and the programming languages distribution of your repo in the overview page. Also the add-on adds a new page named "Contributors" that you can use to see graphs related to commits over the time.

How I built it

I developed (Using the atlassian-connect-express getting started guide) a backend to handle basically two requests: the overview panel and the contributors page. It's data is fetched from the repository itself using this procedure: the repo is cloned it into my server (Using an OAuth token exchanged for the JWT) and then two open source ruby libraries are used to crunch data from it, github-linguist for programming languages and git_stats for git statistics. Then the data is presented in views designed with the aui style guidelines.

Challenges I ran into

Mainly speed: cloning the repo is an expensive operation so It slow down the entire workflow. I tried to make most parallel operations as possible using JS Premises and that seems to speed up the all thing a little bit. Handling concurrent requests over the same repo was also a challenge that I was able to solve using this amazing project https://github.com/Wizcorp/locks.

Accomplishments that I'm proud of

  • The improvement of performance making most parallel operations as possible.
  • The handling of concurrent requests over the same repo
  • The add-on style that shows data as we are use to see in GitHub but follows aui design guidelines at the same time

What I learned

  • Atlassian Connect Express framework
  • Plot.ly (I tried xD)
  • A bit of Ruby

What's next for GitHub Code Stats for Bitbucket

  • More features:

    • Show files for each language
    • Add more insight graphs (Code frequency, Punch card, etc)
    • Allow users to filter and zoom on insight graphs
    • Fetch Bitbucket user of emails associated to commits (Tried for this submission but I couldn't find a way to get a user from it email (Having in count that there are Bitbucket users who have more than one email (alias)))
    • Provide a mechanism to store repo's cache in a custom server (for privacy matters)
  • Find a way to efficiently handle big repos (Those which takes more than 2 minutes to clone)

  • Improvements on client-side performance

  • Better error handling

Built With

Share this project:
×

Updates