Skip to content

Commit fb7fd81

Browse files
authored
Merge pull request #1 from NikiforovAll/add-analyzer
add Nall.NEST.MigtarionAnalyzer
2 parents e7c466e + e3dd2b8 commit fb7fd81

37 files changed

+2695
-0
lines changed

.github/workflows/build.yaml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: "Build"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths-ignore:
8+
- '**/*.md'
9+
- '**/*.gitignore'
10+
- '**/*.gitattributes'
11+
workflow_dispatch:
12+
paths-ignore:
13+
- '**/*.md'
14+
- '**/*.gitignore'
15+
- '**/*.gitattributes'
16+
17+
jobs:
18+
build:
19+
if: github.event_name == 'push' && contains(toJson(github.event.commits), '***NO_CI***') == false && contains(toJson(github.event.commits), '[ci skip]') == false && contains(toJson(github.event.commits), '[skip ci]') == false
20+
name: Build
21+
runs-on: windows-latest
22+
env:
23+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
24+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
25+
DOTNET_NOLOGO: true
26+
DOTNET_GENERATE_ASPNET_CERTIFICATE: false
27+
DOTNET_ADD_GLOBAL_TOOLS_TO_PATH: false
28+
DOTNET_MULTILEVEL_LOOKUP: 0
29+
PACKAGE_PROJECT: analyzer\Nall.NEST.MigtarionAnalyzer\Nall.NEST.MigtarionAnalyzer.Package\
30+
VSIX_PROJECT: analyzer\Nall.NEST.MigtarionAnalyzer\Nall.NEST.MigtarionAnalyzer.Vsix\
31+
32+
steps:
33+
- uses: actions/checkout@v2
34+
35+
- name: Setup .NET Core SDK
36+
uses: actions/setup-dotnet@v1
37+
with:
38+
dotnet-version: 5.0.x
39+
40+
- name: Setup MSBuild
41+
uses: microsoft/setup-msbuild@v1
42+
43+
- name: Setup NuGet
44+
uses: NuGet/setup-nuget@v1.0.5
45+
46+
- name: Add GPR Source
47+
run: nuget sources Add -Name "GPR" -Source ${{ secrets.GPR_URI }} -UserName ${{ secrets.GPR_USERNAME }} -Password ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: Build NuGet Package
50+
run: |
51+
msbuild /restore ${{ env.PACKAGE_PROJECT }} /p:Configuration=Release /p:PackageOutputPath=${{ github.workspace }}\artifacts
52+
53+
- name: Build VSIX Package
54+
run: |
55+
msbuild /restore ${{ env.VSIX_PROJECT }} /p:Configuration=Release /p:OutDir=${{ github.workspace }}\artifacts
56+
57+
- name: Push to GitHub Packages
58+
run: nuget push ${{ github.workspace }}\artifacts\*.nupkg -Source "GPR"
59+
60+
# upload artifacts
61+
- name: Upload artifacts
62+
uses: actions/upload-artifact@v2
63+
with:
64+
name: release-pacakges
65+
path: |
66+
${{ github.workspace }}\artifacts\**\*.vsix
67+
${{ github.workspace }}\artifacts\**\*.nupkg

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Oleksii Nikiforov
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

analyzer/.editorconfig

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Don't use tabs for indentation.
7+
[*]
8+
indent_style = space
9+
# (Please don't specify an indent_size here; that has too many unintended consequences.)
10+
11+
[*.{tf,tfvars,hcl}]
12+
indent_size = 2
13+
14+
# Code files
15+
[*.{cs,csx,vb,vbx}]
16+
indent_size = 4
17+
insert_final_newline = true
18+
charset = utf-8-bom
19+
20+
# XML project files
21+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
22+
indent_size = 2
23+
24+
# XML config files
25+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
26+
indent_size = 2
27+
28+
# JSON files
29+
[*.json]
30+
indent_size = 2
31+
32+
# Powershell files
33+
[*.ps1]
34+
indent_size = 2
35+
36+
# Dotnet code style settings:
37+
[*.{cs,vb}]
38+
dotnet_diagnostic.xUnit2018.severity = none # "do not compare an object's exact type to the abstract class" is a valid assert, but very noisy right now
39+
40+
# Sort using and Import directives with System.* appearing first
41+
dotnet_sort_system_directives_first = true
42+
dotnet_separate_import_directive_groups = false
43+
# Avoid "this." and "Me." if not necessary
44+
dotnet_style_qualification_for_field = false:refactoring
45+
dotnet_style_qualification_for_property = false:refactoring
46+
dotnet_style_qualification_for_method = false:refactoring
47+
dotnet_style_qualification_for_event = false:refactoring
48+
49+
# Use language keywords instead of framework type names for type references
50+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
51+
dotnet_style_predefined_type_for_member_access = true:suggestion
52+
53+
# Suggest more modern language features when available
54+
dotnet_style_object_initializer = true:suggestion
55+
dotnet_style_collection_initializer = true:suggestion
56+
dotnet_style_coalesce_expression = true:suggestion
57+
dotnet_style_null_propagation = true:suggestion
58+
dotnet_style_explicit_tuple_names = true:suggestion
59+
60+
# Whitespace options
61+
dotnet_style_allow_multiple_blank_lines_experimental = false
62+
63+
# Non-private static fields are PascalCase
64+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
65+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
66+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
67+
68+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
69+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
70+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
71+
72+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
73+
74+
# Non-private readonly fields are PascalCase
75+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
76+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
77+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
78+
79+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
80+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
81+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
82+
83+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
84+
85+
# Constants are PascalCase
86+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
87+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
88+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
89+
90+
dotnet_naming_symbols.constants.applicable_kinds = field, local
91+
dotnet_naming_symbols.constants.required_modifiers = const
92+
93+
dotnet_naming_style.constant_style.capitalization = pascal_case
94+
95+
# Static fields are camelCase and start with s_
96+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
97+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
98+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
99+
100+
dotnet_naming_symbols.static_fields.applicable_kinds = field
101+
dotnet_naming_symbols.static_fields.required_modifiers = static
102+
103+
dotnet_naming_style.static_field_style.capitalization = camel_case
104+
dotnet_naming_style.static_field_style.required_prefix = s_
105+
106+
# Instance fields are camelCase and start with _
107+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
108+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
109+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
110+
111+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
112+
113+
dotnet_naming_style.instance_field_style.capitalization = camel_case
114+
dotnet_naming_style.instance_field_style.required_prefix = _
115+
116+
# Locals and parameters are camelCase
117+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
118+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
119+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
120+
121+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
122+
123+
dotnet_naming_style.camel_case_style.capitalization = camel_case
124+
125+
# Local functions are PascalCase
126+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
127+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
128+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
129+
130+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
131+
132+
dotnet_naming_style.local_function_style.capitalization = pascal_case
133+
134+
# By default, name items with PascalCase
135+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
136+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
137+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
138+
139+
dotnet_naming_symbols.all_members.applicable_kinds = *
140+
141+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
142+
143+
# IDE0055: Fix formatting
144+
# Workaround for https://github.com/dotnet/roslyn/issues/70570
145+
dotnet_diagnostic.IDE0055.severity = warning
146+
147+
# CSharp code style settings:
148+
[*.cs]
149+
max_line_length=100
150+
# Newline settings
151+
csharp_new_line_before_open_brace = all
152+
csharp_new_line_before_else = true
153+
csharp_new_line_before_catch = true
154+
csharp_new_line_before_finally = true
155+
csharp_new_line_before_members_in_object_initializers = true
156+
csharp_new_line_before_members_in_anonymous_types = true
157+
csharp_new_line_between_query_expression_clauses = true
158+
159+
# Indentation preferences
160+
csharp_indent_block_contents = true
161+
csharp_indent_braces = false
162+
csharp_indent_case_contents = true
163+
csharp_indent_case_contents_when_block = true
164+
csharp_indent_switch_labels = true
165+
csharp_indent_labels = flush_left
166+
167+
# Whitespace options
168+
csharp_style_allow_embedded_statements_on_same_line_experimental = false
169+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = false
170+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = false
171+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = false
172+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = false
173+
174+
# Prefer "var" everywhere
175+
csharp_style_var_for_built_in_types = true:suggestion
176+
csharp_style_var_when_type_is_apparent = true:suggestion
177+
csharp_style_var_elsewhere = true:suggestion
178+
179+
# Prefer method-like constructs to have a block body
180+
csharp_style_expression_bodied_methods = false:none
181+
csharp_style_expression_bodied_constructors = false:none
182+
csharp_style_expression_bodied_operators = false:none
183+
184+
# Prefer property-like constructs to have an expression-body
185+
csharp_style_expression_bodied_properties = true:none
186+
csharp_style_expression_bodied_indexers = true:none
187+
csharp_style_expression_bodied_accessors = true:none
188+
189+
# Suggest more modern language features when available
190+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
191+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
192+
csharp_style_inlined_variable_declaration = true:suggestion
193+
csharp_style_throw_expression = true:suggestion
194+
csharp_style_conditional_delegate_call = true:suggestion
195+
csharp_style_prefer_extended_property_pattern = true:suggestion
196+
197+
# Space preferences
198+
csharp_space_after_cast = false
199+
csharp_space_after_colon_in_inheritance_clause = true
200+
csharp_space_after_comma = true
201+
csharp_space_after_dot = false
202+
csharp_space_after_keywords_in_control_flow_statements = true
203+
csharp_space_after_semicolon_in_for_statement = true
204+
csharp_space_around_binary_operators = before_and_after
205+
csharp_space_around_declaration_statements = do_not_ignore
206+
csharp_space_before_colon_in_inheritance_clause = true
207+
csharp_space_before_comma = false
208+
csharp_space_before_dot = false
209+
csharp_space_before_open_square_brackets = false
210+
csharp_space_before_semicolon_in_for_statement = false
211+
csharp_space_between_empty_square_brackets = false
212+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
213+
csharp_space_between_method_call_name_and_opening_parenthesis = false
214+
csharp_space_between_method_call_parameter_list_parentheses = false
215+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
216+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
217+
csharp_space_between_method_declaration_parameter_list_parentheses = false
218+
csharp_space_between_parentheses = false
219+
csharp_space_between_square_brackets = false
220+
221+
# Blocks are allowed
222+
csharp_prefer_braces = true:error
223+
csharp_preserve_single_line_blocks = true
224+
csharp_preserve_single_line_statements = false
225+
csharp_place_attribute_on_same_line = never
226+
csharp_max_initializer_elements_on_line = 1
227+
csharp_max_array_initializer_elements_on_line = 1
228+
229+
# CS4014: Because this call is not awaited, execution of the current method continues before the call is completed
230+
dotnet_diagnostic.CS4014.severity = error
231+
232+
# VSTHRD200: Use "Async" suffix for async methods
233+
dotnet_diagnostic.VSTHRD200.severity = error
234+
235+
# VSTHRD011: Use AsyncLazy<T> instead
236+
dotnet_diagnostic.VSTHRD011.severity = none
237+
238+
# Consider calling Task.ConfigureAwait(Boolean) to signal your intention for continuation.
239+
dotnet_diagnostic.CA2007.severity = none
240+
241+
# CA1848: Use the LoggerMessage delegates
242+
# Consider to use this approach later: https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging/loggermessage?view=aspnetcore-6.0
243+
# BUG: broken in dotnet7, will be fixed in dotnet8: https://github.com/dotnet/roslyn-analyzers/issues/6281
244+
dotnet_diagnostic.CA1848.severity = none
245+
246+
# CA1308: Normalize strings to uppercase
247+
dotnet_diagnostic.CA1308.severity = none
248+
249+
# CS8618: Non-nullable field is uninitialized. Consider declaring as nullable.
250+
dotnet_diagnostic.CS8618.severity = none
251+
252+
# CA1707: Identifiers should not contain underscores
253+
dotnet_diagnostic.CA1707.severity = none
254+
255+
# CA1819: Properties should not return arrays
256+
dotnet_diagnostic.CA1819.severity = none
257+
258+
# IDE1006: Naming Styles
259+
dotnet_diagnostic.IDE1006.severity = warning
260+
261+
# VSTHRD111: Use ConfigureAwait(bool)
262+
dotnet_diagnostic.VSTHRD111.severity = silent
263+
264+
# CA2007: Consider calling ConfigureAwait on the awaited task
265+
dotnet_diagnostic.CA2007.severity = silent
266+
267+
# CA1716: Conflicts with the reserved language keyword
268+
dotnet_diagnostic.CA1716.severity = silent
269+
270+
# IDE0051: Remove unused private members
271+
dotnet_diagnostic.IDE0051.severity = warning
272+
273+
# Default severity for analyzer diagnostics with category 'CodeQuality'
274+
dotnet_analyzer_diagnostic.category-CodeQuality.severity = warning
275+
276+
# CS1591: Missing XML comment for publicly visible type or member
277+
dotnet_diagnostic.CS1591.severity = silent
278+
279+
# IDE0011: Add braces
280+
dotnet_diagnostic.IDE0011.severity = suggestion
281+
282+
# IDE0005: Using directive is unnecessary.
283+
dotnet_diagnostic.IDE0005.severity = warning

0 commit comments

Comments
 (0)