Skip to content

Commit 461810c

Browse files
committed
More StyleCop fixes.
1 parent b9ae2ab commit 461810c

File tree

14 files changed

+69
-110
lines changed

14 files changed

+69
-110
lines changed

Settings.StyleCop

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<StyleCopSettings Version="4.3">
1+
<StyleCopSettings Version="105">
22
<Parsers>
33
<Parser ParserId="StyleCop.CSharp.CsParser">
44
<ParserSettings>
@@ -63,5 +63,15 @@
6363
</CollectionProperty>
6464
</AnalyzerSettings>
6565
</Analyzer>
66+
<Analyzer AnalyzerId="StyleCop.CSharp.MaintainabilityRules">
67+
<Rules>
68+
<Rule Name="StatementMustNotUseUnnecessaryParenthesis">
69+
<RuleSettings>
70+
<BooleanProperty Name="Enabled">False</BooleanProperty>
71+
</RuleSettings>
72+
</Rule>
73+
</Rules>
74+
<AnalyzerSettings />
75+
</Analyzer>
6676
</Analyzers>
6777
</StyleCopSettings>

samples/OAuthConsumer/GoogleAddressBook.aspx.cs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,14 @@ protected void getAddressBookButton_Click(object sender, EventArgs e) {
5151

5252
XDocument contactsDocument =
5353
await google.GetContactsAsync(this.AccessToken, 5, 1, Response.ClientDisconnectedToken);
54-
var contacts = from entry in contactsDocument.Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom"))
55-
select
56-
new {
57-
Name = entry.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value,
58-
Email =
59-
entry.Element(XName.Get("email", "http://schemas.google.com/g/2005")).Attribute("address").Value
60-
};
54+
var contacts =
55+
from entry in contactsDocument.Root.Elements(XName.Get("entry", "http://www.w3.org/2005/Atom"))
56+
select
57+
new {
58+
Name = entry.Element(XName.Get("title", "http://www.w3.org/2005/Atom")).Value,
59+
Email =
60+
entry.Element(XName.Get("email", "http://schemas.google.com/g/2005")).Attribute("address").Value
61+
};
6162
StringBuilder tableBuilder = new StringBuilder();
6263
tableBuilder.Append("<table><tr><td>Name</td><td>Email</td></tr>");
6364
foreach (var contact in contacts) {

samples/OpenIdOfflineProvider/Controllers/HomeController.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
1+
//-----------------------------------------------------------------------
2+
// <copyright file="HomeController.cs" company="Andrew Arnott">
3+
// Copyright (c) Andrew Arnott. All rights reserved.
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
28
using System;
39
using System.Collections.Generic;
410
using System.Linq;

samples/OpenIdOfflineProvider/Controllers/ProviderController.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
1+
//-----------------------------------------------------------------------
2+
// <copyright file="ProviderController.cs" company="Andrew Arnott">
3+
// Copyright (c) Andrew Arnott. All rights reserved.
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
28
using System;
39
using System.Collections.Generic;
410
using System.Linq;

samples/OpenIdOfflineProvider/Controllers/UserController.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
1+
//-----------------------------------------------------------------------
2+
// <copyright file="UserController.cs" company="Andrew Arnott">
3+
// Copyright (c) Andrew Arnott. All rights reserved.
4+
// </copyright>
5+
//-----------------------------------------------------------------------
6+
7+
namespace DotNetOpenAuth.OpenIdOfflineProvider.Controllers {
28
using System;
39
using System.Collections.Generic;
410
using System.Linq;

src/DotNetOpenAuth.Core/Messaging/Channel.cs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -734,19 +734,6 @@ protected virtual async Task<IProtocolMessage> RequestCoreAsync(IDirectedProtoco
734734
}
735735
}
736736

737-
/// <summary>
738-
/// Provides derived-types the opportunity to wrap an <see cref="HttpMessageHandler"/> with another one.
739-
/// </summary>
740-
/// <param name="innerHandler">The inner handler received from <see cref="IHostFactories"/></param>
741-
/// <returns>The handler to use in <see cref="HttpClient"/> instances.</returns>
742-
protected virtual HttpMessageHandler WrapMessageHandler(HttpMessageHandler innerHandler) {
743-
//TODO: make sure that everyone calls this to wrap their handlers rather than using the one directly returned
744-
//from IHostFactories.
745-
746-
// No wrapping by default.
747-
return innerHandler;
748-
}
749-
750737
/// <summary>
751738
/// Called when receiving a direct response message, before deserialization begins.
752739
/// </summary>

src/DotNetOpenAuth.OAuth.Consumer/OAuth/OAuth1HttpMessageHandlerBase.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace DotNetOpenAuth.OAuth {
2424
/// outgoing HTTP requests per the OAuth 1.0 "3.4 Signature" in RFC 5849.
2525
/// </summary>
2626
/// <remarks>
27-
/// http://tools.ietf.org/html/rfc5849#section-3.4
27+
/// An implementation of http://tools.ietf.org/html/rfc5849#section-3.4
2828
/// </remarks>
2929
public abstract class OAuth1HttpMessageHandlerBase : DelegatingHandler {
3030
/// <summary>

src/DotNetOpenAuth.OAuth2.Client/OAuth2/ChannelElements/OAuth2ClientChannel.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ protected override async Task<IDictionary<string, string>> ReadFromResponseCoreA
116116
/// <returns>
117117
/// The deserialized message, if one is found. Null otherwise.
118118
/// </returns>
119-
protected override async Task<IDirectedProtocolMessage> ReadFromRequestCoreAsync(HttpRequestMessage request, CancellationToken cancellationToken) {
119+
protected override Task<IDirectedProtocolMessage> ReadFromRequestCoreAsync(HttpRequestMessage request, CancellationToken cancellationToken) {
120120
Requires.NotNull(request, "request");
121121

122122
Logger.Channel.DebugFormat("Incoming HTTP request: {0} {1}", request.Method, request.RequestUri.AbsoluteUri);
@@ -142,7 +142,7 @@ protected override async Task<IDirectedProtocolMessage> ReadFromRequestCoreAsync
142142
return null;
143143
}
144144

145-
return (IDirectedProtocolMessage)this.Receive(fields, recipient);
145+
return Task.FromResult((IDirectedProtocolMessage)this.Receive(fields, recipient));
146146
}
147147

148148
/// <summary>

src/DotNetOpenAuth.OpenId.Provider/OpenId/ChannelElements/ProviderSigningBindingElement.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -229,10 +229,11 @@ private string GetSignedParameterOrder(ITamperResistantOpenIdMessage signedMessa
229229
Protocol protocol = Protocol.Lookup(signedMessage.Version);
230230

231231
MessageDescription description = this.Channel.MessageDescriptions.Get(signedMessage);
232-
var signedParts = from part in description.Mapping.Values
233-
where (part.RequiredProtection & System.Net.Security.ProtectionLevel.Sign) != 0
234-
&& part.GetValue(signedMessage) != null
235-
select part.Name;
232+
var signedParts =
233+
from part in description.Mapping.Values
234+
where (part.RequiredProtection & System.Net.Security.ProtectionLevel.Sign) != 0
235+
&& part.GetValue(signedMessage) != null
236+
select part.Name;
236237
string prefix = Protocol.V20.openid.Prefix;
237238
ErrorUtilities.VerifyInternal(signedParts.All(name => name.StartsWith(prefix, StringComparison.Ordinal)), "All signed message parts must start with 'openid.'.");
238239

src/DotNetOpenAuth.OpenId.RelyingParty.UI/OpenId/RelyingParty/OpenIdAjaxRelyingParty.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -237,17 +237,18 @@ private async Task<object> AsJsonPreloadedDiscoveryResultAsync(IEnumerable<IAuth
237237
// jsonResponse discoveryResult; // contains result of call to SerializeDiscoveryAsJson(Identifier)
238238
// }
239239
var jsonAsync = (from request in requests
240-
group request by request.DiscoveryResult.UserSuppliedIdentifier into requestsByIdentifier
241-
select new {
242-
userSuppliedIdentifier = (string)requestsByIdentifier.Key,
243-
discoveryResult = this.AsJsonDiscoveryResultAsync(requestsByIdentifier, cancellationToken),
244-
}).ToArray();
240+
group request by request.DiscoveryResult.UserSuppliedIdentifier into requestsByIdentifier
241+
select new {
242+
userSuppliedIdentifier = (string)requestsByIdentifier.Key,
243+
discoveryResult = this.AsJsonDiscoveryResultAsync(requestsByIdentifier, cancellationToken),
244+
}).ToArray();
245245
await Task.WhenAll(jsonAsync.Select(j => j.discoveryResult));
246-
var json = from j in jsonAsync
247-
select new {
248-
userSuppliedIdentifier = j.userSuppliedIdentifier,
249-
discoveryResult = j.discoveryResult.Result, // await happened previously
250-
};
246+
var json =
247+
from j in jsonAsync
248+
select new {
249+
userSuppliedIdentifier = j.userSuppliedIdentifier,
250+
discoveryResult = j.discoveryResult.Result, // await happened previously
251+
};
251252
return json;
252253
}
253254

0 commit comments

Comments
 (0)