Skip to content

Commit 2821679

Browse files
Add CONTRIBUTING.md
1 parent c803ccc commit 2821679

File tree

1 file changed

+184
-0
lines changed

1 file changed

+184
-0
lines changed

CONTRIBUTING.md

Lines changed: 184 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,184 @@
1+
Hello! Thank you for choosing to help contribute to the csharp-http-client. There are many ways you can contribute and help is always welcome.
2+
3+
We use [Milestones](https://github.com/sendgrid/csharp-http-client/milestones) to help define current roadmaps, please feel free to grab an issue from the current milestone. Please indicate that you have begun work on it to avoid collisions. Once a PR is made, community review, comments, suggestions and additional PRs are welcomed and encouraged.
4+
5+
* [Feature Request](#feature_request)
6+
* [Submit a Bug Report](#submit_a_bug_report)
7+
* [Improvements to the Codebase](#improvements_to_the_codebase)
8+
* [Understanding the Code Base](#understanding_the_codebase)
9+
* [Testing](#testing)
10+
* [Style Guidelines & Naming Conventions](#style_guidelines_and_naming_conventions)
11+
* [Creating a Pull Request](#creating_a_pull_request)
12+
13+
There are a few ways to contribute, which we'll enumerate below:
14+
15+
<a name="feature_request"></a>
16+
## Feature Request
17+
18+
If you'd like to make a feature request, please read this section.
19+
20+
The GitHub issue tracker is the preferred channel for library feature requests, but please respect the following restrictions:
21+
22+
- Please **search for existing issues** in order to ensure we don't have duplicate bugs/feature requests.
23+
- Please be respectful and considerate of others when commenting on issues
24+
25+
<a name="submit_a_bug_report"></a>
26+
## Submit a Bug Report
27+
28+
Note: DO NOT include your credentials in ANY code examples, descriptions, or media you make public.
29+
30+
A software bug is a demonstrable issue in the code base. In order for us to diagnose the issue and respond as quickly as possible, please add as much detail as possible into your bug report.
31+
32+
Before you decide to create a new issue, please try the following:
33+
34+
1. Check the Github issues tab if the identified issue has already been reported, if so, please add a +1 to the existing post.
35+
2. Update to the latest version of this code and check if issue has already been fixed
36+
3. Copy and fill in the Bug Report Template we have provided below
37+
38+
### Please use our Bug Report Template
39+
40+
In order to make the process easier, we've included a sample bug report template (borrowed from [Ghost](https://github.com/TryGhost/Ghost/)). The template uses [GitHub flavored markdown](https://help.github.com/articles/github-flavored-markdown/) for formatting.
41+
42+
```
43+
Short and descriptive example bug report title
44+
45+
#### Issue Summary
46+
47+
A summary of the issue and the environment in which it occurs. If suitable, include the steps required to reproduce the bug. Please feel free to include screenshots, screencasts, code examples.
48+
49+
50+
#### Steps to Reproduce
51+
52+
1. This is the first step
53+
2. This is the second step
54+
3. Further steps, etc.
55+
56+
Any other information you want to share that is relevant to the issue being reported. Especially, why do you consider this to be a bug? What do you expect to happen instead?
57+
58+
#### Technical details:
59+
60+
* csharp-http-client Version: master (latest commit: 2cb34372ef0f31352f7c90015a45e1200cb849da)
61+
* C# Version: 4.5
62+
```
63+
64+
<a name="improvements_to_the_codebase"></a>
65+
## Improvements to the Codebase
66+
67+
We welcome direct contributions to the csharp-http-client code base. Thank you!
68+
69+
### Development Environment ###
70+
71+
#### Install and run locally ####
72+
73+
##### Prerequisites #####
74+
75+
* Microsoft Visual Studio Community 2015
76+
* There are no external dependencies
77+
78+
##### Initial setup: #####
79+
80+
```
81+
git clone https://github.com/sendgrid/csharp-http-client.git
82+
```
83+
84+
Open `csharp-http-client/CSharpHTTPClient/CSharpHTTPClient.sln`
85+
86+
##### Execute: #####
87+
88+
See the [Example project](https://github.com/sendgrid/csharp-http-client/tree/master/Example) to get started quickly.
89+
90+
<a name="understanding_the_codebase"></a>
91+
## Understanding the Code Base
92+
93+
**/Example/Example.cs**
94+
95+
Working examples that demonstrate usage.
96+
97+
**/CSharpHTTPClient/Client.cs**
98+
99+
An HTTP client with a fluent interface using method chaining and reflection. By returning a new object on [TryGetMember](https://github.com/sendgrid/csharp-http-client/blob/master/CSharpHTTPClient/Client.cs#L191) and [_()](https://github.com/sendgrid/csharp-http-client/blob/master/CSharpHTTPClient/Client.cs#L180), we can dynamically build the URL using method chaining and [TryGetMember](https://github.com/sendgrid/csharp-http-client/blob/master/CSharpHTTPClient/Client.cs#L191) allows us to dynamically receive the method calls to achieve reflection.
100+
101+
This allows for the following mapping from a URL to a method chain:
102+
103+
`/api_client/{api_key_id}/version` maps to `client.api_client._(api_key_id).version.<method>()` where <method> is a [https://github.com/sendgrid/csharp-http-client/blob/master/CSharpHTTPClient/Client.cs#L71).
104+
105+
<a name="testing"></a>
106+
## Testing
107+
108+
All PRs require passing tests before the PR will be reviewed.
109+
110+
All test files are in the `[UnitTest](https://github.com/sendgrid/csharp-http-client/tree/master/UnitTest)` directory.
111+
112+
For the purposes of contributing to this repo, please update the [`UnitTest.cs`](https://github.com/sendgrid/csharp-http-client/blob/master/UnitTest/UnitTest.cs) file with unit tests as you modify the code.
113+
114+
From the Visual Studio menu: `Tests->Run->All Tests`
115+
116+
### Execute: ###
117+
118+
Click on the Example project, then click the `Start` button in the menu.
119+
120+
<a name="style_guidelines_and_naming_conventions"></a>
121+
## Style Guidelines & Naming Conventions
122+
123+
Generally, we follow the style guidelines as suggested by the official language. However, we ask that you conform to the styles that already exist in the library. If you wish to deviate, please explain your reasoning. In this case, we generally follow the [C# Naming Conventions](https://msdn.microsoft.com/library/ms229045(v=vs.100).aspx) and the suggestions provided by the Visual Studio IDE.
124+
125+
### Directory Structure
126+
127+
* `CSharpHTTPClient`, for the HTTP API client
128+
* `Example`, for example calls
129+
* `UnitTest`, for all tests
130+
131+
## Creating a Pull Request<a name="creating_a_pull_request"></a>
132+
133+
1. [Fork](https://help.github.com/fork-a-repo/) the project, clone your fork,
134+
and configure the remotes:
135+
136+
```bash
137+
# Clone your fork of the repo into the current directory
138+
git clone https://github.com/sendgrid/csharp-http-client
139+
# Navigate to the newly cloned directory
140+
cd csharp-http-client
141+
# Assign the original repo to a remote called "upstream"
142+
git remote add upstream https://github.com/sendgrid/csharp-http-client
143+
```
144+
145+
2. If you cloned a while ago, get the latest changes from upstream:
146+
147+
```bash
148+
git checkout <dev-branch>
149+
git pull upstream <dev-branch>
150+
```
151+
152+
3. Create a new topic branch (off the main project development branch) to
153+
contain your feature, change, or fix:
154+
155+
```bash
156+
git checkout -b <topic-branch-name>
157+
```
158+
159+
4. Commit your changes in logical chunks. Please adhere to these [git commit
160+
message guidelines](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
161+
or your code is unlikely be merged into the main project. Use Git's
162+
[interactive rebase](https://help.github.com/articles/interactive-rebase)
163+
feature to tidy up your commits before making them public.
164+
165+
4a. Create tests.
166+
167+
4b. Create or update the example code that demonstrates the functionality of this change to the code.
168+
169+
5. Locally merge (or rebase) the upstream development branch into your topic branch:
170+
171+
```bash
172+
git pull [--rebase] upstream master
173+
```
174+
175+
6. Push your topic branch up to your fork:
176+
177+
```bash
178+
git push origin <topic-branch-name>
179+
```
180+
181+
7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
182+
with a clear title and description against the `master` branch. All tests must be passing before we will review the PR.
183+
184+
If you have any additional questions, please feel free to [email](mailto:dx@sendgrid.com) us or create an issue in this repo.

0 commit comments

Comments
 (0)