Skip to content

Commit b6d0849

Browse files
committed
Clean, Update version
1 parent 26a6e47 commit b6d0849

File tree

5 files changed

+89
-24
lines changed

5 files changed

+89
-24
lines changed

.editorconfig

Lines changed: 76 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1+
# EditorConfig is awesome: http://EditorConfig.org
2+
# Based on: https://github.com/dotnet/roslyn/blob/master/.editorconfig
3+
# https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference
4+
# https://www.jetbrains.com/help/rider/Using_EditorConfig.html?Wave=183
5+
6+
root = true
7+
18
[*]
29
charset = utf-8
310
end_of_line = lf
411
indent_style = space
512
max_line_length = 180
613
insert_final_newline = true
714

8-
[*.cs]
9-
indent_size = 4
10-
insert_final_newline = true
11-
12-
[*.csproj]
15+
# XML
16+
[{*.csproj, *.props, .ruleset}]
1317
indent_size = 2
1418

15-
[{*.yml,*.yaml}]
19+
[{*.yml, *.yaml}]
1620
indent_size = 2
1721

1822
[*.json]
@@ -21,6 +25,70 @@ indent_size = 2
2125
[{*.sh, *.ps1}]
2226
indent_size = 2
2327

24-
# code style settings:
25-
[*.{cs}]
28+
[*.cs]
29+
indent_size = 4
30+
31+
## Dotnet code style settings:
32+
33+
# Sort using and Import directives with System.* appearing first
2634
dotnet_sort_system_directives_first = true
35+
# Avoid "this." and "Me." if not necessary
36+
dotnet_style_qualification_for_field = false:suggestion
37+
dotnet_style_qualification_for_property = false:suggestion
38+
dotnet_style_qualification_for_method = false:suggestion
39+
dotnet_style_qualification_for_event = false:suggestion
40+
41+
# Use language keywords instead of framework type names for type references
42+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
43+
dotnet_style_predefined_type_for_member_access = true:suggestion
44+
45+
# Suggest more modern language features when available
46+
dotnet_style_object_initializer = true:suggestion
47+
dotnet_style_collection_initializer = true:suggestion
48+
dotnet_style_coalesce_expression = true:suggestion
49+
dotnet_style_null_propagation = true:suggestion
50+
dotnet_style_explicit_tuple_names = true:suggestion
51+
52+
# CSharp code style settings:
53+
54+
# Prefer "var" everywhere
55+
csharp_style_var_for_built_in_types = false:none
56+
csharp_style_var_when_type_is_apparent = true:suggestion
57+
csharp_style_var_elsewhere = true:suggestion
58+
59+
# Prefer method-like constructs to have a block body
60+
csharp_style_expression_bodied_methods = false:none
61+
csharp_style_expression_bodied_constructors = false:none
62+
csharp_style_expression_bodied_operators = false:none
63+
64+
# Prefer property-like constructs to have an expression-body
65+
csharp_style_expression_bodied_properties = true:none
66+
csharp_style_expression_bodied_indexers = true:none
67+
csharp_style_expression_bodied_accessors = true:none
68+
69+
# Suggest more modern language features when available
70+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
71+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
72+
csharp_style_inlined_variable_declaration = true:suggestion
73+
csharp_style_throw_expression = true:suggestion
74+
csharp_style_conditional_delegate_call = true:suggestion
75+
76+
# Newline settings
77+
csharp_new_line_before_else = true
78+
csharp_new_line_before_catch = true
79+
csharp_new_line_before_finally = true
80+
csharp_new_line_before_members_in_object_initializers = true
81+
csharp_new_line_before_members_in_anonymous_types = true
82+
83+
## Naming
84+
85+
dotnet_naming_style.underscore_prefix.capitalization = camel_case
86+
dotnet_naming_style.underscore_prefix.required_prefix = _
87+
88+
# private fields should be _camelCase
89+
dotnet_naming_rule.private_fields_with_underscore.symbols = private_fields
90+
dotnet_naming_rule.private_fields_with_underscore.style = underscore_prefix
91+
dotnet_naming_rule.private_fields_with_underscore.severity = suggestion
92+
93+
dotnet_naming_symbols.private_fields.applicable_kinds = field
94+
dotnet_naming_symbols.private_fields.applicable_accessibilities = private

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2018 Sergey Kuznetsov
3+
Copyright (c) 2019 Sergey Kuznetsov
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

src/Prometheus.Client.AspNetCore/Prometheus.Client.AspNetCore.csproj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
33
<Description>Middleware for the Prometheus.Client</Description>
4-
<Copyright>2018 © Sergey Kuznetsov</Copyright>
4+
<Copyright>2019 © Sergey Kuznetsov</Copyright>
55
<AssemblyTitle>Prometheus.Client.AspNetCore</AssemblyTitle>
6-
<VersionPrefix>2.1.1</VersionPrefix>
6+
<VersionPrefix>2.2.0</VersionPrefix>
77
<Authors>Sergey Kuznetsov</Authors>
88
<TargetFrameworks>netstandard1.3;netstandard2.0</TargetFrameworks>
99
<AssemblyName>Prometheus.Client.AspNetCore</AssemblyName>
1010
<PackageId>Prometheus.Client.AspNetCore</PackageId>
1111
<PackageTags>prometheus;metrics</PackageTags>
1212
<PackageIconUrl>https://image.ibb.co/k4Sc0k/prometheus.png</PackageIconUrl>
1313
<PackageProjectUrl>https://github.com/PrometheusClientNet/Prometheus.Client.AspNetCore</PackageProjectUrl>
14-
<PackageLicenseUrl>https://opensource.org/licenses/MIT</PackageLicenseUrl>
14+
<PackageLicenseExpression>MIT</PackageLicenseExpression>
1515
<RepositoryType>git</RepositoryType>
1616
<RepositoryUrl>https://github.com/PrometheusClientNet/Prometheus.Client.AspNetCore</RepositoryUrl>
1717
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
1818
<GenerateDocumentationFile>true</GenerateDocumentationFile>
1919
</PropertyGroup>
2020
<ItemGroup>
21-
<PackageReference Include="Prometheus.Client" Version="2.0.0" />
21+
<PackageReference Include="Prometheus.Client" Version="[2.0.0,3.0.0)" />
2222
</ItemGroup>
2323
<ItemGroup Condition=" '$(TargetFramework)' == 'netstandard1.3'">
2424
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions">

src/Prometheus.Client.AspNetCore/PrometheusExtensions.cs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using System;
2-
using System.Net;
32
using System.Threading.Tasks;
43
using Prometheus.Client.Collectors;
54
using Microsoft.AspNetCore.Builder;
@@ -38,8 +37,8 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
3837
throw new ArgumentException($"MapPath '{options.MapPath}' should start with '/'");
3938

4039
RegisterCollectors(options);
41-
42-
Action<IApplicationBuilder> addMetricsHandler = coreapp =>
40+
41+
void AddMetricsHandler(IApplicationBuilder coreapp)
4342
{
4443
coreapp.Run(async context =>
4544
{
@@ -53,15 +52,13 @@ public static IApplicationBuilder UsePrometheusServer(this IApplicationBuilder a
5352

5453
await Task.FromResult(0).ConfigureAwait(false);
5554
});
56-
};
57-
58-
if (options.Port == null)
59-
{
60-
return app.Map(options.MapPath, addMetricsHandler);
6155
}
6256

63-
Func<HttpContext, bool> portMatches = context => context.Connection.LocalPort == options.Port;
64-
return app.Map(options.MapPath, cfg => cfg.MapWhen(portMatches, addMetricsHandler));
57+
if (options.Port == null)
58+
return app.Map(options.MapPath, AddMetricsHandler);
59+
60+
bool PortMatches(HttpContext context) => context.Connection.LocalPort == options.Port;
61+
return app.Map(options.MapPath, cfg => cfg.MapWhen(PortMatches, AddMetricsHandler));
6562
}
6663

6764

src/Prometheus.Client.AspNetCore/PrometheusOptions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public class PrometheusOptions
2828
/// IOnDemandCollectors
2929
/// </summary>
3030
public List<IOnDemandCollector> Collectors { get; set; } = new List<IOnDemandCollector>();
31-
31+
3232
/// <summary>
3333
/// Use default collectors
3434
/// </summary>

0 commit comments

Comments
 (0)