Skip to content

Commit 1118b53

Browse files
Add contributing doc, style guide doc and issue template (#102)
* Add contributing and sytle guide docs * Update docs/styleGuide.md Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com> * Update styleGuide * Add bug report template * Update feature template to yml --------- Co-authored-by: jeffsmale90 <6363749+jeffsmale90@users.noreply.github.com>
1 parent 6104a96 commit 1118b53

5 files changed

Lines changed: 334 additions & 0 deletions

File tree

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
name: Bug Report
2+
description: Using MetaMask 7715 Permissions Snaps, but it's not working as you expect?
3+
title: '[Bug]: '
4+
labels: ['type-bug']
5+
type: 'Bug'
6+
body:
7+
- type: markdown
8+
attributes:
9+
value: |
10+
Thanks for taking the time to fill out this bug report!
11+
12+
## **Before Submitting:**
13+
14+
* Please search to make sure this issue has not been opened already.
15+
* If this is a question about how to integrate MetaMask 7715 Permissions Snaps with your project, please ask in our [Community forum](https://community.metamask.io/c/developer-discussion/) instead. This will get your question answered more quickly and make it easier for other devs to find the answer in the future.
16+
- type: textarea
17+
id: what-happened
18+
attributes:
19+
label: Describe the bug
20+
description: What happened?
21+
placeholder: A clear and concise description of what the bug is
22+
validations:
23+
required: true
24+
- type: textarea
25+
id: expected-behavior
26+
attributes:
27+
label: Expected behavior
28+
description: What did you expect to happen?
29+
- type: textarea
30+
id: screenshot-recording
31+
attributes:
32+
label: Screenshots/Recordings
33+
description: Please include screenshots/recordings if applicable!
34+
- type: textarea
35+
id: reproduce
36+
attributes:
37+
label: Steps to reproduce
38+
description: 'List all steps needed to reproduce the problem:'
39+
placeholder: |
40+
1. Go to '...'
41+
2. Click on '...'
42+
3. Scroll down to '...'
43+
4. See error
44+
validations:
45+
required: true
46+
- type: textarea
47+
id: error
48+
attributes:
49+
label: Error messages or log output
50+
description: Please copy and paste any relevant error messages or log output. This will be automatically formatted, so there is no need for backticks.
51+
render: shell
52+
- type: input
53+
id: version
54+
attributes:
55+
label: Version
56+
description: What version of MetaMask are you running? You can find the version in "Settings" > "About"
57+
placeholder: '7.1.0'
58+
validations:
59+
required: true
60+
- type: dropdown
61+
id: build
62+
attributes:
63+
label: Build type
64+
description: Are you using a testing or development build of MetaMask? If so, please select the type of build you are using.
65+
options:
66+
- Flask
67+
- MetaMask
68+
- type: dropdown
69+
id: browsers
70+
attributes:
71+
label: Browser
72+
description: Which browsers have you seen the problem on?
73+
multiple: true
74+
options:
75+
- Chrome
76+
- Firefox
77+
- Microsoft Edge
78+
- Brave
79+
- Other (please elaborate in the "Additional Context" section)
80+
validations:
81+
required: true
82+
- type: dropdown
83+
id: os
84+
attributes:
85+
label: Operating system
86+
description: Which operating systems have you seen the problem on?
87+
multiple: true
88+
options:
89+
- Windows
90+
- MacOS
91+
- Linux
92+
- Other (please elaborate in the "Additional Context" section)
93+
validations:
94+
required: true
95+
- type: textarea
96+
id: additional
97+
attributes:
98+
label: Additional context
99+
description: Add any other context about the problem here, e.g. related issues, additional error messages or logs, or any potentially relevant details about the environment or situation the bug occurred in.
100+
- type: textarea
101+
id: severity
102+
attributes:
103+
label: Severity
104+
description: |
105+
To be added after bug submission by internal support / PM:
106+
placeholder: |
107+
- How critical is the impact of this bug on a user?
108+
- Add stats if available on % of customers impacted
109+
- Is this visible to all users?
110+
- Is this tech debt?

.github/ISSUE_TEMPLATE/feature.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
name: "Feature Request"
3+
description: "Use this template for proposing new features"
4+
title: "[Feature]: "
5+
labels: [feature]
6+
7+
body:
8+
- type: markdown
9+
attributes:
10+
value: |
11+
### **Description**
12+
Describe the task. What does this aim to implement?
13+
14+
- type: textarea
15+
id: technical-details
16+
attributes:
17+
label: Technical Details
18+
description: |
19+
- Implementation details
20+
- Insight to what needs to be done
21+
- Etc.
22+
validations:
23+
required: false
24+
25+
- type: textarea
26+
id: acceptance-criteria
27+
attributes:
28+
label: Acceptance Criteria
29+
description: |
30+
- Are metrics required?
31+
- Are translations required?
32+
- Cases to satisfy
33+
- XYZ should work
34+
- Etc.
35+
36+
**Scenario: xxxx**
37+
- GIVEN a user is in x state
38+
- WHEN a user does x
39+
- AND a user does x
40+
- THEN x should occur
41+
validations:
42+
required: false
43+
44+
- type: textarea
45+
id: references
46+
attributes:
47+
label: References
48+
description: |
49+
- References go here.
50+
- Issue numbers. Links.
51+
- Slack threads.
52+
- Etc.
53+
validations:
54+
required: false

.github/pull-request-template.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<!--
2+
Please submit this PR as a draft initially.
3+
Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once.
4+
-->
5+
6+
## **Description**
7+
8+
<!--
9+
Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions:
10+
1. What is the reason for the change?
11+
2. What is the improvement/solution?
12+
-->
13+
14+
## **Related issues**
15+
16+
Fixes:
17+
18+
## **Manual testing steps**
19+
20+
1. Go to this page...
21+
2.
22+
3.
23+
24+
## **Screenshots/Recordings**
25+
26+
<!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. -->
27+
28+
### **Before**
29+
30+
<!-- [screenshots/recordings] -->
31+
32+
### **After**
33+
34+
<!-- [screenshots/recordings] -->
35+
36+
## **Pre-merge author checklist**
37+
38+
- [ ] I've followed [MetaMask 7715 Permissions Snaps Contributor Docs](https://github.com/MetaMask/snap-7715-permissions/blob/main/CONTRIBUTING.md) and [MetaMask 7715 Permissions Snaps Coding Standards](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/styleGuide.md).
39+
- [ ] I've completed the PR template to the best of my ability
40+
- [ ] I’ve included tests if applicable
41+
- [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable
42+
43+
## **Pre-merge reviewer checklist**
44+
45+
- [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
46+
- [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

CONTRIBUTING.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Contributing
2+
3+
Thank you for your interest in contributing to the `snap-7715-permissions`! Your contributions help make this project better for everyone. Below are guidelines to help you get started.
4+
5+
6+
## How Can I Contribute?
7+
8+
You can [open an issue](https://github.com/MetaMask/snap-7715-permissions/issues/new/choose) to suggest a feature. Please follow the new feature template. To report a bug, please follow our [security policy](https://github.com/MetaMask/snap-7715-permissions/security/policy).
9+
10+
Before creating a new issue, check the current open and closed issues to see if your concern has already been addressed. Adding a comment to an existing issue can often be more effective.
11+
12+
When suggesting a new feature, provide comprehensive details, particularly about the motivating use cases. Clearly illustrating the feature’s potential impact on the ecosystem can help prioritize its development. High-impact features are given priority, so detailed explanations are highly valued.
13+
14+
### Submitting Pull Requests
15+
16+
All Pull Requests must be paired with an open issue. When creating a Pull Request, you will be presented with a PR template; please be as detailed and thorough as possible to increase the likelihood of your PR being merged.
17+
18+
Create your PR against `main` as the base branch.
19+
20+
Please ensure your pull request adheres to the [style guide](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/styleGuide.md) and includes unit tests for new functionality.
21+
22+
## Releasing changes
23+
24+
[Read more on "Release" ->](https://github.com/MetaMask/snap-7715-permissions/blob/main/docs/release.md)

docs/styleGuide.md

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
# Style Guide
2+
3+
This document outlines the coding style and conventions used in the snap-7715-permissions project.
4+
5+
## General
6+
7+
- Use UTF-8 encoding for all files
8+
- Use 2 spaces for indentation
9+
10+
## TypeScript/JavaScript
11+
12+
### Naming Conventions
13+
14+
- Use camelCase for variables, functions, and method names
15+
- Use camelCase for file names
16+
17+
### Documentation
18+
19+
- Use JSDoc comments for public APIs
20+
- Include descriptions for parameters and return values
21+
- Document thrown exceptions
22+
23+
Example:
24+
```typescript
25+
/**
26+
* Description of the function.
27+
*
28+
* @param options - The options object.
29+
* @param options.param1 - Description of param1.
30+
* @returns Description of the return value.
31+
* @throws When something goes wrong.
32+
*/
33+
```
34+
35+
### Error Handling
36+
37+
- Use descriptive error messages
38+
- Prefer custom error classes for specific error types
39+
- Handle errors appropriately
40+
41+
## Testing
42+
43+
- Use Jest for unit and integration tests
44+
- Name test files with `.test.ts` suffix
45+
- Group related tests with `describe` blocks
46+
- Use clear and descriptive test names with `it` statements
47+
- Use mocks for external dependencies
48+
49+
Example:
50+
```typescript
51+
describe('MyFunction', () => {
52+
it('returns the expected result when given valid input', () => {
53+
// Arrange
54+
const input = 'valid input';
55+
56+
// Act
57+
const result = myFunction(input);
58+
59+
// Assert
60+
expect(result).toBe('expected output');
61+
});
62+
});
63+
```
64+
65+
## Code Organization
66+
67+
- Organize code by feature or domain
68+
- Keep files focused on a single responsibility
69+
- Use barrel exports (index.ts files) sparingly, and with named exports, to simplify imports
70+
- Separate interfaces/types into their own files when they become large
71+
72+
## Git Workflow
73+
74+
- Create feature branches from `main`
75+
- Use descriptive commit messages
76+
- All pull requests must be linked to an open issue
77+
- Pull requests should target the `main` branch
78+
79+
## Project Structure
80+
81+
- `/packages`: Contains all the project packages
82+
- `/scripts`: Contains build and utility scripts
83+
- `/docs`: Project documentation
84+
- `/external`: External dependencies
85+
86+
## Dependencies
87+
88+
- Use Yarn as the package manager
89+
- Pin dependency versions where appropriate
90+
91+
## Best Practices
92+
93+
1. Follow the Single Responsibility Principle
94+
2. Write pure functions when possible
95+
3. Use async/await for asynchronous code
96+
4. Use descriptive variable names
97+
5. Keep functions small and focused
98+
6. Use TypeScript's type system to prevent bugs
99+
7. Document complex logic with comments
100+
8. Write tests for all new functionality

0 commit comments

Comments
 (0)