Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testing better-lambda #96

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
7 changes: 3 additions & 4 deletions AspNetWebStack/src/Common/Routing/RouteParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -355,10 +355,9 @@ private static Exception ValidateUriParts(List<string> pathSegments)
return exception;
}

foundCatchAllParameter = subsegments.Any<PathSubsegment>(
seg =>
(seg is PathParameterSubsegment)
&& ((PathParameterSubsegment)seg).IsCatchAll
foundCatchAllParameter = subsegments.Any<PathSubsegment>(seg =>
(seg is PathParameterSubsegment)
&& ((PathParameterSubsegment)seg).IsCatchAll
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -359,10 +359,9 @@ string redirectUrl
// Declined permissions and skipped permissions can persist through multiple pages. So we need to cross check
// them against the current pages permissions, this will determine if we should invoke the denied permission hook.
bool deniedPermissions = missingPermissions
.Where(
permission =>
declinedPermissions.Contains(permission)
|| skippedPermissions.Contains(permission)
.Where(permission =>
declinedPermissions.Contains(permission)
|| skippedPermissions.Contains(permission)
)
.Any();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ internal sealed class FingerprintingExpressionVisitor : ExpressionVisitor
private readonly List<object> _seenConstants = new List<object>();
private readonly List<ParameterExpression> _seenParameters =
new List<ParameterExpression>();
private readonly ExpressionFingerprintChain _currentChain =
new ExpressionFingerprintChain();
private readonly ExpressionFingerprintChain _currentChain = new ExpressionFingerprintChain(

);
private bool _gaveUp;

private FingerprintingExpressionVisitor() { }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ namespace Microsoft.Web.Mvc.ModelBinding
{
public static class ModelBinderProviders
{
private static readonly ModelBinderProviderCollection _providers =
CreateDefaultCollection();
private static readonly ModelBinderProviderCollection _providers = CreateDefaultCollection(

);

public static ModelBinderProviderCollection Providers
{
Expand Down
4 changes: 2 additions & 2 deletions AspNetWebStack/src/Microsoft.Web.Mvc/RadioExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ from object value in defaultValues
}
}

IEnumerable<MvcHtmlString> radioButtons = selectList.Select(
item => htmlHelper.RadioButton(name, item.Value, item.Selected, htmlAttributes)
IEnumerable<MvcHtmlString> radioButtons = selectList.Select(item =>
htmlHelper.RadioButton(name, item.Value, item.Selected, htmlAttributes)
);

return radioButtons.ToArray();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ public CookieState this[string name]
return null;
}

CookieState cookie = Cookies.FirstOrDefault(
c => String.Equals(c.Name, name, StringComparison.OrdinalIgnoreCase)
CookieState cookie = Cookies.FirstOrDefault(c =>
String.Equals(c.Name, name, StringComparison.OrdinalIgnoreCase)
);
if (cookie == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,10 @@ string name

IEnumerable<CookieHeaderValue> cookieHeaderValues = GetCookies(headers);
CookieHeaderValue[] matches = cookieHeaderValues
.Where(
header =>
header.Cookies.Any(
state =>
String.Equals(state.Name, name, StringComparison.OrdinalIgnoreCase)
)
.Where(header =>
header.Cookies.Any(state =>
String.Equals(state.Name, name, StringComparison.OrdinalIgnoreCase)
)
)
.ToArray();
return new Collection<CookieHeaderValue>(matches);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,8 @@ string parameterName
}

// Look for parameter
return parentContentType.Parameters.FirstOrDefault(
nvp => String.Equals(nvp.Name, parameterName, StringComparison.OrdinalIgnoreCase)
return parentContentType.Parameters.FirstOrDefault(nvp =>
String.Equals(nvp.Name, parameterName, StringComparison.OrdinalIgnoreCase)
);
}
}
Expand Down
15 changes: 7 additions & 8 deletions AspNetWebStack/src/System.Web.Cors/CorsResult.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,20 @@ public virtual IDictionary<string, string> ToResponseHeaders()
if (AllowedMethods.Count > 0)
{
// Filter out simple methods
IEnumerable<string> nonSimpleAllowMethods = AllowedMethods.Where(
m => !CorsConstants.SimpleMethods.Contains(m, StringComparer.OrdinalIgnoreCase)
IEnumerable<string> nonSimpleAllowMethods = AllowedMethods.Where(m =>
!CorsConstants.SimpleMethods.Contains(m, StringComparer.OrdinalIgnoreCase)
);
AddHeader(headers, CorsConstants.AccessControlAllowMethods, nonSimpleAllowMethods);
}

if (AllowedHeaders.Count > 0)
{
// Filter out simple request headers
IEnumerable<string> nonSimpleAllowRequestHeaders = AllowedHeaders.Where(
header =>
!CorsConstants.SimpleRequestHeaders.Contains(
header,
StringComparer.OrdinalIgnoreCase
)
IEnumerable<string> nonSimpleAllowRequestHeaders = AllowedHeaders.Where(header =>
!CorsConstants.SimpleRequestHeaders.Contains(
header,
StringComparer.OrdinalIgnoreCase
)
);
AddHeader(
headers,
Expand Down
4 changes: 3 additions & 1 deletion AspNetWebStack/src/System.Web.Http/AuthorizeAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@ private static bool SkipAuthorization(HttpActionContext actionContext)
.ActionDescriptor.GetCustomAttributes<AllowAnonymousAttribute>()
.Any()
|| actionContext
.ControllerContext.ControllerDescriptor.GetCustomAttributes<AllowAnonymousAttribute>()
.ControllerContext.ControllerDescriptor.GetCustomAttributes<AllowAnonymousAttribute>(

)
.Any();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@ public abstract class HttpActionDescriptor

private static readonly ResponseMessageResultConverter _responseMessageResultConverter =
new ResponseMessageResultConverter();
private static readonly VoidResultConverter _voidResultConverter =
new VoidResultConverter();
private static readonly VoidResultConverter _voidResultConverter = new VoidResultConverter(

);

protected HttpActionDescriptor()
{
Expand Down Expand Up @@ -79,8 +80,9 @@ public virtual HttpActionBinding ActionBinding
ServicesContainer controllerServices = _controllerDescriptor
.Configuration
.Services;
IActionValueBinder actionValueBinder =
controllerServices.GetActionValueBinder();
IActionValueBinder actionValueBinder = controllerServices.GetActionValueBinder(

);
HttpActionBinding actionBinding = actionValueBinder.GetBinding(this);
_actionBinding = actionBinding;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ IModelBinder binder
)
{
HttpConfiguration config = parameter.Configuration;
IEnumerable<ValueProviderFactory> valueProviderFactories =
new ModelBinderAttribute().GetValueProviderFactories(config);
IEnumerable<ValueProviderFactory> valueProviderFactories = new ModelBinderAttribute(

).GetValueProviderFactories(config);

return BindWithModelBinding(parameter, binder, valueProviderFactories);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ public ICollection<Type> GetControllerTypes(string controllerName)

private Dictionary<string, ILookup<string, Type>> InitializeCache()
{
IAssembliesResolver assembliesResolver =
_configuration.Services.GetAssembliesResolver();
IAssembliesResolver assembliesResolver = _configuration.Services.GetAssembliesResolver(

);
IHttpControllerTypeResolver controllersResolver =
_configuration.Services.GetHttpControllerTypeResolver();

Expand Down
5 changes: 3 additions & 2 deletions AspNetWebStack/src/System.Web.Http/FromBodyAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ public override HttpParameterBinding GetBinding(HttpParameterDescriptor paramete
}

IEnumerable<MediaTypeFormatter> formatters = parameter.Configuration.Formatters;
IBodyModelValidator validator =
parameter.Configuration.Services.GetBodyModelValidator();
IBodyModelValidator validator = parameter.Configuration.Services.GetBodyModelValidator(

);

return parameter.BindWithFormatter(formatters, validator);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -447,8 +447,10 @@ Exception exception

return request.CreateErrorResponse(
statusCode,
includeErrorDetail =>
new HttpError(exception, includeErrorDetail) { Message = message }
includeErrorDetail => new HttpError(exception, includeErrorDetail)
{
Message = message
}
);
}

Expand Down
4 changes: 2 additions & 2 deletions AspNetWebStack/src/System.Web.Http/Metadata/ModelMetadata.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ IEnumerable<ModelValidatorProvider> validatorProviders
throw Error.ArgumentNull("validatorProviders");
}

return validatorProviders.SelectMany(
provider => provider.GetValidators(this, validatorProviders)
return validatorProviders.SelectMany(provider =>
provider.GetValidators(this, validatorProviders)
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,17 +129,16 @@ internal static ParameterBindingRulesCollection GetDefaultParameterBinders()
);

// Warning binder for HttpContent.
pb.Add(
parameter =>
typeof(HttpContent).IsAssignableFrom(parameter.ParameterType)
? parameter.BindAsError(
Error.Format(
SRResources.ParameterBindingIllegalType,
parameter.ParameterType.Name,
parameter.ParameterName
)
pb.Add(parameter =>
typeof(HttpContent).IsAssignableFrom(parameter.ParameterType)
? parameter.BindAsError(
Error.Format(
SRResources.ParameterBindingIllegalType,
parameter.ParameterType.Name,
parameter.ParameterName
)
: null
)
: null
);

return pb;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ public void InsertRange(Type serviceType, int index, IEnumerable<object> service
}

object[] filteredServices = services.Where(svc => svc != null).ToArray();
object incorrectlyTypedService = filteredServices.FirstOrDefault(
svc => !serviceType.IsAssignableFrom(svc.GetType())
object incorrectlyTypedService = filteredServices.FirstOrDefault(svc =>
!serviceType.IsAssignableFrom(svc.GetType())
);
if (incorrectlyTypedService != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,9 @@ IEnumerable<ModelValidator> validators
{
modelKey = validationContext.RootPrefix;
foreach (
IBodyModelValidatorKeyBuilder keyBuilder in validationContext.KeyBuilders.Reverse()
IBodyModelValidatorKeyBuilder keyBuilder in validationContext.KeyBuilders.Reverse(

)
)
{
modelKey = keyBuilder.AppendTo(modelKey);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,12 @@ select ExtractParameterFromDictionary(
// to simplify the logic, force the rest of the pipeline to execute in an asynchronous callback
listener.SetContinuation(
() =>
ThreadPool.QueueUserWorkItem(
_ =>
asyncResult.MarkCompleted(
false /* completedSynchronously */
,
asyncCallback
)
ThreadPool.QueueUserWorkItem(_ =>
asyncResult.MarkCompleted(
false /* completedSynchronously */
,
asyncCallback
)
)
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ string propertyName
// We prefer [UIHint("...", PresentationLayer = "MVC")] but will fall back to [UIHint("...")]
IEnumerable<UIHintAttribute> uiHintAttributes = attributeList.OfType<UIHintAttribute>();
UIHintAttribute uiHintAttribute =
uiHintAttributes.FirstOrDefault(
a =>
String.Equals(
a.PresentationLayer,
"MVC",
StringComparison.OrdinalIgnoreCase
)
uiHintAttributes.FirstOrDefault(a =>
String.Equals(a.PresentationLayer, "MVC", StringComparison.OrdinalIgnoreCase)
)
?? uiHintAttributes.FirstOrDefault(a => String.IsNullOrEmpty(a.PresentationLayer));
if (uiHintAttribute != null)
Expand Down
4 changes: 2 additions & 2 deletions AspNetWebStack/src/System.Web.Mvc/DefaultModelBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,8 @@ PropertyDescriptor propertyDescriptor
// Convert FormatExceptions (type conversion failures) into InvalidValue messages
foreach (
ModelError error in modelState
.Errors.Where(
err => String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null
.Errors.Where(err =>
String.IsNullOrEmpty(err.ErrorMessage) && err.Exception != null
)
.ToList()
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,8 +309,8 @@ TemplateHelpers.TemplateHelperDelegate templateHelper
}

foreach (
ModelMetadata propertyMetadata in modelMetadata.Properties.Where(
pm => ShouldShow(pm, templateInfo)
ModelMetadata propertyMetadata in modelMetadata.Properties.Where(pm =>
ShouldShow(pm, templateInfo)
)
)
{
Expand Down
4 changes: 2 additions & 2 deletions AspNetWebStack/src/System.Web.Mvc/MultiSelectList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,8 @@ private SelectListGroup GetGroup(object container, HashSet<string> disabledGroup

// We use StringComparison.CurrentCulture because the group name is used to display as the value of
// optgroup HTML tag's label attribute.
SelectListGroup group = _groups.FirstOrDefault(
g => String.Equals(g.Name, groupName, StringComparison.CurrentCulture)
SelectListGroup group = _groups.FirstOrDefault(g =>
String.Equals(g.Name, groupName, StringComparison.CurrentCulture)
);
if (group == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,8 @@ ControllerContext controllerContext
actionName = actionName ?? candidate.ActionDescriptor.ActionName;

if (
candidate.ActionNameSelectors.All(
selector => selector(controllerContext, actionName)
candidate.ActionNameSelectors.All(selector =>
selector(controllerContext, actionName)
)
)
{
Expand Down
4 changes: 2 additions & 2 deletions AspNetWebStack/src/System.Web.Mvc/TypeCacheUtil.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ TypeCacheSerializer serializer
List<Type> deserializedTypes = serializer.DeserializeTypes(reader);
if (
deserializedTypes != null
&& deserializedTypes.All(
type => TypeIsPublicClass(type) && predicate(type)
&& deserializedTypes.All(type =>
TypeIsPublicClass(type) && predicate(type)
)
)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,11 @@ public override void GenerateStartBlockCode(Block target, CodeGeneratorContext c
{
_writer = context.CreateCodeWriter();

string prefix = context.BuildCodeString(
cw =>
cw.WriteHelperHeaderPrefix(
context.Host.GeneratedClassContext.TemplateTypeName,
context.Host.StaticHelpers
)
string prefix = context.BuildCodeString(cw =>
cw.WriteHelperHeaderPrefix(
context.Host.GeneratedClassContext.TemplateTypeName,
context.Host.StaticHelpers
)
);

_writer.WriteLinePragma(
Expand Down
Loading