Skip to content

Commit a1e9eb6

Browse files
Add PR checklists and code review guidelines
1 parent 04eda1e commit a1e9eb6

File tree

14 files changed

+358
-0
lines changed

14 files changed

+358
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Analytics Checklist
2+
3+
See [Website Analytics](../../measurement/analytics.md) for full documentation.
4+
5+
## Links `<a href="">`
6+
7+
- [ ] Has a [`data-cta-text` OR `data-link-text`](../../measurement/analytics.md#data-attributes)
8+
- [ ] If it has class `mzp-c-button` it is a CTA
9+
- [ ] If it has class `mzp-c-cta-link` it is a CTA
10+
- [ ] If there are two CTAs with the same value for `data-cta-text` include `data-cta-position`
11+
- [ ] Has ONLY ONE of `data-cta-text` or `data-link-text`
12+
- [ ] If linking to another Mozilla property include `utm` params
13+
- [ ] `utm_source` is `www.firefox.com` or `www.mozilla.org`
14+
- [ ] `utm_medium` is `referral`
15+
- [ ] If the query string is in a variable it is called `params` and the string includes the `?`
16+
- Download button:
17+
- [ ] Use the [appropriate helper](../../firefox-downloads/download-buttons.md#which-helper-should-i-use), don't hardcode these (`download_firefox_thanks`, `google_play_button`, `apple_app_store_button`)
18+
- [ ] Include a `download_location` if there are multiple buttons on the page
19+
20+
## Buttons `<button type="button">`
21+
22+
- Download button:
23+
- [ ] Download buttons are links for analytics purposes (not buttons)
24+
- Not a download button:
25+
- [ ] [`widget_action` reporting in the dataLayer](../../measurement/analytics.md#widget-action)
26+
27+
## QR Codes
28+
29+
- [ ] Use the [`qrcode` helper](../../development/images.md#qrcode)
30+
- [ ] Use the app store redirects if applicable and include a product and campaign
31+
32+
## Other
33+
34+
- [ ] New custom events configured in GTM
35+
- If any of the following are used, check that their custom events will be triggered:
36+
- [ ] [Download](../../measurement/analytics.md#product-downloads)
37+
- [ ] Mozilla Accounts form
38+
- [ ] [Newsletter subscribe](../../measurement/analytics.md#newsletter-subscribe)
39+
- [ ] Self-hosted videos
40+
- [ ] [Send to Device](../../measurement/analytics.md#send-to-device)
41+
- [ ] [Social Share](../../measurement/analytics.md#social-share)
42+
- [ ] [VPN subscribe button](../../measurement/analytics.md#begin-checkout)
43+
- [ ] [Widget Action](../../measurement/analytics.md#widget-action)

docs/code-review/checklists/css.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# CSS Checklist
2+
3+
See [Writing CSS](../../development/protocol.md) for full documentation.
4+
5+
## Responsive
6+
7+
- [ ] CSS written mobile-first
8+
- [ ] In extremely wide viewports, the edges of backgrounds are not visible
9+
- [ ] In extremely wide viewports, content is restricted to `$max-width`
10+
- [ ] In narrow viewports, content stacks in a logical reading order
11+
- [ ] Conditional content displays under correct conditions (logged in, out, Fx, not Fx)
12+
13+
## Best Practices
14+
15+
- [ ] Passes [Stylelint](../../development/coding-style.md)
16+
- [ ] Components added locally do NOT use `mzp` prefix on classes
17+
- [ ] Can still use [other prefix conventions](https://protocol.mozilla.org/docs/contributing/naming)
18+
- [ ] Prefer classes over element selectors or IDs
19+
- [ ] Use [mixins](https://protocol.mozilla.org/docs/usage/framework) and [design tokens](https://protocol.mozilla.org/docs/fundamentals/design-tokens) when available
20+
- [ ] No commented out code
21+
22+
## Localization
23+
24+
- [ ] Test in an RTL language (You may find the [Pseudolocalize addon](https://addons.mozilla.org/en-US/firefox/addon/pseudolocalize/) helpful.)
25+
- [ ] [BIDI mixin](https://protocol.mozilla.org/docs/usage/framework#bidi) used for any properties which include `left` or `right`
26+
- [ ] [BIDI mixin](https://protocol.mozilla.org/docs/usage/framework#bidi) used for any values which include `left` or `right`
27+
- [ ] [BIDI mixin](https://protocol.mozilla.org/docs/usage/framework#bidi) used for any properties which assume LTR (e.g. `background-position`, shorthands like `border-width`)
28+

docs/pr-checklists.md renamed to docs/code-review/checklists/downoad-as-default.md

File renamed without changes.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Experiments Checklist
2+
3+
See [A/B Testing](../../measurement/abtest.md) for full documentation.
4+
5+
## General
6+
7+
- [ ] There are [no conflicting experiments](../../measurement/abtest.md#avoiding-experiment-collisions)
8+
- [ ] Consent is respected
9+
- [ ] There is a [switch](../../development/feature-switches.md) to disable the experiment
10+
- [ ] With the experiment disabled, experiment variations do not load
11+
- [ ] With the experiment disabled, experiment code is not loaded
12+
- [ ] If there are multiple conditions needed to run it, bundle the display logic into one variable
13+
- e.g. `is_enabled = switch('switchname') && geo=US && lang.startswith('en')`
14+
- [ ] Test all variations
15+
- [ ] Test an unexpected variation
16+
- [ ] The events which will determine the success of the experiment are [being recorded](../../measurement/abtest.md#recording-the-data)
17+
- Usually in GA but sometimes Stub Attribution or FundraiseUp
18+
- [ ] If GA: an `experiment_view` event is reported in the DataLayer
19+
- [ ] If a template was added, it is `noindex` and does not have the canonical or hreflang tags (bug 1442331)
20+
21+
## Traffic Cop Experiments
22+
23+
- [ ] Checks `isApprovedToRun` before activating
24+
- [ ] Experiment activation logic is sound
25+
- [ ] Traffic is split between variants as expected
26+
- [ ] [Cookie support is not necessary or is included](../../measurement/abtest.md#cookies-consent)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# General Checklist
2+
3+
## Manual Testing
4+
5+
- [ ] Tested in Firefox, Safari, and a Chromium browser (see [Browser Support](../../development/browser-support.md))
6+
- [ ] Tested at these breakpoints:
7+
- [ ] 360px
8+
- [ ] 768px
9+
- [ ] 1024px
10+
- [ ] 1280px
11+
- [ ] 1366px
12+
- [ ] 1440px
13+
- [ ] 1536px
14+
15+
## Functionality
16+
17+
- [ ] Code does what it's supposed to do
18+
- [ ] Code makes logical sense
19+
- [ ] Code has no unintended consequences
20+
21+
## Maintainability
22+
23+
- [ ] Comments explain non-obvious logic and decisions
24+
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# HTML Checklist
2+
3+
## Best Practices
4+
5+
- [ ] Only one h1 on the page
6+
- [ ] Heading levels convey the content hierarchy (with no levels skipped)
7+
- [ ] Semantic HTML
8+
- [ ] No validation errors
9+
- [ ] [Automated a11y tests](../../testing/axe.md) pass
10+
11+
## Links
12+
13+
- [ ] No hardcoded "en-US" in links to Mozilla sites
14+
- [ ] External links have `rel="external noopener"`
15+
- [ ] Destination does not 404
16+
17+
## SEO
18+
19+
- [ ] Is there an appropriate page title and description?
20+
- [ ] Page linked from subnav where applicable
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Code Review Checklists
2+
3+
!!! warning "These checklists are not exhaustive"
4+
Look, I can't document all the ways something can go wrong. Just because a PR checks all these boxes doesn't mean it should be approved.
5+
6+
Be curious about the code you are reviewing and look for places where it might break or could be improved.
7+
8+
Think about: functionality, accessibility, analytics, code quality, localization, maintainability (including tests), performance, and security.
9+
10+
11+
These checklists are `bedrock` & `springfield` specific and are not intended to be through list of best practices. However, there are some generic best practices included in these checks because they have been commonly overlooked in the past. They should also mostly be checks that have to be done by a human. If we can automate it we should.
12+
13+
- [General](general.md) - Functionality, maintainability, and manual testing
14+
- [Analytics](analytics.md) - Link tracking, buttons, and custom events
15+
- [CSS](css.md) - Responsive design, best practices, and localization
16+
- [Experiments](experiments.md) - A/B testing and Traffic Cop
17+
- [HTML](html.md) - Best practices, links, and SEO
18+
- [JavaScript](js.md) - Behavior, error handling, and console output
19+
- [Localization](l10n.md) - Fluent files, string conventions, and style
20+
- [Media](media.md) - Images, alt text, and optimization
21+
- [Tests](tests.md) - Unit and functional tests
22+
23+
Automated checks will also be run by GitHub to check:
24+
25+
- [Pre-commit checks have been run](../../getting-started/install/#pre-commit-hooks) (fluent, ruff, stylelint, etc.)
26+
- JS unit tests pass
27+
- Python unit tests pass

docs/code-review/checklists/js.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# JavaScript Checklist
2+
3+
See [Writing JavaScript](../../development/javascript.md) for conventions on ES5 vs ES6+ syntax.
4+
5+
- [ ] Behaves as expected
6+
- [ ] Code makes logical sense
7+
- [ ] Logs [analytics events](../../measurement/analytics.md) as needed
8+
- [ ] No errors in the console
9+
- [ ] No `console.log`s
10+
- [ ] Conditional content displays under correct conditions (mobile vs desktop, Firefox vs other, etc.)
11+
- [ ] Promise rejections are handled
12+
- [ ] Has a sensible fallback for when JS is disabled
13+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Localization Checklist
2+
3+
## Template Verification
4+
5+
- [ ] No hardcoded English strings
6+
- [ ] All Fluent references are valid
7+
- Run `./manage.py l10n_update` to make sure you have the most recent Fluent files
8+
- [ ] Unused IDs are removed
9+
10+
## String Conventions
11+
12+
- [ ] [Proper organization with subheadings](../../l10n/fluent.md#translating-with-ftl-files)
13+
- [ ] [Correct brand references](../../l10n/fluent.md#using-brand-names)
14+
- [ ] [Explanatory comments for idioms and variables](../../l10n/fluent.md#variables)
15+
- [ ] [Appropriate handling of HTML attributes and link text](../../l10n/fluent.md#html-with-attributes)
16+
17+
## ID Conventions
18+
19+
- [ ] [Lowercase hyphenated naming with filename prefixes](../../l10n/fluent.md#ftl-string-ids)
20+
- [ ] Version control for altered strings
21+
- [ ] [Removal notes for fallbacks including date](../../l10n/fluent.md#fallback)
22+
23+
## New File Requirements
24+
25+
- [ ] Fluent files belong in `/l10n/en/`
26+
- [ ] The top of the file should include the URL of the page on the dev server
27+
- [ ] [Configured in `pontoon.toml`](../../l10n/configuration.md#specifying_fluent_files)
28+
- [ ] Connected to templates or views
29+
30+
## Style Standards
31+
32+
- [ ] Lowercase "web" and "internet"
33+
- [ ] Em dashes have spaces on either side
34+
- [ ] Sentence case for headings
35+
- [ ] Use "sign in" / "sign out" (not login/out)
36+
37+
See also:
38+
39+
- [Firefox Style Guide](https://support.mozilla.org/en-US/kb/contributor-style-guide)
40+
- [Fluent Basics](../../l10n/fluent.md)
41+
- [Fluent Configuration](../../l10n/configuration.md)
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Media Checklist
2+
3+
See [Working with Images](../../development/images.md) for full documentation on image helpers and optimization.
4+
5+
- [ ] Has alt text where applicable
6+
- [ ] All images in a `srcset` can be loaded
7+
- [ ] Use [image helpers](../../development/images.md) (`static()`, `resp_img()`, `picture()`, `l10n_img()`)
8+
- [ ] Images are optimized
9+
- [ ] SVG contains viewbox definition

0 commit comments

Comments
 (0)