Sei sulla pagina 1di 11

Integration with an Issue Tracking System in PhpStorm

Tweet
Working on a project often means working with issue tracking. There are various issue tracking systems out there: YouTrack, JIRA, FogBugz
and more. Many projects use the issue tracker which comes with GitHub. PhpStorm comes with built-in support for many of these issue
trackers. It even provides "generic" issue tracker integration which provides integration with other issue trackers like Drupal's. In this tutorial,
we'll explore how we can work with issue tracking systems in PhpStorm.
Introduction to Working with an Issue Tracking System in PhpStorm
Enabling Integration with an Issue Tracking System
Enabling Integration with a Specialized Issue Tracking System
Linking Issues with Source Control
Enabling Integration with a Generic Issue Tracking System
Working with tasks

Introduction to Working with an Issue Tracking System in PhpStorm


Let's start with a quick introduction. We can setup issue tracker integration through Project Settings | Tasks | Servers. Clicking the green + butto
n to add an issue tracker, we can see PhpStorm comes with many supported issue trackers out-of-the-box.

Once an issue tracking server has been added, we can browse our list of issues, correlate VCS commits with issues and tasks, create new tasks
and so on. The Tools | Tasks & Contexts | Open Task... menu or the Alt+Shift+N keyboard shortcut will list available tasks and provides the
starting point to creating a new task.

When we select a task (or press Enter), we are asked if we want to clear the current working context. If our project is connected to a VCS, the
IDE will suggest creating a new branch to work on the task.

We can make our changes and commit them to the VCS. Note that PhpStorm will automatically populate the commit message with the task id and
description (if enabled in the settings, more on that later).

Once work on the task is completely finished, we can use the Tools | Tasks & Contexts | Close Active Task... menu (Alt+Shift+W). This will
close the current context in the IDE and, when we tick the checkboxes, commit changes and optionally merge the branch that was created.

In the next sections of this tutorial, we'll dive deeper into how we can connect to the various issue trackers and how we can work with tasks.

Enabling Integration with an Issue Tracking System


PhpStorm supports many issue tracking systems out of the box. Supported issue tracking systems provide similar configuration options: we
typically have to specify how we want to connect to the issue tracker system as well as how we want our commit messages to be formatted.

Enabling Integration with a Specialized Issue Tracking System


PhpStorm comes with specific support for YouTrack, JIRA, Lighthouse, Pivotal Tracker, Redmine, GitHub, Trac, FogBugz, Mantis and Assembla.
For other issue trackers, check #Enabling Integration with a Generic Issue Tracking System.
Issue tracker integration can be configured through Project Settings | Tasks | Servers node. After clicking the green + button in the tool bar, we
can select the type of issue tracker we want to connect to. Depending on the issue tracking system selected, the configuration details that are
required will be different.
The following example lists settings for connecting to a YouTrack server

The YouTrack provider comes with completion for fields and values in queries.

More information on connecting to YouTrack and the various configuration options can be found in the YouTrack documentation.
The following example lists settings for connecting to a GitHub issue tracker

Once we entered the connection details, we can click the Test button to check connectivity with the issue tracker.

Support for additional Issue Tracking Systems is available via plugins.

Linking Issues with Source Control


In the #Introduction to Working with an Issue Tracking System in PhpStorm, we have seen we can link the issue tracker with our version control
system (VCS): the id and description of the active task will be used as the commit message when committing to source control.
We can configure if the commit message should be automatically populated and what the format should be by clicking the Commit Message tab in
the issue tracker server configuration:

Check the web help for more information about the available placeholders.

Enabling Integration with a Generic Issue Tracking System


When working with an issue tracking system not specifically supported by PhpStorm, adding a generic issue tracker. This generic connector
connects to many other issue tracking systems but requires a bit more configuration.
Let's add the Drupal.org issue tracker using the generic issue tracker support. After opening the Project Settings | Tasks | Servers, click the
green + button or press Alt+Insert (CMD+N on Mac OS X). As the issue tracking system, select Generic.
On the General tab, we can add https://www.drupal.org/ as the server URL. Since this server is public, we can tick the Login Anonymously checkb
ox, too.

For generic issue trackers, we will have to configure several other options on the Server Configuration tab. For starters, we will have to specify the
URL to the issue list. For Drupal, we can enter the path to the issue tracker (using {serverUrl} as a placeholder for the previously configured
server URL). This could be:
All open issues: {serverUrl}/project/issues/search/?status=Open&priorities=All&categories=All
All issues assigned to me: {serverUrl}/project/issues/search/?assigned=YOUR DRUPAL.ORG USERNAME&status=Open&priorities=All&
categories=All
We also have to specify the data type (in this case, "text" as our data is free-format HTML) and a regular expression to filter out issue numbers
and description. Based on the HTML output from the previous URL, we can use this one:

<td class="views-field views-field-title" \s*>\s*<a


href="/node/({id}.+?)">({summary}.+?)</a>

Using the Test button, we can verify our settings are correct. In our IDE we can make use of the Alt+Shift+N keyboard shortcut to list issues.

Working with tasks


From our IDE, we can work with tasks from our issue tracking system. There are several operations available:
Opening a task
Viewing a task
Switching between tasks
Committing code related to a task
Using the Alt+Shift+N keyboard shortcut, we can search for a given task. Note that we can also create a new task (but keep in mind the tasks
created are not persisted in the issue tracking system). Once a task is selected, we can open it. Optionally we can specify if we want to clear the
current context or start creating a new VCS changelist. We can choose to create a new branch in the version control system as well.

Using the Tools | Tasks & Contexts | Show <task ID> Description, we can look at the task's description The Alt+Shift+B keyboard shortcut
will open the task in a browser window.

When multiple tasks have been opened, we can switch between tasks using the Alt+Shift+T keyboard shortcut or the toolbar.

Each task can be opened in a separate task context. This allows us to work with and switch between several tasks at a time without
mixing the changes that were made between both tasks. Read more on task contexts and changelists in our web help.
Once a task has been completed, we can commit source code to our VCS. If we have opened a task from the issue tracker, PhpStorm will
populate the commit message based on the template specified in settings.

Tweet

Potrebbero piacerti anche