UNPKG

17.4 kBMarkdownView Raw
1# Contributing to Punchcard
2
3Punchcard is a headless CMS designed with content strategy at its heart. With a focus on content management and content management only, it reinforces at its heart the [create once, publish everywhere](http://www.programmableweb.com/news/cope-create-once-publish-everywhere/2009/10/13) mentality of reusable content.
4
5Participation in the Punchcard community, including contributing to the Punchcard codebases, is governed by our [Code of Conduct](https://github.com/punchcard-cms/punchcard/blob/master/CODE_OF_CONDUCT.md). By participating, you agree to abide by it.
6
7 Punchcard, and its [related components](https://github.com/punchcard-cms), are all covered by these contributing guidelines, as well as the [Apache License 2.0](http://spdx.org/licenses/Apache-2.0).
8
9## Submitting Issues
10
11* Before creating a new issue, perform a [cursory search](https://github.com/issues?utf8=%E2%9C%93&q=is%3Aissue+user%3Apunchcard-cms) to see if a similar issue has already been submitted. Similar issues may have different names than what you would have written, and may have been closed.
12* Can create an issue in the most relevant repository. If unable to determine which one that is, file an issue in this repository. It may be moved.
13* Please follow our [Issue Guidelines](#issue-guidelines) when creating a new issue.
14* Do not open a [pull request](#pull-requests) to resolve an issue without first receiving feedback from a `Punchcard CMS member` and having them agree on a solution forward.
15* Include screenshots and animated GIFs whenever possible; they are immensely helpful.
16* When submitting a browser bug, please include the browser, version, operating system, and operating system version.
17* When submitting an update to or a new feature, pattern, guideline, etc… we prefer to see user research associated with the suggestion including testing methods, results, and sample size, whenever possible. This allows us to make more user-centered decisions and cut through assumptions and individual preferences.
18* Issues that have a number of sub-items that need to be complete should use [task lists](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments) to track the sub-items in the main issue comment.
19
20## Pull Requests
21
22* **DO NOT ISSUE A PULL REQUEST WITHOUT FIRST [SUBMITTING AN ISSUE](#submitting-issues)**
23* **ALL PULL REQUESTS MUST INCLUDE A [DEVELOPER CERTIFICATE OF ORIGIN](#developer-certificate-of-origin)**
24* Please follow our [Pull Request Guidelines](#issue-guidelines) when creating a new issue.
25* Pull requests should reference their related issues. If the pull request closes an issue, [please reference its closing from a commit messages](https://help.github.com/articles/closing-issues-via-commit-messages/). Pull requests not referencing any issues will be closed.
26* Commit messages _must_ begin with the [relevant emoji](#emoji-cheatsheet) describing what the commit does.
27* Pull request titles should be descriptive, explaining at the high level what it is doing, and should be written in the same style as [commit messages](#git-commit-messages).
28* Do not squash or rebase commits when submitting a Pull Request
29* Ensure no Emoji tags are used in the title of the Pull Request
30
31## Pull Request Guidelines
32
33In order to expedite the process of reviewing and merging pull requests, we request the following guidelines are adhered to.
34
35### Tips for Submitting Great PRs
36
37Beyond just writing the code needed to resolve an issue, there are a few best practices that should be followed to submit a great PR:
38
39* We have [EditorConfig](http://editorconfig.org/) files set up for Punchcard. Having EditorConfig installed and used will help ensure that editors are configured to follow our conventions.
40* We have JavaScript and Sass linting set up (where appropriate). Before committing code, make sure that linting has been run locally and passes by running `npm run lint`
41* We have automated testing set up. They can be run locally by by running `npm test` from the command line. This will run linting, our test suite, and show code coverage. These same tests are run as part of our automated test suite and must pass for all pull requests.
42* For consistency, follow the conventions that the team has in place that aren't necessarily covered by our automated test suite. For instance, the team may be using `map` instead of `forEach` to create new arrays, or may divide out their Sass partials in a particular way.
43* When writing browser code, ensure it works cross-browser in all Evergreen (auto-updating, not tied to a operating system version, not referred to by version number) browsers, as well as the latest version of Safari on iOS devices.
44* When writing browser code, we adhere to the principles of [progressive enhancement](http://alistapart.com/article/understandingprogressiveenhancement) and expect new code to follow the same principles.
45* Solve the issue in as few lines of code, with as few external dependencies, as possible. The most maintainable lines of code are the ones that don't exist, so keeping PRs as small, clear, and concise as possible will aid in overall project maintainability, stability, and make it easier for us to do code review.
46* Commit tests separately from implementation code.
47* PRs are easiest to review when they're small. Please keep total lines of code changed to around 200. This may mean breaking up work over multiple PRs. If this is done, one PR for tests and one PR for functionality is usually a good place to start, with tests being submitted and merged first (and skipped) and functinality being submitted and merged second (unskipping the tests)
48* Commit early and often. Small, atomic commits help us understand the thought process that went in to creating a pull request and make it easier for us to review. Do not squash or rebase your commits when submitting pull requests.
49* Do not [refactor](http://blog.codeclimate.com/blog/2014/01/09/when-is-it-time-to-refactor/) existing code unless it is _absolutely necessary_ to resolve the issue being worked on. If there is an opportunity to refactor, please file a separate issue to discuss and implement instead.
50* Only include code that resolves the [scenarios](https://github.com/punchcard-cms/punchcard/blob/master/CONTRIBUTING.md#issue-guidelines) in the issue being worked on (or the specific bug being fixed). While appreciated, work that goes above-and-beyond the scenarios outlined in an issue is out-of-scope and we will not be able to accept it. Please either work with the Punchcard team to get scenarios written for the issue being worked on, or split up the work across multiple issues and pull requests.
51
52### Developer Certificate of Origin
53
54All contributions to Punchcard projects must be accompanied by acknowledgment of, and agreement to, the [Developer Certificate of Origin](http://elinux.org/Developer_Certificate_Of_Origin), reproduced below. Acknowledgment of and agreement to the Developer Certificate of Origin _must_ be included in the comment section of each contribution and _must_ take the form of `DCO 1.1 Signed-off-by: FULL_NAME <EMAIL_ADDRESS>`. Contributions without this acknowledgment will be required to add it before being accepted. If a contributor is unable or unwilling to agree to the Developer Certificate of Origin, their contribution will not be included.
55
56```
57Developer Certificate of Origin
58Version 1.1
59
60Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
61660 York Street, Suite 102,
62San Francisco, CA 94110 USA
63
64Everyone is permitted to copy and distribute verbatim copies of this
65license document, but changing it is not allowed.
66
67Developer's Certificate of Origin 1.1
68
69By making a contribution to this project, I certify that:
70
71(a) The contribution was created in whole or in part by me and I
72 have the right to submit it under the open source license
73 indicated in the file; or
74
75(b) The contribution is based upon previous work that, to the best
76 of my knowledge, is covered under an appropriate open source
77 license and I have the right under that license to submit that
78 work with modifications, whether created in whole or in part
79 by me, under the same open source license (unless I am
80 permitted to submit under a different license), as indicated
81 in the file; or
82
83(c) The contribution was provided directly to me by some other
84 person who certified (a), (b) or (c) and I have not modified
85 it.
86
87(d) I understand and agree that this project and the contribution
88 are public and that a record of the contribution (including all
89 personal information I submit with it, including my sign-off) is
90 maintained indefinitely and may be redistributed consistent with
91 this project or the open source license(s) involved.
92```
93
94### Git Commit Messages
95
96Commit message should follow the template `:<emoji>: <subject>` with `<emoji>` being the name of the relevant [emoji](#emoji-cheatsheet) describing the changes (without wrapping `::`) and `subject` being the description of changes. Commit messages may have multiple emoji. Some emoji have [semantic meaning for releases](#creating-a-release), so please those are used properly. Commit messages should follow the following guidelines:
97
98* Use the present tense (`"Add feature"` not `"Added Feature"`)
99* Use the imperative mood (`"Move cursor to…"` not `"Moves cursor to…"`)
100* Limit the first line (not including emoji) to 72 characters or less
101
102Example commits may look something like the following:
103
104`git commit -m ":art: Refactor lookup system"`
105
106`git commit -m ":lock: Fix XSS vulnerability"`
107
108`git commit -m ":new::boom: Require author in content types" -m "Previously working content types will now throw if author is not present, so this is a breaking change"`
109
110When using [ghooks](https://www.npmjs.com/package/ghooks) with [punchcard-commit-msg](https://github.com/punchcard-cms/commit-msg), this convention will be enforced for you when using command-line git.
111
112### Branching Model
113
114* Branches must be made off of the most current `master` branch of a repository
115* Branch names should be descriptive, describing what is being done in that branch
116* Pull requests must be made back in to the `master` branch for a repository
117* The following branch prefixes should be used when creating a new branch:
118 * `hotfix/` - [bug fixes](#bug-report) for bugs got through and need to be squashed
119 * `feature/` - update to existing code or [new functionality](#functionality-requests)
120
121### Time to Merge
122
123In order for a pull request to be merged, it must meet the following criteria:
124
125* The author(s) of the code have signed off on the [Developer Certificate of Origin](#developer-certificate-of-origin) for this pull request
126* All required integrations have passed
127* The code has been reviewed by at least one non-authoring member of the [@punchcard-cms/maintainers](https://github.com/orgs/punchcard-cms/teams/maintainers) GitHub team and all comments from the review have been addressed. This may include comments related to our [tips for submitting great PRs](#tips-for-submitting-great-prs).
128
129## Creating a Release
130
131Versioning is done through [SEMVER](http://semver.org/). Whenever new code is merged in to the `master` branch, a new semantic release will automatically be created on NPM and in the project's GitHub Releases. The GitHub Release will also include a changelog based off of the commit messages of that release. The release version and changelog are determined by the [punchcard-semantic-release](https://github.com/punchcard-cms/semantic-release) module, and released using the [semantic-release](https://github.com/semantic-release/semantic-release) module based off of the [emoji](#emoji-cheatsheet) used in the commit messages for each commit. The following emoji correspond to different semantic versions, all other emoji are considered non-semantic:
132
133**Major Version**
134Backwards-incompatible changes
135- :boom: `:boom:`
136
137**Minor Version**
138Backwards-compatible new functionality
139- :new: `:new:`
140- :racehorse: `:racehorse:`
141- :lock: `:lock:`
142
143**Patch Version**
144Backwards-compatible changes that do not add new functionality
145- :bug: `:bug:`
146- :shirt: `:shirt:`
147- :art: `:art:`
148- :unamused: `:unamused:`
149
150**Pre-Release Version**
151In-progress release
152- :crystal_ball: `:crystal_ball:`
153
154The version that gets generated is based on the highest type of change identified; i.e. if there were five _patch_ commits and one _minor_ commit, the _minor_ commit takes precedence and a new _minor_ release will be generated. All contributing commits will be included in the changelog.
155
156## Issue Guidelines
157
158There are generally two kinds of issues: functionality requests and bugs. Each is treated slightly differently, and there is a template for each.
159
160#### Functionality Requests
161
162[Request New Functionality](https://github.com/punchcard-cms/punchcard/issues/new)
163
164New functionality always exists in relation to a specific type of user. When requesting new functionality, include the user persona the request relates to, why the user needs it, including the user's rationale for needing it. Titles should be written with the user persona first, then the a short description of their need (5-10 words).
165
166New functionality also needs their requirements for being considered complete written out. To do so, features and scenarios should be written to describe the expected behavior in [Gherkin](https://github.com/cucumber/cucumber/wiki/Gherkin) syntax. Each feature and scenario pair should have a [task list](https://github.com/blog/1375%0A-task-lists-in-gfm-issues-pulls-comments) created to track their completion. The issue is considered **done** when all scenarios defined have been completed, code is covered with tests, and all tests pass.
167
168A new request for functionality can be created by opening a new issue directly, [copying our Issue Template](https://raw.githubusercontent.com/punchcard-cms/punchcard/master/.github/ISSUE_TEMPLATE.md#) in to the body of a new issue, or clicking the **Request New Functionality** link above.
169
170### Bug Report
171
172[File a Bug Report](https://github.com/punchcard-cms/punchcard/issues/new?body=%7B%7Blong%20description%7D%7D%0A%0A%23%23%20Steps%20for%20Reproducing%0A%0A-%20%7B%7BStep%201%7D%7D%0A-%20%7B%7BStep%202%7D%7D%0A-%20%7B%7BStep%203%7D%7D%0A%0A%23%23%20Screenshots%0A%0A%23%23%23%20%7B%7BStep%201%7D%7D%0A%0A!%5BScreenshot%20of%20Step%201%5D(url%2Fto%2Fscreenshot)%0A%0A%23%23%23%20%7B%7BStep%202%7D%7D%0A%0A!%5BScreenshot%20of%20Step%202%5D(url%2Fto%2Fscreenshot)%0A%0A%23%23%23%20%7B%7BStep%203%7D%7D%0A%0A!%5BScreenshot%20of%20Step%203%5D(url%2Fto%2Fscreenshot)%0A%0A%23%23%20Affected%20Browsers%0A%0A-%20%5B%20%5D%20%7B%7BChrome%2047%20on%20Mac%2010.11%7D%7D%20%2F%20%7B%7BProduction%2C%20Development%7D%7D%0A-%20%5B%20%5D%20%7B%7BChrome%2047%20on%20Windows%2010%7D%7D%20%2F%20%7B%7BProduction%2C%20Development%7D%7D%0A-%20%5B%20%5D%20%7B%7BFirefox%2038.4%20on%20Mac%2010.11%7D%7D%20%2F%20%7B%7BDevelopment%7D%7D%0A%0A%23%23%20Runtime%20Version%0A%0A%7B%7Bruntime%20version%7D%7D%0A%0A%23%23%20Code%20Version%0A%0A%7B%7Bcode%20version%7D%7D&title=Bug%3A%20%7B%7Bshort%20description%7D%7D)
173
174Bug reports represent a problem in our codebase. If the problem exists because something isn't working as it was designed and implemented to work, it should be filed as a bug report. If the problem exists because something isn't working as expected or working as liked but _is_ working as it was designed and implemented to work, it should be requested as a [new functionality](#new-functionality). Titles should be written with the `Bug:` first, then the a short description of the problem (5-10 words).
175
176Bug reports should all include the following information:
177
178* Long description of problem
179* Step-by-step instructions on how to reproduce the problem
180* Screenshots and if possible animated GIFs (ideally at least one for every step)
181* Browsers, browser versions, operating systems, and operating system versions affected (for in-browser bugs)
182* Runtime version affected (for non-browser bugs, _i.e._ Node version)
183* Code version being used
184
185A new bug report can be created either by opening a new issue and [copying our Bug Template](https://raw.githubusercontent.com/punchcard-cms/punchcard/master/.github/BUG_TEMPLATE.md#) in to the body of the issue, or clicking the **File a Bug Report** link above.
186
187## Emoji Cheatsheet
188
189When writing commits, please **start** the [commit message](#git-commit-messages) with one of the following applicable Emoji, keeping in mind that some emoji have [semantic meaning for releases](#creating-a-release). Emoji should not be used at the start of issue or pull request titles.
190
191* :new: `:new:` when adding new functionality
192* :bug: `:bug:` when fixing a bug
193* :memo: `:memo:` when writing documentation
194* :shirt: `:shirt:` when removing linter warnings
195* :art: `:art:` when improving the format/structure of the code, documentation, or visual styling
196* :fire: `:fire:` when removing code or files
197* :racehorse: `:racehorse:` when improving performance
198* :white_check_mark: `:white_check_mark:` when adding tests
199* :green_heart: `:green_heart:` when fixing the CI build
200* :lock: `:lock:` when dealing with security
201* :crystal_ball: `:crystal_ball:` when experimenting
202* :unamused: `:unamused:` when doing chore work (updating dependencies, etc…)
203* :boom: `:boom:` when changing in a non-backwards-compatible way current functionality