玩转 GitHub 的问题单（issue）
issue github 问题跟踪
![](/data/attachment/album/201611/30/084654wsl1s4evg3oqqlld.jpg)


对于大多数开源项目来讲，<ruby> 问题追踪系统 <rp>  （ </rp> <rt>  Issue-tracking system </rt> <rp>  ） </rp></ruby>是至关重要的。虽然有非常多的开源工具提供了这样的功能，但是大量项目还是选择了 GitHub 自带的<ruby> 问题追踪器 <rp>  （ </rp> <rt>  Issue Tracker </rt> <rp>  ） </rp></ruby>。


它结构简单，可以让其他人可以非常轻松地参与进来，但这才仅仅是开始。


如果没有适当的处理，你的<ruby> 储存库 <rp>  （ </rp> <rt>  repository </rt> <rp>  ） </rp></ruby>会变得很庞大，挤满重复的问题单、模糊不明的特性需求单、含混的 bug 报告单。项目维护者会被大量工作压得喘不过气来，新的贡献者也搞不清楚项目当前的工作重点是什么。


接下来，我们一起研究下，如何玩转 GitHub 的问题单。


### 问题单就是用户的故事


我的团队曾经和开源专家 [Jono Bacon](http://www.jonobacon.org/) 做过一次对话，他是<ruby> <a href="http://www.artofcommunityonline.org/">  《社区艺术》 </a> <rp>  （ </rp> <rt>  The Art of Community </rt> <rp>  ） </rp></ruby>一书的作者、一位战略顾问、前 GitHub 社区总监。他告诉我们，高质量的问题单是项目成功的关键。有些人把问题单仅仅看作是一堆你不得不去处理的问题列表，但是如果这些问题单管理完善，进行了分类并打上标签，会令人意想不到的提升我们对代码和社区的了解程度，也让我们更清楚问题的关键点在哪里。


“在提交问题单时，用户不太会有耐心或者有兴趣把问题的细节描述清楚。在这种情况下，你应当努力花最短的时间，尽量多的获取有用的信息。”，Jono Bacon 说。


统一的问题单模板可以大大减轻项目维护者的负担，尤其是开源项目的维护者。我们发现，让用户讲故事的方法总是可以把问题描述的非常清楚。用户讲故事时需要说明“是谁，做了什么，为什么而做”，也就是：我是【何种用户】，为了【达到何种目的】，我要【做何种操作】。


实际操作起来，大概是这样的：



> 
> 我是一名**顾客**，我想**购买东西**，所以我想**创建个账户**。
> 
> 
> 


我们建议，问题单的标题始终使用这样的用户故事形式。你可以设置[问题单模板](https://help.github.com/articles/creating-an-issue-template-for-your-repository/)来保证一致性。


![](/data/attachment/album/201611/30/084716xnqd7lbddbb3q60q.png)


*问题单模板让特性需求单保持统一的形式*


这个做法的核心点在于，问题单要清晰的呈现给它涉及的每一个人：它要尽量简单的指明受众（或者说用户），操作（或者说任务），和输出（或者说目标）。不过，不需要过分拘泥于这个模板，只要能把故事里的是什么事情或者是什么原因说清楚，就达到目的了。


### 高质量的问题单


问题单的质量是参差不齐的，这一点任何一个开源软件的贡献者或维护者都能证实。在[《The Agile Samurai》](https://www.amazon.ca/Agile-Samurai-Masters-Deliver-Software/dp/1934356581)中概述过一个良好的问题单所应具备的素质。


好的问题单尽量满足如下条件：


* 客户价值所在
* 避免使用术语或晦涩的文字，就算不是专家也能看懂
* 可以切分，也就是说我们可以逐步解决问题
* 尽量跟其他问题单没有瓜葛，依赖其它问题会降低处理的灵活性
* 可以协商，也就说我们有好几种办法达到目标
* 问题足够小，可以非常容易的评估出所需时间和资源
* 可衡量，我们可以对结果进行测试


### 不满足上述条件的问题单呢? 要有约束


如果一个问题单很难衡量，或者很难在短时间内完成，你也一样有办法搞定它。有些人把这种办法叫做“约束”（constraints）。


例如，“这个产品要快”，这种问题单不符合故事模板，而且是没办法协商的。多快才是快呢？这种模糊的需求没有达到“好问题单”的标准，但是如果你进一步定义一下，例如“每个页面都需要在 0.5 秒内加载完”，那我们就能更轻松地解决它了。我们可以把“约束”看作是成功的标尺，或者要实现的里程碑。每个团队都应该定期的对“约束”进行测试。


### 问题单里面有什么？


敏捷方法中，用户故事里通常要包含验收指标或者标准。在 GitHub 里，建议大家使用 markdown 格式的清单来概括解决这个问题单需要完成的任务。优先级越高的问题单应当包含更多的细节。


比如说，你打算提交一个关于新版网站主页的问题单。那这个问题单的子任务列表可能就是这样的：


![](/data/attachment/album/201611/30/084717fhcxfpbf3hjbzxxj.png)


*使用 markdown 的清单把复杂问题拆分成多个部分*


在必要的情况下，你还可以链接到其他问题单，以进一步明确任务。（GitHub 里做这个挺方便的）


将特性定义的越细化，越容易跟踪进度、测试，最终能更高效的发布有价值的代码。


以问题单的形式收到到问题所在后，还可以用 API 更深入的了解软件的健康度。


“在统计问题单的类型和趋势时，GitHub API 可以发挥巨大作用”，Bacon 告诉我们，“如果再做些数据挖掘工作，你就能发现代码里的问题点、社区里的活跃成员，或者其他有用的信息。”


有些问题单管理工具提供的 API 可以提高额外信息，比如预估时间或者历史进度。


### 团队协同一致


团队决定使用某种问题单模板后，如何让所有人都照做？存储库里的 ReadMe.md 其实也可以是你们项目的 “How-to” 文档。这个文档应描述清楚这个项目是做什么的（最好是用可以搜索的语言），以及其他贡献者应当如何参与进来（比如提交需求单、bug 报告、建议，或者直接贡献代码）。


![](/data/attachment/album/201611/30/084717dcpkczzo3cclx43d.png)


*在 ReadMe 文件里增加清晰的说明，供新协作者参考*


ReadMe 文件是提供“问题单指引”的完美场所。如果希望特性需求单遵循“用户讲故事”的格式，那就把格式写在 ReadMe 里。如果使用某种跟踪工具来管理待办事项，那就标记在 ReadMe 里，这样别人也能看到。


“问题单模板、合理的标签、提交问题单的指导文档、确保问题单被分类并及时回应，这些对于开源项目都至关重要”，Bacon 说。


记住一点：这不是为了完成工作而做的工作。这是让其他人更轻松的发现、了解、融入你的社区而设立的规则。


"关注社区的成长，不仅要关注参与开发者的的数量增长，也要关注那些在问题单上帮助我们的人，他们让问题单更加明确、保持更新，这是活跃沟通和高效解决问题的力量源泉"，Bacon 说。




---


via: <https://opensource.com/life/16/7/how-take-your-projects-github-issues-good-great>


作者：[Matt Butler](https://opensource.com/users/mattzenhub) 译者：[echoma](https://github.com/echoma) 校对：[jasminepeng](https://github.com/jasminepeng)


本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译，[Linux中国](https://linux.cn/) 荣誉推出


OK
Issue-tracking systems are important for many open source projects, and there are many open source tools that provide this functionality but many projects opt to use GitHub's built-in issue tracker.

Its simple structure makes it easy for others to weigh in, but issues are really only as good as you make them.

Without a process, your repository can become unwieldy, overflowing with duplicate issues, vague feature requests, or confusing bug reports. Project maintainers can become burdened by the organizational load, and it can become difficult for new contributors to understand where priorities lie.

In this article, I'll discuss how to take your GitHub issues from good to great.

## The issue as user story

My team spoke with open source expert [Jono Bacon](http://www.jonobacon.org/)—author of * The Art of Community,* a strategy consultant, and former Director of Community at GitHub—who said that high-quality issues are at the core of helping a projects succeed. He says that while some see issues as merely a big list of problems you have to tend to, well-managed, triaged, and labeled issues can provide incredible insight into your code, your community, and where the problem spots are.

"At the point of submission of an issue, the user likely has little patience or interest in providing expansive detail. As such, you should make it as easy as possible to get the most useful information from them in the shortest time possible," Jono Bacon said.

A consistent structure can take a lot of burden off project maintainers, particularly for open source projects. We've found that encouraging a user story approach helps make clarity a constant. The common structure for a user story addresses the "who, what, and why" of a feature: As a [user type], I want to [task] so that [goal].

Here's what that looks like in practice:

As a

customer, I want tocreate an accountso thatI can make purchases.

We suggest sticking that user story in the issue's title. You can also set up [issue templates](https://help.github.com/articles/creating-an-issue-template-for-your-repository/) to keep things consistent.

![screenshot GitHub issues screenshot GitHub issues](https://opensource.com/sites/default/files/issuetemplate-new.png)

Issue templates bring consistency to feature requests.

The point is to make the issue well-defined for everyone involved: it identifies **the audience** (or user), **the action** (or task), and **the outcome** (or goal) as simply as possible. There's no need to obsess over this structure, though; as long as the *what* and *why* of a story are easy to spot, you're good.

## Qualities of a good issue

Not all issues are created equal—as any OSS contributor or maintainer can attest. A well-formed issue meets these qualities outlined in * The Agile Samurai*.

Ask yourself if it is...

- something of value to customers
- avoids jargon or mumbo jumbo; a non-expert should be able to understand it
- "slices the cake," which means it goes end-to-end to deliver something of value
- independent from other issues if possible; dependent issues reduce flexibility of scope
- negotiable, meaning there are usually several ways to get to the stated goal
- small and easily estimable in terms of time and resources required
- measurable; you can test for results

## What about everything else? Working with constraints

If an issue is difficult to measure or doesn't seem feasible to complete within a short time period, you can still work with it. Some people call these "constraints."

For example, "the product needs to be fast" doesn't fit the story template, but it is non-negotiable. But how fast is fast? Vague requirements don't meet the criteria of a "good issue", but if you further define these concepts—for example, "the product needs to be fast" can be "each page needs to load within 0.5 seconds"—you can work with it more easily. Constraints can be seen as internal metrics of success, or a landmark to shoot for. Your team should test for them periodically.

## What's inside your issue?

In agile, user stories typically include acceptance criteria or requirements. In GitHub, I suggest using markdown checklists to outline any tasks that make up an issue. Issues should get more detail as they move up in priority.

Say you're creating an issue around a new homepage for a website. The sub-tasks for that task might look something like this.

![](https://opensource.com/sites/default/files/markdownchecklist.png)

Use markdown checklists to split a complicated issue into several parts.

If necessary, link to other issues to further define a task. (GitHub makes this really easy.)

Defining features as granularly as possible makes it easier to track progress, test for success, and ultimately ship valuable code more frequently.

Once you've gathered some data points in the form of issues, you can use APIs to glean deeper insight into the health of your project.

"The GitHub API can be hugely helpful here in identifying patterns and trends in your issues," Bacon said. "With some creative data science, you can identify problem spots in your code, active members of your community, and other useful insights."

Some issue management tools provide APIs that add additional context, like time estimates or historical progress.

## Getting others on board

Once your team decides on an issue structure, how do you get others to buy in? Think of your repo's ReadMe.md file as your project's "how-to." It should clearly define what your project does (ideally using searchable language) and explain how others can contribute (by submitting requests, bug reports, suggestions, or by contributing code itself.)

![](https://opensource.com/sites/default/files/readme.png)

Edit your ReadMe file with clear instructions for new collaborators.

This is the perfect spot to share your GitHub issue guidelines. If you want feature requests to follow the user story format, share that here. If you use a tracking tool to organize your product backlog, share the badge so others can gain visibility.

"Issue templates, sensible labels, documentation for how to file issues, and ensuring your issues get triaged and responded to quickly are all important" for your open source project, Bacon said.

Remember: It's not about adding process for the process' sake. It's about setting up a structure that makes it easy for others to discover, understand, and feel confident contributing to your community.

"Focus your community growth efforts not just on growing the number of programmers, but also [on] people interested in helping issues be accurate, up to date, and a source of active conversation and productive problem solving," Bacon said.

## Comments are closed.