diff --git a/Settings.StyleCop b/Settings.StyleCop
new file mode 100644
index 0000000000..bb722e022f
--- /dev/null
+++ b/Settings.StyleCop
@@ -0,0 +1,430 @@
+
+
+ NoMerge
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+ as
+ db
+ dc
+ do
+ ef
+ id
+ if
+ in
+ is
+ my
+ no
+ on
+ sl
+ to
+ ui
+ vs
+
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ True
+ True
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+
+
+ Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+
+ False
+
+
+
+
+
+
+ False
+
+
+
+
+ False
+
+
+
+
+
+
+
+
+ Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+
+
+
+
+ 120
+
+
+
+
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Routing/BuilderExtensions.cs b/src/Microsoft.AspNet.Routing/BuilderExtensions.cs
index c841ed9ebd..1c8b066521 100644
--- a/src/Microsoft.AspNet.Routing/BuilderExtensions.cs
+++ b/src/Microsoft.AspNet.Routing/BuilderExtensions.cs
@@ -13,5 +13,4 @@ namespace Microsoft.AspNet.Builder
return builder;
}
}
-}
-
+}
\ No newline at end of file
diff --git a/src/Microsoft.AspNet.Routing/Constraints/IntRouteConstraint.cs b/src/Microsoft.AspNet.Routing/Constraints/IntRouteConstraint.cs
index e0cd79fedb..6532ef1082 100644
--- a/src/Microsoft.AspNet.Routing/Constraints/IntRouteConstraint.cs
+++ b/src/Microsoft.AspNet.Routing/Constraints/IntRouteConstraint.cs
@@ -29,7 +29,7 @@ namespace Microsoft.AspNet.Routing.Constraints
}
int result;
- string valueString = Convert.ToString(value, CultureInfo.InvariantCulture);
+ var valueString = Convert.ToString(value, CultureInfo.InvariantCulture);
return Int32.TryParse(valueString, NumberStyles.Integer, CultureInfo.InvariantCulture, out result);
}
diff --git a/src/Microsoft.AspNet.Routing/DefaultInlineConstraintResolver.cs b/src/Microsoft.AspNet.Routing/DefaultInlineConstraintResolver.cs
index 8f132778f9..c0bd82ab83 100644
--- a/src/Microsoft.AspNet.Routing/DefaultInlineConstraintResolver.cs
+++ b/src/Microsoft.AspNet.Routing/DefaultInlineConstraintResolver.cs
@@ -40,7 +40,7 @@ namespace Microsoft.AspNet.Routing
{
string constraintKey;
string argumentString;
- int indexOfFirstOpenParens = inlineConstraint.IndexOf('(');
+ var indexOfFirstOpenParens = inlineConstraint.IndexOf('(');
if (indexOfFirstOpenParens >= 0 && inlineConstraint.EndsWith(")", StringComparison.Ordinal))
{
constraintKey = inlineConstraint.Substring(0, indexOfFirstOpenParens);
@@ -92,9 +92,10 @@ namespace Microsoft.AspNet.Routing
}
else
{
- string[] arguments = argumentString.Split(',').Select(argument => argument.Trim()).ToArray();
+ var arguments = argumentString.Split(',').Select(argument => argument.Trim()).ToArray();
- var matchingConstructors = constructors.Where(ci => ci.GetParameters().Length == arguments.Length).ToArray();
+ var matchingConstructors = constructors.Where(ci => ci.GetParameters().Length == arguments.Length)
+ .ToArray();
var constructorMatches = matchingConstructors.Length;
if (constructorMatches == 0)
@@ -122,7 +123,7 @@ namespace Microsoft.AspNet.Routing
private static object[] ConvertArguments(ParameterInfo[] parameterInfos, string[] arguments)
{
var parameters = new object[parameterInfos.Length];
- for (int i = 0; i < parameterInfos.Length; i++)
+ for (var i = 0; i < parameterInfos.Length; i++)
{
var parameter = parameterInfos[i];
var parameterType = parameter.ParameterType;
diff --git a/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs b/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs
index c05c323af6..a3726c8e36 100644
--- a/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs
+++ b/src/Microsoft.AspNet.Routing/InlineRouteParameterParser.cs
@@ -43,8 +43,7 @@ namespace Microsoft.AspNet.Routing
isCatchAll: isCatchAll,
isOptional: isOptional,
defaultValue: null,
- inlineConstraint: null
- );
+ inlineConstraint: null);
}
var parameterName = parameterMatch.Groups["parameterName"].Value;
diff --git a/src/Microsoft.AspNet.Routing/RouteConstraintBuilder.cs b/src/Microsoft.AspNet.Routing/RouteConstraintBuilder.cs
index 92948f9ab6..97e89da806 100644
--- a/src/Microsoft.AspNet.Routing/RouteConstraintBuilder.cs
+++ b/src/Microsoft.AspNet.Routing/RouteConstraintBuilder.cs
@@ -29,7 +29,8 @@ namespace Microsoft.AspNet.Routing
return null;
}
- var constraints = new Dictionary(inputConstraints.Count, StringComparer.OrdinalIgnoreCase);
+ var constraints = new Dictionary(inputConstraints.Count,
+ StringComparer.OrdinalIgnoreCase);
foreach (var kvp in inputConstraints)
{
diff --git a/src/Microsoft.AspNet.Routing/RouteOptions.cs b/src/Microsoft.AspNet.Routing/RouteOptions.cs
index f0562176ed..2086e32d24 100644
--- a/src/Microsoft.AspNet.Routing/RouteOptions.cs
+++ b/src/Microsoft.AspNet.Routing/RouteOptions.cs
@@ -19,7 +19,7 @@ namespace Microsoft.AspNet.Routing
}
set
{
- if(value == null)
+ if (value == null)
{
throw new ArgumentNullException("value",
Resources.FormatPropertyOfTypeCannotBeNull(
diff --git a/src/Microsoft.AspNet.Routing/RouterMiddleware.cs b/src/Microsoft.AspNet.Routing/RouterMiddleware.cs
index d0adac1928..50e609b609 100644
--- a/src/Microsoft.AspNet.Routing/RouterMiddleware.cs
+++ b/src/Microsoft.AspNet.Routing/RouterMiddleware.cs
@@ -1,9 +1,9 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+using System.Threading.Tasks;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Routing;
-using System.Threading.Tasks;
namespace Microsoft.AspNet.Builder
{
diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs b/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs
index b4d705b431..d4e4dc78bf 100644
--- a/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs
+++ b/src/Microsoft.AspNet.Routing/Template/TemplateBinder.cs
@@ -28,7 +28,8 @@ namespace Microsoft.AspNet.Routing.Template
}
// Step 1: Get the list of values we're going to try to use to match and generate this URI
- public IDictionary GetAcceptedValues(IDictionary ambientValues, IDictionary values)
+ public IDictionary GetAcceptedValues(IDictionary ambientValues,
+ IDictionary values)
{
var context = new TemplateBindingContext(_defaults, values);
@@ -47,7 +48,8 @@ namespace Microsoft.AspNet.Routing.Template
var hasNewParameterValue = values.TryGetValue(parameterName, out newParameterValue);
object currentParameterValue = null;
- var hasCurrentParameterValue = ambientValues != null && ambientValues.TryGetValue(parameterName, out currentParameterValue);
+ var hasCurrentParameterValue = ambientValues != null &&
+ ambientValues.TryGetValue(parameterName, out currentParameterValue);
if (hasNewParameterValue && hasCurrentParameterValue)
{
@@ -73,7 +75,7 @@ namespace Microsoft.AspNet.Routing.Template
context.Accept(parameterName, currentParameterValue);
}
}
- };
+ }
// Add all remaining new values to the list of values we will use for URI generation
foreach (var kvp in values)
@@ -85,7 +87,7 @@ namespace Microsoft.AspNet.Routing.Template
}
// Accept all remaining default values if they match a required parameter
- for (int i = 0; i < _template.Parameters.Count; i++)
+ for (var i = 0; i < _template.Parameters.Count; i++)
{
var parameter = _template.Parameters[i];
if (parameter.IsOptional || parameter.IsCatchAll)
@@ -179,7 +181,7 @@ namespace Microsoft.AspNet.Routing.Template
acceptedValues.Remove(part.Name);
}
- bool isSameAsDefault = false;
+ var isSameAsDefault = false;
object defaultValue;
if (_defaults != null && _defaults.TryGetValue(part.Name, out defaultValue))
{
@@ -245,7 +247,7 @@ namespace Microsoft.AspNet.Routing.Template
private static string UriEncode(string str)
{
- string escape = Uri.EscapeUriString(str);
+ var escape = Uri.EscapeUriString(str);
return Regex.Replace(escape, "([#;?:@&=+$,])", EscapeReservedCharacters);
}
@@ -256,7 +258,7 @@ namespace Microsoft.AspNet.Routing.Template
private TemplatePart GetParameter(string name)
{
- for (int i = 0; i < _template.Parameters.Count; i++)
+ for (var i = 0; i < _template.Parameters.Count; i++)
{
var parameter = _template.Parameters[i];
if (string.Equals(parameter.Name, name, StringComparison.OrdinalIgnoreCase))
@@ -270,8 +272,8 @@ namespace Microsoft.AspNet.Routing.Template
private static bool RoutePartsEqual(object a, object b)
{
- string sa = a as string;
- string sb = b as string;
+ var sa = a as string;
+ var sb = b as string;
if (sa != null && sb != null)
{
@@ -395,7 +397,6 @@ namespace Microsoft.AspNet.Routing.Template
BufferState = SegmentState.Beginning;
UriState = SegmentState.Beginning;
-
}
public SegmentState BufferState { get; private set; }
diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs b/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs
index 260bd63cae..ed6ff5e9db 100644
--- a/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs
+++ b/src/Microsoft.AspNet.Routing/Template/TemplateMatcher.cs
@@ -37,7 +37,7 @@ namespace Microsoft.AspNet.Routing.Template
var values = new Dictionary(StringComparer.OrdinalIgnoreCase);
- for (int i = 0; i < requestSegments.Length; i++)
+ for (var i = 0; i < requestSegments.Length; i++)
{
var routeSegment = Template.Segments.Count > i ? Template.Segments[i] : null;
var requestSegment = requestSegments[i];
@@ -100,7 +100,8 @@ namespace Microsoft.AspNet.Routing.Template
}
else if (part.IsOptional)
{
- // This is optional (with no default value) - there's nothing to capture here, so just move on.
+ // This is optional (with no default value)
+ // - there's nothing to capture here, so just move on.
}
else
{
@@ -120,7 +121,7 @@ namespace Microsoft.AspNet.Routing.Template
}
}
- for (int i = requestSegments.Length; i < Template.Segments.Count; i++)
+ for (var i = requestSegments.Length; i < Template.Segments.Count; i++)
{
// We've matched the request path so far, but still have remaining route segments. These need
// to be all single-part parameter segments with default values or else they won't match.
@@ -131,7 +132,6 @@ namespace Microsoft.AspNet.Routing.Template
return null;
}
-
var part = routeSegment.Parts[0];
if (part.IsLiteral)
{
@@ -172,21 +172,24 @@ namespace Microsoft.AspNet.Routing.Template
return values;
}
- private bool MatchComplexSegment(TemplateSegment routeSegment, string requestSegment, IDictionary defaults, Dictionary values)
+ private bool MatchComplexSegment(TemplateSegment routeSegment,
+ string requestSegment,
+ IDictionary defaults,
+ Dictionary values)
{
Contract.Assert(routeSegment != null);
Contract.Assert(routeSegment.Parts.Count > 1);
// Find last literal segment and get its last index in the string
- int lastIndex = requestSegment.Length;
- int indexOfLastSegmentUsed = routeSegment.Parts.Count - 1;
+ var lastIndex = requestSegment.Length;
+ var indexOfLastSegmentUsed = routeSegment.Parts.Count - 1;
TemplatePart parameterNeedsValue = null; // Keeps track of a parameter segment that is pending a value
TemplatePart lastLiteral = null; // Keeps track of the left-most literal we've encountered
while (indexOfLastSegmentUsed >= 0)
{
- int newLastIndex = lastIndex;
+ var newLastIndex = lastIndex;
var part = routeSegment.Parts[indexOfLastSegmentUsed];
if (part.IsParameter)
@@ -199,7 +202,7 @@ namespace Microsoft.AspNet.Routing.Template
Contract.Assert(part.IsLiteral);
lastLiteral = part;
- int startIndex = lastIndex - 1;
+ var startIndex = lastIndex - 1;
// If we have a pending parameter subsegment, we must leave at least one character for that
if (parameterNeedsValue != null)
{
@@ -211,7 +214,9 @@ namespace Microsoft.AspNet.Routing.Template
return false;
}
- int indexOfLiteral = requestSegment.LastIndexOf(part.Text, startIndex, StringComparison.OrdinalIgnoreCase);
+ var indexOfLiteral = requestSegment.LastIndexOf(part.Text,
+ startIndex,
+ StringComparison.OrdinalIgnoreCase);
if (indexOfLiteral == -1)
{
// If we couldn't find this literal index, this segment cannot match
@@ -232,7 +237,8 @@ namespace Microsoft.AspNet.Routing.Template
newLastIndex = indexOfLiteral;
}
- if ((parameterNeedsValue != null) && (((lastLiteral != null) && (part.IsLiteral)) || (indexOfLastSegmentUsed == 0)))
+ if ((parameterNeedsValue != null) &&
+ (((lastLiteral != null) && (part.IsLiteral)) || (indexOfLastSegmentUsed == 0)))
{
// If we have a pending parameter that needs a value, grab that value
@@ -267,7 +273,7 @@ namespace Microsoft.AspNet.Routing.Template
}
}
- string parameterValueString = requestSegment.Substring(parameterStartIndex, parameterTextLength);
+ var parameterValueString = requestSegment.Substring(parameterStartIndex, parameterTextLength);
if (string.IsNullOrEmpty(parameterValueString))
{
@@ -298,6 +304,5 @@ namespace Microsoft.AspNet.Routing.Template
// This check is related to the check we do earlier in this function for LiteralSubsegments.
return (lastIndex == 0) || routeSegment.Parts[0].IsParameter;
}
-
}
}
diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs b/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs
index be6dc62012..c289829273 100644
--- a/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs
+++ b/src/Microsoft.AspNet.Routing/Template/TemplateParser.cs
@@ -35,9 +35,10 @@ namespace Microsoft.AspNet.Routing.Template
{
if (context.Current == Separator)
{
- // If we get here is means that there's a consecutive '/' character. Templates don't start with a '/' and
- // parsing a segment consumes the separator.
- throw new ArgumentException(Resources.TemplateRoute_CannotHaveConsecutiveSeparators, "routeTemplate");
+ // If we get here is means that there's a consecutive '/' character.
+ // Templates don't start with a '/' and parsing a segment consumes the separator.
+ throw new ArgumentException(Resources.TemplateRoute_CannotHaveConsecutiveSeparators,
+ "routeTemplate");
}
else
{
@@ -153,8 +154,8 @@ namespace Microsoft.AspNet.Routing.Template
if (context.Current == CloseBrace)
{
- // This is an 'escaped' brace in a parameter name, which is not allowed. We'll just accept it for now
- // and let the validation code for the name find it.
+ // This is an 'escaped' brace in a parameter name, which is not allowed.
+ // We'll just accept it for now and let the validation code for the name find it.
}
else
{
@@ -179,8 +180,6 @@ namespace Microsoft.AspNet.Routing.Template
var templatePart = InlineRouteParameterParser.ParseRouteParameter(rawParameter,
context.ConstraintResolver);
-
-
if (templatePart.IsCatchAll && templatePart.IsOptional)
{
context.Error = Resources.TemplateRoute_CatchAllCannotBeOptional;
@@ -287,13 +286,15 @@ namespace Microsoft.AspNet.Routing.Template
private static bool IsAllValid(TemplateParserContext context, List segments)
{
// A catch-all parameter must be the last part of the last segment
- for (int i = 0; i < segments.Count; i++)
+ for (var i = 0; i < segments.Count; i++)
{
var segment = segments[i];
- for (int j = 0; j < segment.Parts.Count; j++)
+ for (var j = 0; j < segment.Parts.Count; j++)
{
var part = segment.Parts[j];
- if (part.IsParameter && part.IsCatchAll && (i != segments.Count - 1 || j != segment.Parts.Count - 1))
+ if (part.IsParameter &&
+ part.IsCatchAll &&
+ (i != segments.Count - 1 || j != segment.Parts.Count - 1))
{
context.Error = Resources.TemplateRoute_CatchAllMustBeLast;
return false;
@@ -307,7 +308,7 @@ namespace Microsoft.AspNet.Routing.Template
private static bool IsSegmentValid(TemplateParserContext context, TemplateSegment segment)
{
// If a segment has multiple parts, then it can't contain a catch all.
- for (int i = 0; i < segment.Parts.Count; i++)
+ for (var i = 0; i < segment.Parts.Count; i++)
{
var part = segment.Parts[i];
if (part.IsParameter && part.IsCatchAll && segment.Parts.Count > 1)
@@ -318,7 +319,7 @@ namespace Microsoft.AspNet.Routing.Template
}
// if a segment has multiple parts, then the parameters can't be optional
- for (int i = 0; i < segment.Parts.Count; i++)
+ for (var i = 0; i < segment.Parts.Count; i++)
{
var part = segment.Parts[i];
if (part.IsParameter && part.IsOptional && segment.Parts.Count > 1)
@@ -330,7 +331,7 @@ namespace Microsoft.AspNet.Routing.Template
// A segment cannot containt two consecutive parameters
var isLastSegmentParameter = false;
- for (int i = 0; i < segment.Parts.Count; i++)
+ for (var i = 0; i < segment.Parts.Count; i++)
{
var part = segment.Parts[i];
if (part.IsParameter && isLastSegmentParameter)
@@ -349,23 +350,26 @@ namespace Microsoft.AspNet.Routing.Template
{
if (parameterName.Length == 0)
{
- context.Error = String.Format(CultureInfo.CurrentCulture, Resources.TemplateRoute_InvalidParameterName, parameterName);
+ context.Error = String.Format(CultureInfo.CurrentCulture,
+ Resources.TemplateRoute_InvalidParameterName, parameterName);
return false;
}
- for (int i = 0; i < parameterName.Length; i++)
+ for (var i = 0; i < parameterName.Length; i++)
{
var c = parameterName[i];
if (c == Separator || c == OpenBrace || c == CloseBrace || c == QuestionMark)
{
- context.Error = String.Format(CultureInfo.CurrentCulture, Resources.TemplateRoute_InvalidParameterName, parameterName);
+ context.Error = String.Format(CultureInfo.CurrentCulture,
+ Resources.TemplateRoute_InvalidParameterName, parameterName);
return false;
}
}
if (!context.ParameterNames.Add(parameterName))
{
- context.Error = String.Format(CultureInfo.CurrentCulture, Resources.TemplateRoute_RepeatedParameter, parameterName);
+ context.Error = String.Format(CultureInfo.CurrentCulture,
+ Resources.TemplateRoute_RepeatedParameter, parameterName);
return false;
}
@@ -379,7 +383,8 @@ namespace Microsoft.AspNet.Routing.Template
if (literal.IndexOf(QuestionMark) != -1)
{
- context.Error = String.Format(CultureInfo.CurrentCulture, Resources.TemplateRoute_InvalidLiteral, literal);
+ context.Error = String.Format(CultureInfo.CurrentCulture,
+ Resources.TemplateRoute_InvalidLiteral, literal);
return false;
}
@@ -392,7 +397,6 @@ namespace Microsoft.AspNet.Routing.Template
routeTemplate.StartsWith("/", StringComparison.Ordinal);
}
-
private class TemplateParserContext
{
private readonly string _template;
diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateRoute.cs b/src/Microsoft.AspNet.Routing/Template/TemplateRoute.cs
index fd0f0b64d0..4af40c6e2c 100644
--- a/src/Microsoft.AspNet.Routing/Template/TemplateRoute.cs
+++ b/src/Microsoft.AspNet.Routing/Template/TemplateRoute.cs
@@ -198,8 +198,8 @@ namespace Microsoft.AspNet.Routing.Template
if (_defaults.ContainsKey(parameter.Name))
{
throw new InvalidOperationException(
- Resources.
- FormatTemplateRoute_CannotHaveDefaultValueSpecifiedInlineAndExplicitly(parameter.Name));
+ Resources
+ .FormatTemplateRoute_CannotHaveDefaultValueSpecifiedInlineAndExplicitly(parameter.Name));
}
else
{
diff --git a/src/Microsoft.AspNet.Routing/Template/TemplateSegment.cs b/src/Microsoft.AspNet.Routing/Template/TemplateSegment.cs
index bce46d1829..acd93ac113 100644
--- a/src/Microsoft.AspNet.Routing/Template/TemplateSegment.cs
+++ b/src/Microsoft.AspNet.Routing/Template/TemplateSegment.cs
@@ -1,7 +1,6 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
-
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;