Skip to content

Commit

Permalink
fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lvermeulen committed Oct 16, 2019
1 parent 63fcc30 commit 1c1cdce
Show file tree
Hide file tree
Showing 9 changed files with 234 additions and 29 deletions.
203 changes: 203 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@

[*.proto]
indent_style=tab
indent_size=tab
tab_width=4

[*.{asax,ascx,aspx,cs,cshtml,css,htm,html,js,jsx,master,razor,skin,ts,tsx,vb,xaml,xamlx,xoml}]
indent_style=space
indent_size=4
tab_width=4

[*.{appxmanifest,build,config,csproj,dbml,discomap,dtd,json,jsproj,lsproj,njsproj,nuspec,proj,props,resjson,resw,resx,StyleCop,targets,tasks,vbproj,xml,xsd}]
indent_style=space
indent_size=2
tab_width=2

[*]

# Microsoft .NET properties
csharp_new_line_before_members_in_object_initializers=false
csharp_preferred_modifier_order=public, private, protected, internal, new, abstract, virtual, sealed, override, static, readonly, extern, unsafe, volatile, async:suggestion
csharp_space_after_cast=false
csharp_style_var_elsewhere=true:hint
csharp_style_var_for_built_in_types=false:suggestion
csharp_style_var_when_type_is_apparent=true:hint
dotnet_style_predefined_type_for_locals_parameters_members=true:hint
dotnet_style_predefined_type_for_member_access=true:hint
dotnet_style_qualification_for_event=false:hint
dotnet_style_qualification_for_field=false:hint
dotnet_style_qualification_for_method=false:hint
dotnet_style_qualification_for_property=false:hint
dotnet_style_require_accessibility_modifiers=for_non_interface_members:hint

# ReSharper properties
resharper_align_multiline_binary_expressions_chain=false
resharper_apply_on_completion=true
resharper_braces_for_for=required
resharper_braces_for_foreach=required
resharper_braces_for_ifelse=required
resharper_braces_for_while=required
resharper_braces_redundant=false
resharper_csharp_wrap_lines=false
resharper_prefer_explicit_discard_declaration=true
resharper_space_within_single_line_array_initializer_braces=true

# ReSharper inspection severities
resharper_access_to_modified_closure_highlighting=hint
resharper_assigned_value_is_never_used_highlighting=none
resharper_assignment_in_condition_expression_highlighting=none
resharper_assign_to_constant_highlighting=none
resharper_assign_to_implicit_global_in_function_scope_highlighting=none
resharper_bad_namespace_braces_indent_highlighting=warning
resharper_block_scope_redeclaration_highlighting=none
resharper_caller_callee_using_error_highlighting=none
resharper_caller_callee_using_highlighting=none
resharper_class_never_instantiated_global_highlighting=none
resharper_closure_on_modified_variable_highlighting=none
resharper_coerced_equals_using_highlighting=none
resharper_collection_never_queried_global_highlighting=none
resharper_collection_never_updated_global_highlighting=hint
resharper_comma_not_valid_here_highlighting=none
resharper_comment_typo_highlighting=none
resharper_conditional_ternary_equal_branch_highlighting=none
resharper_condition_is_always_const_highlighting=none
resharper_constructor_call_not_used_highlighting=none
resharper_css_browser_compatibility_highlighting=none
resharper_css_caniuse_feature_requires_prefix_highlighting=none
resharper_css_caniuse_unsupported_feature_highlighting=none
resharper_css_not_resolved_highlighting=none
resharper_css_obsolete_highlighting=none
resharper_css_property_does_not_override_vendor_property_highlighting=none
resharper_declaration_hides_highlighting=none
resharper_declaration_is_empty_highlighting=none
resharper_deleting_non_qualified_reference_highlighting=none
resharper_double_colons_expected_highlighting=none
resharper_double_colons_preferred_highlighting=none
resharper_duplicating_local_declaration_highlighting=none
resharper_duplicating_parameter_declaration_error_highlighting=none
resharper_duplicating_property_declaration_error_highlighting=none
resharper_duplicating_property_declaration_highlighting=none
resharper_duplicating_switch_label_highlighting=none
resharper_elided_trailing_element_highlighting=none
resharper_empty_object_property_declaration_highlighting=none
resharper_enforce_do_while_statement_braces_highlighting=warning
resharper_enforce_fixed_statement_braces_highlighting=warning
resharper_enforce_foreach_statement_braces_highlighting=warning
resharper_enforce_for_statement_braces_highlighting=warning
resharper_enforce_if_statement_braces_highlighting=warning
resharper_enforce_lock_statement_braces_highlighting=warning
resharper_enforce_using_statement_braces_highlighting=warning
resharper_enforce_while_statement_braces_highlighting=warning
resharper_error_in_xml_doc_reference_highlighting=none
resharper_es6_feature_highlighting=none
resharper_es7_feature_highlighting=none
resharper_eval_arguments_name_error_highlighting=none
resharper_experimental_feature_highlighting=none
resharper_expression_is_always_const_highlighting=none
resharper_function_parameter_named_arguments_highlighting=none
resharper_function_used_out_of_scope_highlighting=none
resharper_heuristically_unreachable_code_highlighting=none
resharper_hex_color_value_with_alpha_highlighting=none
resharper_html_attribute_not_resolved_highlighting=none
resharper_identifier_typo_highlighting=none
resharper_import_keyword_not_with_invocation_highlighting=none
resharper_inconsistent_function_returns_highlighting=none
resharper_inconsistent_naming_highlighting=none
resharper_incorrect_operand_in_type_of_comparison_highlighting=none
resharper_incorrect_triple_slash_location_highlighting=none
resharper_invalid_json_syntax_highlighting=none
resharper_invalid_value_highlighting=none
resharper_invocation_of_non_function_highlighting=none
resharper_invoked_expression_maybe_non_function_highlighting=none
resharper_join_declaration_and_initializer_js_highlighting=none
resharper_json_validation_failed_highlighting=none
resharper_js_path_not_found_highlighting=none
resharper_js_unreachable_code_highlighting=none
resharper_jump_must_be_in_loop_highlighting=none
resharper_label_or_semicolon_expected_highlighting=none
resharper_lexical_declaration_needs_block_highlighting=none
resharper_local_function_redefined_later_highlighting=none
resharper_l_value_is_expected_highlighting=none
resharper_member_can_be_made_static_local_highlighting=none
resharper_member_can_be_private_global_highlighting=none
resharper_member_can_be_protected_global_highlighting=none
resharper_missing_has_own_property_in_foreach_highlighting=none
resharper_misuse_of_owner_function_this_highlighting=none
resharper_multiple_declarations_in_foreach_highlighting=none
resharper_native_type_prototype_extending_highlighting=none
resharper_native_type_prototype_overwriting_highlighting=none
resharper_non_assigned_constant_highlighting=none
resharper_non_readonly_member_in_get_hash_code_highlighting=hint
resharper_not_all_paths_return_value_highlighting=none
resharper_not_resolved_highlighting=none
resharper_object_destructuring_without_parentheses_highlighting=none
resharper_object_literals_are_not_comma_free_highlighting=none
resharper_octal_literals_not_allowed_error_highlighting=none
resharper_parameter_only_used_for_precondition_check_local_highlighting=none
resharper_parameter_value_is_not_used_highlighting=none
resharper_path_not_resolved_highlighting=none
resharper_possibly_incorrectly_broken_statement_highlighting=none
resharper_possibly_unassigned_property_highlighting=none
resharper_property_getter_cannot_have_parameters_highlighting=none
resharper_property_setter_must_have_single_parameter_highlighting=none
resharper_qualified_expression_is_null_highlighting=none
resharper_qualified_expression_maybe_null_highlighting=none
resharper_redundant_base_qualifier_highlighting=warning
resharper_redundant_block_highlighting=none
resharper_redundant_css_hack_highlighting=none
resharper_redundant_declaration_semicolon_highlighting=warning
resharper_redundant_else_block_highlighting=none
resharper_redundant_empty_finally_block_highlighting=none
resharper_redundant_highlighting=none
resharper_redundant_intermediate_variable_highlighting=none
resharper_redundant_local_class_name_highlighting=none
resharper_redundant_local_function_name_highlighting=none
resharper_redundant_type_specification_in_default_expression_highlighting=hint
resharper_redundant_units_highlighting=none
resharper_replace_indicing_with_array_destructuring_highlighting=none
resharper_replace_indicing_with_short_hand_properties_after_destructuring_highlighting=none
resharper_replace_undefined_checking_series_with_object_destructuring_highlighting=none
resharper_replace_with_destructuring_swap_highlighting=none
resharper_requires_fallback_color_highlighting=none
resharper_return_from_global_scopet_with_value_highlighting=none
resharper_same_variable_assignment_highlighting=none
resharper_similar_expressions_comparison_highlighting=none
resharper_statement_termination_highlighting=none
resharper_string_concatenation_to_template_string_highlighting=none
resharper_string_literal_typo_highlighting=none
resharper_string_literal_wrong_quotes_highlighting=none
resharper_super_call_prohibits_this_highlighting=none
resharper_suspicious_lambda_block_highlighting=none
resharper_syntax_is_not_allowed_highlighting=none
resharper_this_in_global_context_highlighting=none
resharper_throw_must_be_followed_by_expression_highlighting=none
resharper_undeclared_global_variable_using_highlighting=none
resharper_unexpected_value_highlighting=none
resharper_unknown_css_class_highlighting=none
resharper_unknown_css_variable_highlighting=none
resharper_unknown_css_vendor_extension_highlighting=none
resharper_unsafe_comma_in_object_properties_list_highlighting=none
resharper_unused_auto_property_accessor_global_highlighting=none
resharper_unused_inherited_parameter_highlighting=none
resharper_unused_locals_highlighting=none
resharper_unused_member_global_highlighting=none
resharper_unused_member_in_super_global_highlighting=none
resharper_unused_method_return_value_global_highlighting=none
resharper_unused_parameter_highlighting=none
resharper_unused_property_highlighting=none
resharper_usage_of_definitely_unassigned_value_highlighting=none
resharper_usage_of_possibly_unassigned_value_highlighting=none
resharper_use_of_implicit_global_in_function_scope_highlighting=none
resharper_using_of_reserved_word_error_highlighting=none
resharper_using_of_reserved_word_highlighting=none
resharper_value_should_have_units_highlighting=none
resharper_variable_can_be_made_const_highlighting=none
resharper_variable_can_be_made_let_highlighting=none
resharper_variable_can_be_moved_to_inner_block_highlighting=none
resharper_variable_used_before_declared_highlighting=none
resharper_variable_used_in_inner_scope_before_declared_highlighting=none
resharper_variable_used_out_of_scope_highlighting=none
resharper_with_statement_using_error_highlighting=none
resharper_wrong_expression_statement_highlighting=none
resharper_xml_doc_comment_syntax_problem_highlighting=none
1 change: 1 addition & 0 deletions src/Flurl.Http.Xml/Flurl.Http.Xml.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/lvermeulen/Flurl.Http.Xml</RepositoryUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>

<ItemGroup>
Expand Down
14 changes: 7 additions & 7 deletions src/Flurl.Http.Xml/FlurlRequestExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public static class FlurlRequestExtensions
/// A Task whose result is the XML response body deserialized to an object of type T.
/// </returns>
public static Task<T> GetXmlAsync<T>(this IFlurlRequest request,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
return request.SendAsync(HttpMethod.Get, null, cancellationToken, completionOption).ReceiveXml<T>();
}
Expand All @@ -40,7 +40,7 @@ public static Task<T> GetXmlAsync<T>(this IFlurlRequest request,
/// A Task whose result is the XML response body parsed into an XDocument.
/// </returns>
public static Task<XDocument> GetXDocumentAsync(this IFlurlRequest request,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
return request.SendAsync(HttpMethod.Get, null, cancellationToken, completionOption).ReceiveXDocument();
}
Expand All @@ -56,7 +56,7 @@ public static Task<XDocument> GetXDocumentAsync(this IFlurlRequest request,
/// A Task whose result is the XML response body parsed into a collection of XElements.
/// </returns>
public static Task<IEnumerable<XElement>> GetXElementsFromXPath(this IFlurlRequest request, string expression,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
return request.SendAsync(HttpMethod.Get, null, cancellationToken, completionOption).ReceiveXElementsFromXPath(expression);
}
Expand All @@ -73,7 +73,7 @@ public static Task<IEnumerable<XElement>> GetXElementsFromXPath(this IFlurlReque
/// A Task whose result is the XML response body parsed into a collection of XElements.
/// </returns>
public static Task<IEnumerable<XElement>> GetXElementsFromXPath(this IFlurlRequest request, string expression, IXmlNamespaceResolver resolver,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
return request.SendAsync(HttpMethod.Get, null, cancellationToken, completionOption).ReceiveXElementsFromXPath(expression, resolver);
}
Expand Down Expand Up @@ -113,7 +113,7 @@ private static string GetMediaType(this IHttpSettingsContainer request)
/// A Task whose result is the received HttpResponseMessage.
/// </returns>
public static async Task<HttpResponseMessage> SendXmlAsync(this IFlurlRequest request, HttpMethod httpMethod, object data,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead)
{
var content = new CapturedXmlContent(request.Settings.XmlSerializer().Serialize(data), request.GetMediaType());
return await request.SendAsync(httpMethod, content, cancellationToken, completionOption);
Expand All @@ -130,7 +130,7 @@ public static async Task<HttpResponseMessage> SendXmlAsync(this IFlurlRequest re
/// A Task whose result is the received HttpResponseMessage.
/// </returns>
public static Task<HttpResponseMessage> PostXmlAsync(this IFlurlRequest request, object data,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead) =>
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead) =>
SendXmlAsync(request, HttpMethod.Post, data, cancellationToken, completionOption);

/// <summary>
Expand All @@ -144,7 +144,7 @@ public static Task<HttpResponseMessage> PostXmlAsync(this IFlurlRequest request,
/// A Task whose result is the received HttpResponseMessage.
/// </returns>
public static Task<HttpResponseMessage> PutXmlAsync(this IFlurlRequest request, object data,
CancellationToken cancellationToken = default(CancellationToken), HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead) =>
CancellationToken cancellationToken = default, HttpCompletionOption completionOption = HttpCompletionOption.ResponseContentRead) =>
SendXmlAsync(request, HttpMethod.Put, data, cancellationToken, completionOption);
}
}
4 changes: 2 additions & 2 deletions src/Flurl.Http.Xml/MicrosoftXmlSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ private static T DeserializeInternal<T>(TextReader reader)
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="s">The string.</param>
public T Deserialize<T>(string s) => string.IsNullOrWhiteSpace(s) ? default(T) : DeserializeInternal<T>(new StringReader(s));
public T Deserialize<T>(string s) => string.IsNullOrWhiteSpace(s) ? default : DeserializeInternal<T>(new StringReader(s));

/// <summary>
/// Deserializes an object from a stream representation.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="stream">The stream.</param>
public T Deserialize<T>(Stream stream) => stream == null ? default(T) : DeserializeInternal<T>(new StreamReader(stream));
public T Deserialize<T>(Stream stream) => stream == null ? default : DeserializeInternal<T>(new StreamReader(stream));
}
}
Loading

0 comments on commit 1c1cdce

Please sign in to comment.