Case Study: How to Evaluate Code Quality in Bitbucket

March 21, 2018
#Case Study#Analytics#How To#Bitbucket
7 min

This plugin helps us in Code Frequency to evaluate code quality and project history. Contributors evaluate the code committed by each person in a sprint and we use the Activity stream to show all commits and pull requests of the selected time span as the activity stream with links to associated Jira issues, subtasks, and backlogs.

Hemanth Dharavath, Apptium

Apptium Technologies, our customer, is a technology and management consulting company that helps global broadband, wireline, and wireless communications service providers boost their productivity. This company has offices in the USA, Canada, and India.

The team of Apptium Technologies actively uses Atlassian Bitbucket for team collaboration. This way they can build and ship software to their clients that use Apptium application as Platform as a service (PAAS). They decided to extend the Bitbucket Server functionality by installing our Awesome Graphs app.

In fact, our customer has around 25 projects going parallel. Each project has its own dev, QA, production environments with around 15 repositories. All team members use the Awesome Graphs app to track and monitor their projects and repositories with visualized statistics.

Let’s see what features and capabilities of this app the Apptium team uses most.

Activity tracking and reporting

As an Agile software development team, Apptium wants to track down issues and daily updates of the tasks assigned in their sprints. For instance, to achieve this goal, they use the Activity graph. It shows the existing commits and pull requests through the selected time span at the project level, featuring activity in all project repositories.

activity tracking and reporting in Bitbucket

Moreover, our client can also check the activity stream with the links to the associated Jira issues, sub-tasks, and backlogs. This way, they can easily track daily updates for their current Jira tasks.

Contribution tracking

The Contributors graph helps the Apptium team to evaluate the code committed by each person in a sprint. They can compare the input from different team members with a help of a summary graph of the contributions made by all developers. In addition, they evaluate the number of commits and lines of code added and deleted by each developer.

teams performance monitoring in bitbucket

Using this graph, the Apptium team can monitor the team’s performance and analyze the critical points throughout the year.

Code quality analysis

The Code Frequency graph allows Apptium to evaluate the project history and code quality. The team members can watch the dynamics of their projects in terms of lines of code.

how to evaluate code quality

As a result, the Apptium team can have a birds-eye view of the whole project from its start to the current week in one graph.

Commit frequency evaluation

Apptium Technologies also uses the Commits graph to pull out the report on commits made to repositories every week (each bar represents one week). So they can compare their estimates with the real work done and plan their work on the projects ahead.

commit frequency in Bitbucket

This useful graph provides our client with an overview of their team activity.

Challenges and benefits

Awesome Graphs for Bitbucket allowed the customer to get the detailed visualized statistics of their team performance and address the following challenges:

  • analyze the critical points along the year
  • track activity and progress of the team
  • watch their projects evolve
  • capture trends and identify bottlenecks

Apptium Technologies now can rapidly evaluate the performance of their development, QA, and production teams. The insights they receive using our handy tool definitely help them deliver the best service to their customers all over the world.

Read more case studies to see how our customers benefit from using Awesome Graphs for Bitbucket in their work:

Try Awesome Graphs for free

Related posts

    Awesome Graphs: Analysis of Pull Requests’ Resolution Time

    January 16, 2018
    #How To#Bitbucket
    2 min

    Due to numerous requests of our clients (to which our team DOES always listen!), we have added a “Resolution Time Distribution” report in Awesome Graphs for Bitbucket Server and Data Center.

    Code reviews help developers not only to improve the quality of applications and save money but learn from one another. Next time, every teammate can do better.

    Bitbucket Server allows you to perform code reviews without in-person meetings. Teammates’ responses are recognized with the help of pull requests.

    Our new report lets you analyze pull requests’ resolution time within your project. You will be able to:

    • see how long it takes to resolve pull requests;
    • predict resolution time of future pull requests;
    • spot what pull requests had the shortest or longest resolution times.

    Resolution Time Distribution Report

    For a better understanding of all the benefits, we suggest you watch a short video:

    When forming a report, you can set a time period and the type of pull requests – merged or declined. Time distribution varies depending on the status.

    Another useful feature is choosing the destination branch of pull requests. Then, you are able to evaluate work of your code reviewers and determine what parts of the project may cause delays.

    We always appreciate feedback from our customers, so if you have any suggestions or questions, please, contact us.

    Related posts

      Top 5 New Add-ons for Atlassian Dev Tools – First Quarter 2016

      May 19, 2016
      #News
      2 min

      As usual, our team keeps track of what’s new on the Marketplace for Atlassian Dev Tools and every quarter shares the selection of top 5 new add-ons. If you haven’t read earlier posts in this series, you can take a look at:

      So let’s see what new plugins Bitbucket and Bamboo users can try to add even more value and functionality to their code management and continuous integration platforms. From 9 new add-ons for Bitbucket and 17 new add-ons for Bamboo that appeared on the Marketplace in January-March 2016 we thought the following 5 would be the most useful for our readers:

      Continue reading “Top 5 New Add-ons for Atlassian Dev Tools – First Quarter 2016”

      Related posts

        How to mirror Bitbucket Cloud and GitHub repositories to Bitbucket Server / Data Center

        October 8, 2015
        #How To#Bitbucket
        13 min

        Visualize, track and analyze repositories hosted in Bitbucket with Awesome Graphs. Benefit from what graphs, charts and reports can tell you. Learn more

        When working on our add-ons, we at Stiltsoft use Bitbucket Data Center for distributed version control management and code collaboration. Some of you have also picked Bitbucket Server / Data, and others went with another solution, e.g., Bitbucket Cloud, GitHub, or are using several platforms at once. Whatever tool you work in, mirroring repositories can come in useful in some instances. That is why we posted the article that covered the benefits and how-tos about mirroring remote repositories from Bitbucket Data Center and Server. Meanwhile, creating mirrors in Bitbucket Bitbucket Server / Data Center rather than mirroring from it might be more relevant for some of our blog readers, so today’s post is about that.

        Benefits

        There’s a number of goals that can be attained by mirroring repositories from Bitbucket Cloud or GitHub to Bitbucket Server / Data Center. Among them:

        • protecting yourself from downtime when Bitbucket Cloud or GitHub are unavailable
        • consolidating repositories in one place
        • facilitating the process of migration from Bitbucket Cloud or GitHub to Bitbucket Server / Data Center

        How to mirror Bitbucket Cloud repositories

        To arrange automatic update of mirrored repositories you can:

        • Use an add-on for Bitbucket Server
        • Use a Continuous Integration tool
        • Use an OS job scheduler

        In our examples, we’ll be mirroring a Bitbucket Cloud repository to Bitbucket Server / Data Center.

        Use an add-on for Bitbucket Server / Data Center

        ScriptRunner for Bitbucket can come in handy when you are looking to mirror some or all of your Bitbucket Cloud repositories to Bitbucket Server / Data Center.

        It’s very simple.

        • Once the add-on is installed, navigate to Bitbucket Server / Data Center Administration and select Built-in Scripts in the Script Runner Section.
        • There, choose Mirror Bitbucket Team. You can mirror repositories both from team and user Bitbucket Cloud accounts.
        ScriptRunner-Built-in-Scripts
        • Enter your Bitbucket Cloud Team or User, select the target project in Bitbucket Server / Data Center, provide your Bitbucket Cloud user credentials.
        ScriptRunner-Mirror Bitbucket Team
        • Select one of the synchronization options (none, install hook or poll). If you choose:
          • ‘install hook’, Bitbucket Cloud will call your Bitbucket Server / Data Center instance when there are changes in repositories which will trigger synchronization
          • ‘poll’, each remote repository will be polled every 5 minutes
          • ‘none’, there will be no synchronization performed
        • In the Regex field, there is the ‘.*’ regular expression by default. If you leave it as it is, all repositories will be mirrored from your Bitbucket Cloud. To filter the set of repositories, insert a corresponding regular expression. The regular expression is done against the repository name, e.g. for the repository ‘StiltSoft Test’ you could use:
        •  
        .(?=.\bStiltSoft\b.)(?=.\bTest\b.).
        • Another useful feature. If you’d like new Bitbucket Server / Data Center repositories to be created and synchronized when there are newly-added remote repositories in Bitbucket Cloud, mark the ‘Sync new’ checkbox.
        • When all set, click Run. You’ll see the table with the repositories that are being mirrored. Initially there’s the ‘Create’ label. When the process is completed, it will say ‘Exists’ instead. You may tail the application log file to track the progress.
         ScriptRunner-Mirror Bitbucket Team
        • Once local repositories are created, you can refer to the Configure Mirrored Repositories in Built-in Scripts to view and check the status of your mirrored repositories and change the synchronization type.

        Use a Continuous Integration tool

        If you have some Continuous Integration solution, e.g. TeamCity, in your arsenal, you can use it. Here is one of the options for how to set up automatic update of mirrors in Bitbucket Server / Data Center using TeamCity.

        • To use SSH-authentication, copy a SSH key from the TeamCity server with a build agent you’ll be using. Then add this SSH key in your Bitbucket Cloud and Bitbucket Server / Data Center account settings.
        • Then you need to create a repository in Bitbucket Server / Data Center
        • After that, create a local copy of source repository on build agent (don’t forget to add Bitbucket Server / Data Center repository as remote):
        cd /home 
        mkdir mirror
        cd mirror
        git clone git@bitbucket.org:kkolina/demonstration-repository.git
        cd demonstration-repository
        git remote add bitbucket ssh://git@stash2.stiltsoft.com:7999/adp/demonstration-repository.git

        Now you should make some changes in build configuration in TeamCity:

        • Add a Command Line Runner build step with a script for updating mirrored repositories that will run every time this build step is invoked.

        Example of the script:

        cd /home/mirror/demonstration-repository 
        git pull
        git push --all bitbucket
        git push --tags bitbucket

        You may also add a VCS Trigger that will add a build to the queue when a VCS check-in is detected in the repository you are mirroring.

        • Before adding a trigger, you should attach a VSC root in the Version Control Settings:

        With the URL of the original repository and Bitbucket Cloud authentication settings:

        • Now you can add a VCS Trigger:

        Use an OS job scheduler

        You can also use OS job schedulers (Cron, Windows Task Scheduler) and configure an external job and schedule the launch of scripts that will be pulling changes and pushing them to a mirrored repository.

        • First we clone a repository:
        cd /home/mirror 
        git clone git@bitbucket.org:kkolina/demonstration-repository.git
        cd demonstration-repository
        git remote add bitbucket ssh://git@stash2.stiltsoft.com:7999/adp/demonstration-repository.git
        • If you use Cron, you’ll need to add a command in your crontab file that will run periodically on a given schedule and will be updating mirrored repositories, e.g.:
        0 0 * * * root /home/mirror/update_repos.sh 

         

        This command will run from the user ‘root’ every day at midnight and trigger a script that has a number of commands to perform update of mirrored repositories.

        For the case when you have one mirrored repository that should be updated, the content of ‘update_repos.sh’ will look like this :

         #!/bin/bash 

        cd /home/mirror/demonstration-repository
        git pull
        git push --all bitbucket
        git push --tags bitbucket

        If you need to mirror more than one repository, include 4 commands you can see above for each repository in ‘update_repos.sh’.

        Top 5 New Add-ons for Atlassian Stash – Second Quarter 2015

        July 21, 2015
        #News
        8 min

        Following the posts about new add-ons for Confluence and JIRA of the second quarter of 2015, today’s article will highlight top 5 new add-ons for Atlassian Stash, which our team considered to be the best products for Stash from those appeared on the Marketplace in April-July 2015. By the way, you can also check out our April post about new add-ons for Stash of the first quarter.

        Top 5 new add-ons for Stash:

        You’ll learn about the problems the add-ons are meant to solve, potential benefits for you and pricing.

        1. Editor for Stash

        With Editor for Stash you can edit your files right in Stash and avoid going through the whole Git workflow.

        It allows previewing markdown before committing, works in your browser and doesn’t require cloning or editor.

        Code folding and syntax highlighting are supported. When done editing, you can choose whether to commit directly into the branch or to create a pull request.

        Other benefits:

        • Completely server-side
        • Support for Github Flavored Markdown
        • Configurable: direct commit privileges can be turned on or off on a per repository basis.
        • Support for personal repositories.

        Pricing: A commercial license for Editor for Stash costs 160$ for 50 users (80$ for 25 users; 300$ for 100 users).

        Try it

        2. Pull Request Notifier for Stash

        Pull Request Notifier can invoke one or several custom URLs when a pull request event is triggered. There can be different URLs for different repositories with filters. URLs are highly configurable with various variables and 2 fields to construct a filter (filter string and filter regexp). You create a string with variables and add a regexp. When the regexp matches the text, the notification is triggered. It can, optionally, add HTTP Basic Authentication headers when triggering URL.

        Pricing: Pull Request Notifier for Stash is free.

        Try it

        3. Search for Stash

        Search for Stash is a powerful full-text code, commit and file search tool for repositories powered by a built-in Elasticsearch node that uses Query String Syntax.

        It includes support for wildcards, regular expressions, fuzziness, and more.

        You can filter search results to:

        • only code, commits or file names
        • specific projects
        • certain slugs
        • certain refs
        • certain file extensions
        • a specific author
        • a certain date range

        It’s possible to search globally through the Codesearch toolbar, or search in a specific project or repository by using the Stash toolbar on the left sidebar.

        The add-on doesn’t require external servers or services, provides analytic search with search statistics.

        Pricing: A commercial license for Search for Stash costs 400$ for 50 users (150$ for 25 users; 800$ for 100 users).

        Try it

        4. ScriptRunner for Stash

        ScriptRunner for Stash helps ensure a good quality of merges, encourage following best development practices. It allows global administrators to apply hooks, merge checks, and event handlers for workflow automation and customization.

        Most of them can be used with conditions for you to have more flexibility and control. Conditions can be added to all or selected repositories.

        With this add-on you can set default and mandatory approvers for pull requests, prevent undesired events by providing abilities to:

        • stop developers pushing changes on behalf of someone else
        • stop change sets being pushed directly to your release or master branches
        • stop deletion of your release tags by mistake
        • ensure feature changes are associated with a JIRA issue through both scripted conditions and extended JQL queries
        • block pushes to your release branches after it has been frozen

        It also includes administrative scripts that allow to:

        • mirror all commits and tags from GitHub and BitBucket to Stash (for you not to be dependent on GitHub and BitBucket being available at all times, or to migrate repositories from GitHub or BitBucket to Stash)
        • switch to a different user (e.g. to reproduce a problem a user is telling you about, merge a pull request on behalf of another user)

        Pricing: A commercial license for ScriptRunner for Stash costs 330$ for 50 users (180$ for 25 users; 600$ for 100 users).

        Try it

        5. All Pull Requests

        All Pull Requests allows displaying all pull requests for all available projects or only for a specific project. It can be useful when you need to see pull requests on a project or cross-project level.

        It includes the Mergeability column that displays as an icon the information about what is blocking the merge operation:

        • insufficient branch permissions
        • not all required builds are successful yet
        • requires approvers
        • resolve all merge conflicts first
        • requires all tasks to be resolved

        Pricing: All Pull Requests is free.

        Try it

        Related posts

          Top 5 New Add-ons for Atlassian Stash – First Quarter 2015

          April 15, 2015
          #News
          9 min

          This is the final post in the series ‘Top New Add-ons for Atlassian Products’. In the last 2 weeks I went over new add-ons for Confluence and JIRA. Today I’d like to highlight top 5 new add-ons for Atlassian Stash, which our team considered to be the greatest products for Stash among those appeared on the Marketplace within the first quarter of 2015.Top 5 new add-ons for Stash:

          You’ll learn about the problems the add-ons are meant to solve, potential benefits from using them and pricing.

          1. Smart Commits for Stash

          Smart Commits for Stash brings in the long-awaited functionality that a lot of Stash users had been asking for. It allows you to simplify the workflow and keep your JIRA projects up-to-date with the development flow. This add-on provides Git repository contributors with a way to perform certain JIRA and Stash actions by embedding commands into commit messages.

          An action is executed if a changeset is pushed to a remote repository located in Stash. Once a changeset is received in Stash, it is parsed according to specific keywords and provided parameters. If data is valid, a requested action is executed. A single commit can define one or multiple actions, which once performed are logged with warning, information or error messages.

          Supported actions:

          • creating comments for JIRA issues and/or Stash pull requests (#comment This is my example comment)
          • logging work on an issue (#time 2d 5h 30m)
          • adding reviewers to pull-requests (#reviewer @user1 user2)
          • transitioning an issue to a different JIRA workflow status (#resolve)
          • creating pull-requests to given branches (#pull master)
          • reviewing pull request approvals: keeping approvals or unapproving pull requests (#keep/ #unapprove)

          Pricing: Smart Commits for Stash is free. Try it

          2. The Tag Maker

          The Tag Maker lets you create Git tags directly in Stash. It’s simple, but so useful as makes your life a bit easier. To create a tag, it’s necessary to click ‘Tag this commit’ in the commit overview. Then you fill in a tag name and description and it’s done. A tag is created. Besides creating tags, this add-on allows:

          • Viewing a list of tags (with tag name, a tagger and date of tag creation)
          • Deleting tags
          • Editing tag messages
          • Moving tags

          Pricing: The Tag Maker is free. Try it

          3. File Hooks Plugin

          File Hooks Plugin arms you with a tool to prevent commits containing files non-compliant with your guidelines of naming files and admissible file size from getting pushed into Git repositories, which helps you have your repositories content in line with your company standards.

          This plugin adds two configurable pre-receive hooks available in repository settings, File Size Hook and File Name Hook. When these hooks are enabled and configured, file attributes (size, name) are being checked while pushing commits. Commits with non-compliant files get rejected.

          • In File Size Hook you can have up to 5 hooks with a pattern (regular expressions) and a file size limit. Commits with files matching one of these hooks are rejected. This way large files, e.g. videos, high resolution images, can’t be committed. In the screenshot below you can see the hook with which all files larger than 1MB (1048576 bytes) will be rejected.
          • In File Name Hook, it’s possible to specify a regular expression for a file name and a folder name. Commits with files matching the pattern get rejected.

          Pricing: File Hooks Plugin is free. Try it

          4. Repository Templates for Stash

          With Repository Templates for Stash you can set up repository templates with configured repository settings and content. Later on you can use them to create new repositories with predefined settings and content.

          How does it work?

          To create a template, configure settings of any repository in a project the way you want them to be in your template. While doing that, you can:

          • configure hooks, branching model, repository and branch permissions, pull request and repository details settings
          • add common files (e.g., README, LICENSE, .gitattributes) and common branches (e.g., develop and master)

          Then navigate to Repository Templates in Project Settings and define:

          • which settings should be applied to new repositories
          • which repository should be used as a default template for all newly created repositories in this project (or allow users choosing what repository to use as a template when creating new repositories)
          • if the settings of repositories associated to a template should be automatically periodically reset according to the settings of the template, which allows you to manage settings centrally

          A new repository created based on a default or chosen template automatically gets settings and content of that template.

          Pricing: Repository Templates’ commercial license costs 80$ for 50 users (40$ for 25 users; 200$ for 100 users). Try it

          5. Pull Request Filter

          Pull Request Filter enables filtering open, merged and declined pull requests to view only those relevant and needed at the moment. There are various filters available. And it’s possible to apply one or several of them at a time. Your filtration results are displayed as a list, which has maximum 100 pull requests.

          Filtering options include filters by:

          • State
          • Author
          • Number of approvals
          • Destination
          • Title (by words or wildcards)
          • Description (by words or wildcards)
          • Date range or a specific date

          Pricing: Pull Request Filter is free. Try it

          Related posts