Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.

Commit d1bc4d6

Browse files
committed
Merge pull request #42 from asbjornu/documentation
Adds XML documentation to all public classes, properties and methods, reducing the number of warnings from 49 to 3. The documentation should also be useful for anyone using the SharpRaven library.
2 parents d9a30ea + 6a1223d commit d1bc4d6

File tree

11 files changed

+255
-11
lines changed

11 files changed

+255
-11
lines changed

SharpRaven/Data/ExceptionFrame.cs

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,106 @@
33
using Newtonsoft.Json;
44

55
namespace SharpRaven.Data {
6+
/// <summary>
7+
/// Represents Sentry's version of <see cref="System.Diagnostics.StackFrame" />.
8+
/// </summary>
69
public class ExceptionFrame {
10+
/// <summary>
11+
/// Gets or sets the absolute path.
12+
/// </summary>
13+
/// <value>
14+
/// The absolute path.
15+
/// </value>
716
[JsonProperty(PropertyName = "abs_path")]
817
public string AbsolutePath { get; set; }
918

19+
/// <summary>
20+
/// Gets or sets the filename.
21+
/// </summary>
22+
/// <value>
23+
/// The filename.
24+
/// </value>
1025
[JsonProperty(PropertyName = "filename")]
1126
public string Filename { get; set; }
1227

28+
/// <summary>
29+
/// Gets or sets the module.
30+
/// </summary>
31+
/// <value>
32+
/// The module.
33+
/// </value>
1334
[JsonProperty(PropertyName = "module")]
1435
public string Module { get; set; }
1536

37+
/// <summary>
38+
/// Gets or sets the function.
39+
/// </summary>
40+
/// <value>
41+
/// The function.
42+
/// </value>
1643
[JsonProperty(PropertyName = "function")]
1744
public string Function { get; set; }
1845

46+
/// <summary>
47+
/// Gets or sets the vars.
48+
/// </summary>
49+
/// <value>
50+
/// The vars.
51+
/// </value>
1952
[JsonProperty(PropertyName = "vars")]
2053
public Dictionary<string, string> Vars { get; set; }
2154

55+
/// <summary>
56+
/// Gets or sets the preference context.
57+
/// </summary>
58+
/// <value>
59+
/// The preference context.
60+
/// </value>
2261
[JsonProperty(PropertyName = "pre_context")]
2362
public List<string> PreContext { get; set; }
2463

64+
/// <summary>
65+
/// Gets or sets the source.
66+
/// </summary>
67+
/// <value>
68+
/// The source.
69+
/// </value>
2570
[JsonProperty(PropertyName = "context_line")]
2671
public string Source { get; set; }
2772

73+
/// <summary>
74+
/// Gets or sets the line number.
75+
/// </summary>
76+
/// <value>
77+
/// The line number.
78+
/// </value>
2879
[JsonProperty(PropertyName = "lineno")]
2980
public int LineNumber { get; set; }
3081

82+
/// <summary>
83+
/// Gets or sets the column number.
84+
/// </summary>
85+
/// <value>
86+
/// The column number.
87+
/// </value>
3188
[JsonProperty(PropertyName = "colno")]
3289
public int ColumnNumber { get; set; }
3390

91+
/// <summary>
92+
/// Gets or sets a value indicating whether [information application].
93+
/// </summary>
94+
/// <value>
95+
/// <c>true</c> if [information application]; otherwise, <c>false</c>.
96+
/// </value>
3497
[JsonProperty(PropertyName = "in_app")]
3598
public bool InApp { get; set; }
3699

100+
/// <summary>
101+
/// Gets or sets the post context.
102+
/// </summary>
103+
/// <value>
104+
/// The post context.
105+
/// </value>
37106
[JsonProperty(PropertyName = "post_context")]
38107
public List<string> PostContext { get; set; }
39108
}

SharpRaven/Data/JsonPacket.cs

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,15 @@
88

99
namespace SharpRaven.Data
1010
{
11+
/// <summary>
12+
/// Represents the JSON packet that is transmitted to Sentry.
13+
/// </summary>
1114
public class JsonPacket
1215
{
16+
/// <summary>
17+
/// Initializes a new instance of the <see cref="JsonPacket"/> class.
18+
/// </summary>
19+
/// <param name="project">The project.</param>
1320
public JsonPacket(string project)
1421
{
1522
// Get assemblies.
@@ -45,6 +52,11 @@ public JsonPacket(string project)
4552
}
4653

4754

55+
/// <summary>
56+
/// Initializes a new instance of the <see cref="JsonPacket"/> class.
57+
/// </summary>
58+
/// <param name="project">The project.</param>
59+
/// <param name="e">The decimal.</param>
4860
public JsonPacket(string project, Exception e)
4961
{
5062
Message = e.Message;
@@ -156,25 +168,47 @@ public JsonPacket(string project, Exception e)
156168

157169
/// <summary>
158170
/// A list of relevant modules (libraries) and their versions.
159-
///
160171
/// Automated to report all modules currently loaded in project.
161172
/// </summary>
173+
/// <value>
174+
/// The modules.
175+
/// </value>
162176
[JsonProperty(PropertyName = "modules", NullValueHandling = NullValueHandling.Ignore)]
163177
public List<Module> Modules { get; set; }
164178

179+
/// <summary>
180+
/// Gets or sets the exceptions.
181+
/// </summary>
182+
/// <value>
183+
/// The exceptions.
184+
/// </value>
165185
[JsonProperty(PropertyName = "exception", NullValueHandling = NullValueHandling.Ignore)]
166186
public List<SentryException> Exceptions { get; set; }
167187

188+
/// <summary>
189+
/// Gets or sets the <see cref="SentryRequest"/> object, containing information about the HTTP request.
190+
/// </summary>
191+
/// <value>
192+
/// The <see cref="SentryRequest"/> object, containing information about the HTTP request.
193+
/// </value>
168194
[JsonProperty(PropertyName = "request", NullValueHandling = NullValueHandling.Ignore)]
169195
public SentryRequest Request { get; set; }
170196

197+
/// <summary>
198+
/// Gets or sets the <see cref="SentryUser"/> object, which describes the authenticated User for a request.
199+
/// </summary>
200+
/// <value>
201+
/// The <see cref="SentryUser"/> object, which describes the authenticated User for a request.
202+
/// </value>
171203
[JsonProperty(PropertyName = "user", NullValueHandling = NullValueHandling.Ignore)]
172204
public SentryUser User { get; set; }
173205

174206
/// <summary>
175-
/// Turn into a JSON string.
207+
/// Converts the <see cref="JsonPacket"/> into a JSON string.
176208
/// </summary>
177-
/// <returns>json string</returns>
209+
/// <returns>
210+
/// The <see cref="JsonPacket"/> as a JSON string.
211+
/// </returns>
178212
public override string ToString()
179213
{
180214
return JsonConvert.SerializeObject(this);

SharpRaven/Data/SentryException.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
using Newtonsoft.Json;
33

44
namespace SharpRaven.Data {
5+
/// <summary>
6+
/// Represents Sentry's version of an <see cref="Exception"/>.
7+
/// </summary>
58
public class SentryException {
69
/// <summary>
710
/// The type of exception.
@@ -28,6 +31,10 @@ public class SentryException {
2831
public SentryStacktrace Stacktrace { get; set; }
2932

3033

34+
/// <summary>
35+
/// Initializes a new instance of the <see cref="SentryException"/> class.
36+
/// </summary>
37+
/// <param name="e">The <see cref="Exception"/>.</param>
3138
public SentryException(Exception e) {
3239
this.Module = e.Source;
3340
this.Type = e.Message;

SharpRaven/Data/SentryRequest.cs

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,21 @@ private bool HasHttpContext
4141
}
4242

4343

44+
/// <summary>
45+
/// Gets or sets the URL of the HTTP request.
46+
/// </summary>
47+
/// <value>
48+
/// The URL of the HTTP request.
49+
/// </value>
4450
[JsonProperty(PropertyName = "url", NullValueHandling = NullValueHandling.Ignore)]
4551
public string Url { get; set; }
4652

53+
/// <summary>
54+
/// Gets or sets the method of the HTTP request.
55+
/// </summary>
56+
/// <value>
57+
/// The method of the HTTP request.
58+
/// </value>
4759
[JsonProperty(PropertyName = "method", NullValueHandling = NullValueHandling.Ignore)]
4860
public string Method { get; set; }
4961

@@ -56,12 +68,30 @@ private bool HasHttpContext
5668
[JsonProperty(PropertyName = "data", NullValueHandling = NullValueHandling.Ignore)]
5769
public object Data { get; set; }
5870

71+
/// <summary>
72+
/// Gets or sets the query string.
73+
/// </summary>
74+
/// <value>
75+
/// The query string.
76+
/// </value>
5977
[JsonProperty(PropertyName = "query_string", NullValueHandling = NullValueHandling.Ignore)]
6078
public string QueryString { get; set; }
6179

80+
/// <summary>
81+
/// Gets or sets the cookies.
82+
/// </summary>
83+
/// <value>
84+
/// The cookies.
85+
/// </value>
6286
[JsonProperty(PropertyName = "cookies", NullValueHandling = NullValueHandling.Ignore)]
6387
public IDictionary<string, string> Cookies { get; set; }
6488

89+
/// <summary>
90+
/// Gets or sets the headers.
91+
/// </summary>
92+
/// <value>
93+
/// The headers.
94+
/// </value>
6595
[JsonProperty(PropertyName = "headers", NullValueHandling = NullValueHandling.Ignore)]
6696
public IDictionary<string, string> Headers { get; set; }
6797

@@ -76,13 +106,25 @@ private bool HasHttpContext
76106
public IDictionary<string, string> Environment { get; set; }
77107

78108

109+
/// <summary>
110+
/// Gets the request.
111+
/// </summary>
112+
/// <returns>
113+
/// If an HTTP contest is available, an instance of <see cref="SentryRequest"/>, otherwise <c>null</c>.
114+
/// </returns>
79115
public static SentryRequest GetRequest()
80116
{
81117
var request = new SentryRequest();
82118
return request.HasHttpContext ? request : null;
83119
}
84120

85121

122+
/// <summary>
123+
/// Gets the user.
124+
/// </summary>
125+
/// <returns>
126+
/// If an HTTP context is available, an instance of <see cref="SentryUser"/>, otherwise <c>null</c>.
127+
/// </returns>
86128
public SentryUser GetUser()
87129
{
88130
if (!HasHttpContext)

SharpRaven/Data/SentryStacktrace.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@
77
using Newtonsoft.Json;
88

99
namespace SharpRaven.Data {
10+
/// <summary>
11+
/// Represents Sentry's version of an <see cref="Exception"/>'s stack trace.
12+
/// </summary>
1013
public class SentryStacktrace {
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="SentryStacktrace"/> class.
16+
/// </summary>
17+
/// <param name="e">The decimal.</param>
1118
public SentryStacktrace(Exception e) {
1219
StackTrace trace = new StackTrace(e, true);
1320

@@ -44,6 +51,12 @@ private static ExceptionFrame BuildExceptionFrame(StackFrame frame)
4451
};
4552
}
4653

54+
/// <summary>
55+
/// Gets or sets the <see cref="Exception"/> frames.
56+
/// </summary>
57+
/// <value>
58+
/// The <see cref="Exception"/> frames.
59+
/// </value>
4760
[JsonProperty(PropertyName = "frames")]
4861
public ExceptionFrame[] Frames { get; set; }
4962

SharpRaven/Data/SentryUser.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,39 @@ public SentryUser(IPrincipal principal)
2424
}
2525

2626

27+
/// <summary>
28+
/// Gets or sets the user's unique identifier.
29+
/// </summary>
30+
/// <value>
31+
/// The unique identifier.
32+
/// </value>
2733
[JsonProperty(PropertyName = "id", NullValueHandling = NullValueHandling.Ignore)]
2834
public string Id { get; set; }
2935

36+
/// <summary>
37+
/// Gets or sets the user's username.
38+
/// </summary>
39+
/// <value>
40+
/// The user's username.
41+
/// </value>
3042
[JsonProperty(PropertyName = "username", NullValueHandling = NullValueHandling.Ignore)]
3143
public string Username { get; set; }
3244

45+
/// <summary>
46+
/// Gets or sets the user's email address.
47+
/// </summary>
48+
/// <value>
49+
/// The user's email address.
50+
/// </value>
3351
[JsonProperty(PropertyName = "email", NullValueHandling = NullValueHandling.Ignore)]
3452
public string Email { get; set; }
3553

54+
/// <summary>
55+
/// Gets or sets the user's IP address.
56+
/// </summary>
57+
/// <value>
58+
/// The user's IP address.
59+
/// </value>
3660
[JsonProperty(PropertyName = "ip_address", NullValueHandling = NullValueHandling.Ignore)]
3761
public string IpAddress { get; set; }
3862
}

SharpRaven/Logging/LogScrubber.cs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,22 @@
33
using SharpRaven.Logging.Filters;
44

55
namespace SharpRaven.Logging {
6+
/// <summary>
7+
/// Scrubs a JSON packet for sensitive information with <see cref="CreditCardFilter"/>, <see cref="PhoneNumberFilter"/> and <see cref="SocialSecurityFilter"/>.
8+
/// </summary>
69
public class LogScrubber : IScrubber {
10+
/// <summary>
11+
/// Gets the list of filters
12+
/// </summary>
13+
/// <value>
14+
/// The filters.
15+
/// </value>
716
public List<IFilter> Filters { get; private set; }
817

918
// Default scrubber implementation.
19+
/// <summary>
20+
/// Initializes a new instance of the <see cref="LogScrubber"/> class.
21+
/// </summary>
1022
public LogScrubber() {
1123
Filters = new List<IFilter>();
1224

@@ -18,6 +30,14 @@ public LogScrubber() {
1830
});
1931
}
2032

33+
/// <summary>
34+
/// The main interface for scrubbing a JSON packet,
35+
/// called before compression (if enabled)
36+
/// </summary>
37+
/// <param name="input">The serialized JSON packet is given here.</param>
38+
/// <returns>
39+
/// Scrubbed JSON packet.
40+
/// </returns>
2141
public string Scrub(string input) {
2242
foreach (IFilter f in Filters) {
2343
input = f.Filter(input);

0 commit comments

Comments
 (0)