Skip to content

Commit 7164316

Browse files
author
Paul C Roberts
committed
Fix all StyleCop warnings, adjust StyleCop settings to be practical
1 parent 19c6058 commit 7164316

File tree

7 files changed

+100
-36
lines changed

7 files changed

+100
-36
lines changed

Dropbox.Api/ApiException.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public ApiException(TError errorResponse, string message, Exception inner)
6464
/// Encodes the object using the supplied encoder.
6565
/// </summary>
6666
/// <param name="encoder">The encoder being used to serialize the object.</param>
67-
/// <exception cref="System.NotImplementedException"></exception>
67+
/// <exception cref="System.NotSupportedException">Exceptions cannot be encoded.</exception>
6868
void IEncodable<ApiException<TError>>.Encode(IEncoder encoder)
6969
{
7070
throw new NotSupportedException("Exceptions cannot be encoded");
@@ -77,7 +77,6 @@ void IEncodable<ApiException<TError>>.Encode(IEncoder encoder)
7777
/// <returns>
7878
/// The deserialized object. Note: this is not necessarily the current instance.
7979
/// </returns>
80-
/// <exception cref="System.NotImplementedException"></exception>
8180
ApiException<TError> IEncodable<ApiException<TError>>.Decode(IDecoder decoder)
8281
{
8382
using (var obj = decoder.GetObject())

Dropbox.Api/Babel/JsonDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// JSON string.
1313
/// </summary>
1414
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
15-
Justification="The context object doesn't represent a resource that can leak, and when it is disposed it cleans up the internal reference")]
15+
Justification = "The context object doesn't represent a resource that can leak, and when it is disposed it cleans up the internal reference")]
1616
public class JsonDecoder : IDecoder
1717
{
1818
/// <summary>

Dropbox.Api/Babel/JsonEncoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
/// JSON string.
1313
/// </summary>
1414
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable",
15-
Justification="The context object doesn't represent a resource that can leak, and when it is disposed it cleans up the internal reference")]
15+
Justification = "The context object doesn't represent a resource that can leak, and when it is disposed it cleans up the internal reference")]
1616
public sealed class JsonEncoder : IEncoder
1717
{
1818
/// <summary>

Dropbox.Api/DropboxCertHelper.cs

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
/// </summary>
1111
/// <remarks>
1212
/// <para>
13-
/// Dropbox recommends that all clients implement certficate pinning, unfortunately it isn't currently
13+
/// Dropbox recommends that all clients implement certificate pinning, unfortunately it isn't currently
1414
/// possible to implement this in a portable assembly, so this class is provided to help implement this.</para>
1515
/// <para>
1616
/// For more information about certificate pinning see
@@ -46,7 +46,8 @@ public static class DropboxCertHelper
4646
/// <summary>
4747
/// The public keys of the known valid root certificates
4848
/// </summary>
49-
private static readonly HashSet<string> ValidRoots = new HashSet<string> {
49+
private static readonly HashSet<string> ValidRoots = new HashSet<string>
50+
{
5051
// CN=DigiCert Assured ID Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
5152
"3082010A0282010100AD0E15CEE443805CB187F3B760F97112A5AEDC269488AAF4CEF520" +
5253
"392858600CF880DAA9159532613CB5B128848A8ADC9F0A0C83177A8F90AC8AE779535C31" +
@@ -56,6 +57,7 @@ public static class DropboxCertHelper
5657
"C8497C3198336C22E987D0325AA2BA138211ED39179D993A72A1E6FAA4D9D5173175AE85" +
5758
"7D22AE3F014686F62879C8B1DAE45717C47E1C0EB0B492A656B3BDB297EDAAA7F0B7C5A8" +
5859
"3F9516D0FFA196EB085F18774F0203010001",
60+
5961
// CN=DigiCert Global Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
6062
"3082010A0282010100E23BE11172DEA8A4D3A357AA50A28F0B7790C9A2A5EE12CE965B01" +
6163
"0920CC0193A74E30B753F743C46900579DE28D22DD870640008109CECE1B83BFDFCD3B71" +
@@ -65,6 +67,7 @@ public static class DropboxCertHelper
6567
"4F5F6C765EA04B37919EDC22E66DCE141A8E6ACBFECDB3146417C75B299E32BFF2EEFAD3" +
6668
"0B42D4ABB74132DA0CD4EFF881D5BB8D583FB51BE84928A270DA3104DDF7B216F24C0A4E" +
6769
"07A8ED4A3D5EB57FA390C3AF270203010001",
70+
6871
// CN=DigiCert High Assurance EV Root CA, OU=www.digicert.com, O=DigiCert Inc, C=US
6972
"3082010A0282010100C6CCE573E6FBD4BBE52D2D32A6DFE5813FC9CD2549B6712AC3D594" +
7073
"3467A20A1CB05F69A640B1C4B7B28FD098A4A941593AD3DC94D63CDB7438A44ACC4D2582" +
@@ -74,10 +77,12 @@ public static class DropboxCertHelper
7477
"2C7E98CD1A0616A46873D03404135CA171D35A7C55DB5E64E13787305604E511B4298012" +
7578
"F1793988A202117C2766B788B778F2CA0AA838AB0A64C2BF665D9584C1A1251E875D1A50" +
7679
"0B2012CC41BB6E0B5138B84BCB0203010001",
80+
7781
// CN=Entrust Root Certification Authority - EC1, OU="(c) 2012 Entrust, Inc. - for authorized use only", OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US
7882
"048413C9D0BA6D417BE26CD0EB555F66021A24F45B896947E3B8C27DF1F202C59FA0F65B" +
7983
"D58B0619864F53106D072427A1A0F8D54719614C7DCA9327EA740CEF6F9609FE63EC705D" +
8084
"36AD6777AEC99D7C55443AA263511FF5E362D4A947073ECC20",
85+
8186
// CN=Entrust Root Certification Authority - G2, OU="(c) 2009 Entrust, Inc. - for authorized use only", OU=See www.entrust.net/legal-terms, O="Entrust, Inc.", C=US
8287
"3082010A0282010100BA84B672DB9E0C6BE299E93001A776EA32B895411AC9DA614E5872" +
8388
"CFFEF68279BF7361060AA527D8B35FD3454E1C72D64E32F2728A0FF78319D06A80800045" +
@@ -87,6 +92,7 @@ public static class DropboxCertHelper
8792
"A90A6E483B6FDBD4111942F78F07BFF5535F9C3EF4172CE669AC4E324C6277EAB7E8E5BB" +
8893
"34BC198BAE9C51E7B77EB553B13322E56DCF703C1AFAE29B67B683F48DA5AF624C4DE058" +
8994
"AC64341203F8B68D946324A4710203010001",
95+
9096
// CN=Entrust Root Certification Authority, OU="(c) 2006 Entrust, Inc.", OU=www.entrust.net/CPS is incorporated by reference, O="Entrust, Inc.", C=US
9197
"3082010A0282010100B695B64342FAC66D2A6F48DF944C395705EEC37911416836EDECFE" +
9298
"9A018FA13828FCF71046662E4D1E1AB11A4EC6D1C09588B0C9FF318B3303DBB7837B3E20" +
@@ -96,6 +102,7 @@ public static class DropboxCertHelper
96102
"AC52964BAA518DE4133119E84E4D9FDBACB36AD5BC395471CA7A7A7F90DD7D1D80D981BB" +
97103
"5926C211FEE693E2F780E465FB34370E2980704DAF38862E9E7F57AF9E17AEEB1CCB2821" +
98104
"5FB61CD8E7A20422F9D3DAD8CB0203010001",
105+
99106
// CN=Entrust.net Certification Authority (2048), OU=(c) 1999 Entrust.net Limited, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), O=Entrust.net
100107
"3082010A0282010100AD4D4BA91286B2EAA320071516642A2B4BD1BF0B4A4D8EED8076A5" +
101108
"67B77840C07342C868C0DB532BDD5EB8769835938B1A9D7C133A0E1F5BB71ECFE524141E" +
@@ -105,6 +112,7 @@ public static class DropboxCertHelper
105112
"B2D448CE0532558AFDB2644C0EE4980775DB7FDFB9085560853029F97B48A46986E3353F" +
106113
"1E865D7A7A15BDEF008E1522541700902693BC0E496891BFF847D39D9542C10E4DDF6F26" +
107114
"CFC3182162664370D6D5C007E10203010001",
115+
108116
// CN=GeoTrust Global CA, O=GeoTrust Inc., C=US
109117
"3082010A0282010100DACC186330FDF417231A567E5BDF3C6C38E471B77891D4BCA1D84C" +
110118
"F8A843B603E94D21070888DA582F663929BD05788B9D38E805B76A7E71A4E6C460A6B0EF" +
@@ -114,10 +122,12 @@ public static class DropboxCertHelper
114122
"36FC66E6CB8EA4391900B7950239910B0EFE382ED11D059AF64D3E6F0F071DAF2C1E8F60" +
115123
"39E2FA36531339D45E262BDB3DA814BD32EB180328520471E5AB333DE138BB073684629C" +
116124
"79EA1630F45FC02BE8716BE4F90203010001",
125+
117126
// CN=GeoTrust Primary Certification Authority - G2, OU=(c) 2007 GeoTrust Inc. - For authorized use only, O=GeoTrust Inc., C=US
118127
"0415B1E8FD031543E5ACEB87371162EFD28336527D45570B4A8D7B543B3A6E5F1502C050" +
119128
"A6CF252F7DCA48B8C750631C2A21087C9A36D80BFED126C55831302825F35D5DA3B8B6A5" +
120129
"B492ED6C2C9FEBDD4389A23C4B48911D50EC26DFD6602EBD21",
130+
121131
// CN=GeoTrust Primary Certification Authority - G3, OU=(c) 2008 GeoTrust Inc. - For authorized use only, O=GeoTrust Inc., C=US
122132
"3082010A0282010100DCE25E62581D3357393233FAEBCB878CA7D44ADD0688EA648E3198" +
123133
"A538901E98CF2E632BF046BC44B289A1C0280C497021959F64C0A6931202652686C6A589" +
@@ -127,6 +137,7 @@ public static class DropboxCertHelper
127137
"1DDD708D055F88A59BF2C2EEEAD140416D62381D5606C50347512019FC7B100B0E62AE76" +
128138
"55BF5F77BE3E4901533D98250376245A1DB4DB89EA79E5B6B33B3FBA4C28417F06AC6A8E" +
129139
"C1D0F6051D7DE64286E3A5D5470203010001",
140+
130141
// CN=GeoTrust Primary Certification Authority, O=GeoTrust Inc., C=US
131142
"3082010A0282010100BEB8157BFFD47C7D67AD83647BC842532DDFF684082061D601596A" +
132143
"9C4411AFEF76FD957ECE6130BB7A835F02BD0166CAEE158D6FA1309CBDA1859E943AF356" +
@@ -136,6 +147,7 @@ public static class DropboxCertHelper
136147
"369701DFCE3592DFBE67C76D77593B8F9DD6901594BC423410C139F9B1273E7ED68A75C5" +
137148
"B2AF96D3A2DE9BE498BE7DE1E981ADB66FFCD70EDAE034B00D1A77E7E30898EF58FA9C84" +
138149
"B736AFC2DFACD2F410067071350203010001",
150+
139151
// OU=Go Daddy Class 2 Certification Authority, O="The Go Daddy Group, Inc.", C=US
140152
"308201080282010100DE9DD7EA571849A15BEBD75F4886EABEDDFFE4EF671CF46568B357" +
141153
"71A05E77BBED9B49E970803D561863086FDAF2CCD03F7F0254225410D8B281D4C0753D4B" +
@@ -145,6 +157,7 @@ public static class DropboxCertHelper
145157
"5F1A42BE025165A8AE23186AFC7803A94D7F80C3FAAB5AFCA140A4CA1916FEB2C8EF5E73" +
146158
"0DEE77BD9AF67998BCB10767A2150DDDA058C6447B0A3E62285FBA41075358CF117E3874" +
147159
"C5F8FFB569908F8474EA971BAF020103",
160+
148161
// CN=Go Daddy Root Certificate Authority - G2, O="GoDaddy.com, Inc.", L=Scottsdale, S=Arizona, C=US
149162
"3082010A0282010100BF716208F1FA5934F71BC918A3F7804958E9228313A6C52043013B" +
150163
"84F1E685499F27EAF6841B4EA0B4DB7098C73201B1053E074EEEF4FA4F2F593022E7AB19" +
@@ -154,6 +167,7 @@ public static class DropboxCertHelper
154167
"9623DFAC3A819A0E29C51CA9E95D1EB69E9E300A39CEF18880FB4B5DCC32EC8562432534" +
155168
"0256270191B43B702A3F6EB1E89C88017D9FD4F9DB536D609DBF2CE758ABB85F46FCCEC4" +
156169
"1B033C09EB49315C6946B3E0470203010001",
170+
157171
// SERIALNUMBER=07969287, CN=Go Daddy Secure Certification Authority, OU=http://certificates.godaddy.com/repository, O="GoDaddy.com, Inc.", L=Scottsdale, S=Arizona, C=US
158172
"3082010A0282010100C42DD5158C9C264CEC3235EB5FB859015AA66181593B7063ABE3DC" +
159173
"3DC72AB8C933D379E43AED3C3023848EB33014B6B287C33D9554049EDF99DD0B251E21DE" +
@@ -163,15 +177,18 @@ public static class DropboxCertHelper
163177
"4453703095C39C2B582B3D08744AF2BE51B0BF87D04C27586BB535C59DAF1731F80B8FEE" +
164178
"AD813605890898CF3AAF2587C049EAA7FD67F7458E97CC1439E23685B57E1A37FD16F671" +
165179
"119A743016FE1394A33F840D4F0203010001",
180+
166181
// [email protected], CN=Thawte Premium Server CA, OU=Certification Services Division, O=Thawte Consulting cc, L=Cape Town, S=Western Cape, C=ZA
167182
"30818902818100D236366A8BD7C25B9EDA8141628F38EE490455D6D0EF1C1B951647EF18" +
168183
"48353A52F42B6A068F3B2FEA56E3AF868D9E17F79EB46575024DEFCB09A22151D89BD067" +
169184
"D0BA0D92061473D493CB972A009C5C4E0CBCFA1552FCF2446EDA114A6E089F2F2DE3F9AA" +
170185
"3A8673B6465358C88905BD8311B8733FAA078DF4424DE7409D1C370203010001",
186+
171187
// CN=thawte Primary Root CA - G2, OU="(c) 2007 thawte, Inc. - For authorized use only", O="thawte, Inc.", C=US
172188
"04A2D59C827B959DF1527887FE8A16BF05E6DFA3024F0D07C60051BA0C02522D22A44239" +
173189
"C4FE8FEAC9C1BED44DFF9F7A9EE2B17C9AADA786097387D1E79AE37AA5AA6EFBBAB370C0" +
174190
"6788A235D4A39AB1FDADC2EF31FAA8B9F3FB08C691D1FB2995",
191+
175192
// CN=thawte Primary Root CA - G3, OU="(c) 2008 thawte, Inc. - For authorized use only", OU=Certification Services Division, O="thawte, Inc.", C=US
176193
"3082010A0282010100B2BF272CFBDBD85BDD787B1B9E776681CB3EBC7CAEF3A6279A34A3" +
177194
"683171383362E4F3716679B1A965A3A58BD58F602D3F42CCAA6B32C023CB2C41DDE4DFFC" +
@@ -181,6 +198,7 @@ public static class DropboxCertHelper
181198
"55357E966B8D939327CB92BBEAAC40C09FC2F880CF5DF45ADCCE7486A63E6C0B53CABD92" +
182199
"CE190672E60C5C3869C704D6BC6CCE5BF6F7689CDC25154888A1E9A9F8989CE0F3D53128" +
183200
"61116C67968D3999CBC24524390203010001",
201+
184202
// CN=thawte Primary Root CA, OU="(c) 2006 thawte, Inc. - For authorized use only", OU=Certification Services Division, O="thawte, Inc.", C=US
185203
"3082010A0282010100ACA0F0FB8059D49CC7A4CF9DA159730910450C0D2C6E68F16C5B48" +
186204
"68495937FC0B3319C2777FCC102D95341CE6EB4D09A71CD2B8C9973602B789D4245F06C0" +
@@ -211,7 +229,7 @@ public static bool IsKnownRootCertPublicKey(string publicKeyString)
211229
/// public key; <c>false</c> otherwise.</returns>
212230
public static bool IsKnownRootCertPublicKey(byte[] publicKey)
213231
{
214-
var publicKeyString = BitConverter.ToString(publicKey).Replace("-", "");
232+
var publicKeyString = BitConverter.ToString(publicKey).Replace("-", string.Empty);
215233

216234
return ValidRoots.Contains(publicKeyString);
217235
}

Dropbox.Api/DropboxClient.common.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ namespace Dropbox.Api
88
using System.Net;
99
using System.Net.Http;
1010
using System.Net.Http.Headers;
11+
using System.Reflection;
1112
using System.Text;
1213
using System.Threading.Tasks;
1314

1415
using Dropbox.Api.Babel;
15-
using System.Reflection;
1616

1717
/// <summary>
1818
/// The known route styles
@@ -101,9 +101,9 @@ public sealed partial class DropboxClient : ITransport, IDisposable
101101
/// <param name="oauth2AccessToken">The oauth2 access token for making client requests.</param>
102102
/// <param name="maxRetriesOnError">The maximum retries on a 5xx error.</param>
103103
/// <param name="userAgent">The user agent to use when making requests.</param>
104-
/// <param name="apiHostname">The hostname that will process api requests;
104+
/// <param name="apiHostname">The hostname that will process API requests;
105105
/// this is for internal Dropbox use only.</param>
106-
/// <param name="apiContentHostname">The hostname that will process api content requests;
106+
/// <param name="apiContentHostname">The hostname that will process API content requests;
107107
/// this is for internal Dropbox use only.</param>
108108
/// <remarks>
109109
/// The <paramref name="userAgent"/> helps Dropbox to identify requests coming from your application.
@@ -115,8 +115,7 @@ public DropboxClient(
115115
int maxRetriesOnError = 4,
116116
string userAgent = null,
117117
string apiHostname = "api." + DefaultDomain,
118-
string apiContentHostname = "api-content." + DefaultDomain
119-
)
118+
string apiContentHostname = "api-content." + DefaultDomain)
120119
{
121120
if (string.IsNullOrEmpty(oauth2AccessToken))
122121
{
@@ -404,6 +403,7 @@ private async Task<Result> RequestJsonString(
404403
{
405404
throw new ArgumentNullException("body");
406405
}
406+
407407
request.Content = new StreamContent(body);
408408
request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/octet-stream");
409409
break;

0 commit comments

Comments
 (0)