Skip to content

Commit c65ab5e

Browse files
authored
Add CI actions (#2)
Signed-off-by: André Silva <[email protected]>
1 parent 1531338 commit c65ab5e

File tree

13 files changed

+401
-10
lines changed

13 files changed

+401
-10
lines changed

.editorconfig

Lines changed: 328 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,328 @@
1+
# EditorConfig is awesome: https://EditorConfig.org
2+
#
3+
# More info about editorconfig for C# and .NET in Visual Studio see:
4+
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
5+
#
6+
# Most of the .NET and C# rules below were taken from the
7+
# Microsoft Roslyn team's editorconfig at:
8+
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
9+
10+
# Top-most EditorConfig file.
11+
root = true
12+
13+
# All files
14+
[*]
15+
charset = utf-8
16+
# indent_size intentionally not specified in this section.
17+
indent_style = space # Use soft tabs (spaces) for indentation.
18+
insert_final_newline = true
19+
trim_trailing_whitespace = true
20+
21+
# JSON files
22+
[*.json]
23+
indent_size = 2
24+
25+
# Markdown files
26+
[*.md]
27+
indent_size = 2
28+
trim_trailing_whitespace = false
29+
30+
# PowerShell scripts
31+
[*.ps1]
32+
indent_size = 4
33+
34+
# Visual Studio XML project files
35+
[*.{csproj,vcxproj,vcxproj.filters,proj,projitems,shproj}]
36+
indent_size = 2
37+
38+
# Visual Studio and .NET related XML config files
39+
[*.{props,targets,ruleset,config,nuspec,resx,vsixmanifest,vsct}]
40+
indent_size = 2
41+
42+
# YAML files
43+
[*.{yml,yaml}]
44+
indent_size = 2
45+
indent_style = space
46+
47+
#==================================================================
48+
# C# files
49+
#
50+
# Most of the .NET and C# rules below were taken from the
51+
# Microsoft Roslyn team's editorconfig at:
52+
# https://github.com/dotnet/roslyn/blob/master/.editorconfig
53+
#
54+
# More info about editorconfig for C# and .NET in Visual Studio see:
55+
# https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019
56+
#
57+
# Code style rules options:
58+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/code-style-rule-options?view=vs-2019
59+
#
60+
# Enforce Code Style in Builds
61+
# For builds, outside of Visual Studio, you can enable code style analysis for .NET projects by
62+
# setting the EnforceCodeStyleInBuild property to true in the VS .csproj file.
63+
# Example:
64+
# <PropertyGroup>
65+
# <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
66+
# </PropertyGroup>
67+
# See https://docs.microsoft.com/en-us/dotnet/core/project-sdk/msbuild-props#enforcecodestyleinbuild
68+
# Note: This feature is currently experimental and may change between the .NET 5 and .NET 6 releases.
69+
#
70+
[*.cs]
71+
indent_size = 4
72+
indent_style = space # Use soft tabs (spaces) for indentation.
73+
74+
# IDE0055: Fix formatting
75+
dotnet_diagnostic.IDE0055.severity = warning
76+
77+
# Sort using and Import directives with System.* appearing first
78+
dotnet_sort_system_directives_first = true
79+
dotnet_separate_import_directive_groups = false
80+
# Avoid "this." and "Me." if not necessary
81+
dotnet_style_qualification_for_field = false:refactoring
82+
dotnet_style_qualification_for_property = false:refactoring
83+
dotnet_style_qualification_for_method = false:refactoring
84+
dotnet_style_qualification_for_event = false:refactoring
85+
86+
# Use language keywords instead of framework type names for type references
87+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
88+
dotnet_style_predefined_type_for_member_access = true:suggestion
89+
90+
# Suggest more modern language features when available
91+
dotnet_style_object_initializer = true:suggestion
92+
dotnet_style_collection_initializer = true:suggestion
93+
dotnet_style_coalesce_expression = true:suggestion
94+
dotnet_style_null_propagation = true:suggestion
95+
dotnet_style_explicit_tuple_names = true:suggestion
96+
97+
# Non-private static fields are PascalCase
98+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.severity = suggestion
99+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.symbols = non_private_static_fields
100+
dotnet_naming_rule.non_private_static_fields_should_be_pascal_case.style = non_private_static_field_style
101+
102+
dotnet_naming_symbols.non_private_static_fields.applicable_kinds = field
103+
dotnet_naming_symbols.non_private_static_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
104+
dotnet_naming_symbols.non_private_static_fields.required_modifiers = static
105+
106+
dotnet_naming_style.non_private_static_field_style.capitalization = pascal_case
107+
108+
# Non-private readonly fields are PascalCase
109+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.severity = suggestion
110+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.symbols = non_private_readonly_fields
111+
dotnet_naming_rule.non_private_readonly_fields_should_be_pascal_case.style = non_private_readonly_field_style
112+
113+
dotnet_naming_symbols.non_private_readonly_fields.applicable_kinds = field
114+
dotnet_naming_symbols.non_private_readonly_fields.applicable_accessibilities = public, protected, internal, protected_internal, private_protected
115+
dotnet_naming_symbols.non_private_readonly_fields.required_modifiers = readonly
116+
117+
dotnet_naming_style.non_private_readonly_field_style.capitalization = pascal_case
118+
119+
# Constants are PascalCase
120+
dotnet_naming_rule.constants_should_be_pascal_case.severity = suggestion
121+
dotnet_naming_rule.constants_should_be_pascal_case.symbols = constants
122+
dotnet_naming_rule.constants_should_be_pascal_case.style = constant_style
123+
124+
dotnet_naming_symbols.constants.applicable_kinds = field, local
125+
dotnet_naming_symbols.constants.required_modifiers = const
126+
127+
dotnet_naming_style.constant_style.capitalization = pascal_case
128+
129+
# Static fields are camelCase and start with s_
130+
dotnet_naming_rule.static_fields_should_be_camel_case.severity = suggestion
131+
dotnet_naming_rule.static_fields_should_be_camel_case.symbols = static_fields
132+
dotnet_naming_rule.static_fields_should_be_camel_case.style = static_field_style
133+
134+
dotnet_naming_symbols.static_fields.applicable_kinds = field
135+
dotnet_naming_symbols.static_fields.required_modifiers = static
136+
137+
dotnet_naming_style.static_field_style.capitalization = camel_case
138+
dotnet_naming_style.static_field_style.required_prefix = s_
139+
140+
# Instance fields are camelCase and start with _
141+
dotnet_naming_rule.instance_fields_should_be_camel_case.severity = suggestion
142+
dotnet_naming_rule.instance_fields_should_be_camel_case.symbols = instance_fields
143+
dotnet_naming_rule.instance_fields_should_be_camel_case.style = instance_field_style
144+
145+
dotnet_naming_symbols.instance_fields.applicable_kinds = field
146+
147+
dotnet_naming_style.instance_field_style.capitalization = camel_case
148+
dotnet_naming_style.instance_field_style.required_prefix = _
149+
150+
# Locals and parameters are camelCase
151+
dotnet_naming_rule.locals_should_be_camel_case.severity = suggestion
152+
dotnet_naming_rule.locals_should_be_camel_case.symbols = locals_and_parameters
153+
dotnet_naming_rule.locals_should_be_camel_case.style = camel_case_style
154+
155+
dotnet_naming_symbols.locals_and_parameters.applicable_kinds = parameter, local
156+
157+
dotnet_naming_style.camel_case_style.capitalization = camel_case
158+
159+
# Local functions are PascalCase
160+
dotnet_naming_rule.local_functions_should_be_pascal_case.severity = suggestion
161+
dotnet_naming_rule.local_functions_should_be_pascal_case.symbols = local_functions
162+
dotnet_naming_rule.local_functions_should_be_pascal_case.style = local_function_style
163+
164+
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
165+
166+
dotnet_naming_style.local_function_style.capitalization = pascal_case
167+
168+
# By default, name items with PascalCase
169+
dotnet_naming_rule.members_should_be_pascal_case.severity = suggestion
170+
dotnet_naming_rule.members_should_be_pascal_case.symbols = all_members
171+
dotnet_naming_rule.members_should_be_pascal_case.style = pascal_case_style
172+
173+
dotnet_naming_symbols.all_members.applicable_kinds = *
174+
175+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
176+
177+
# error RS2008: Enable analyzer release tracking for the analyzer project containing rule '{0}'
178+
dotnet_diagnostic.RS2008.severity = none
179+
180+
# IDE0073: File header comment
181+
# Don't require source files to include header comment that matches
182+
# the text specified in the file_header_template option.
183+
dotnet_diagnostic.IDE0073.severity = none
184+
185+
# Newly created .cs files will begin with a comment line that includes
186+
# the text specified in the file_header_template option.
187+
# Omitt, or comment out, the file_header_template option if you don't
188+
# use file header comments.
189+
# file_header_template = Sample header comment text.
190+
191+
# IDE0035: Remove unreachable code
192+
dotnet_diagnostic.IDE0035.severity = warning
193+
194+
# IDE0036: Order modifiers
195+
dotnet_diagnostic.IDE0036.severity = warning
196+
197+
# IDE0043: Format string contains invalid placeholder
198+
dotnet_diagnostic.IDE0043.severity = warning
199+
200+
# IDE0044: Make field readonly
201+
dotnet_diagnostic.IDE0044.severity = warning
202+
203+
# RS0016: Only enable if API files are present
204+
dotnet_public_api_analyzer.require_api_files = true
205+
206+
# CSharp code style settings:
207+
[*.cs]
208+
# Newline settings
209+
csharp_new_line_before_open_brace = all
210+
csharp_new_line_before_else = true
211+
csharp_new_line_before_catch = true
212+
csharp_new_line_before_finally = true
213+
csharp_new_line_before_members_in_object_initializers = true
214+
csharp_new_line_before_members_in_anonymous_types = true
215+
csharp_new_line_between_query_expression_clauses = true
216+
217+
# Indentation preferences
218+
csharp_indent_block_contents = true
219+
csharp_indent_braces = false
220+
csharp_indent_case_contents = true
221+
csharp_indent_case_contents_when_block = true
222+
csharp_indent_switch_labels = true
223+
csharp_indent_labels = flush_left
224+
225+
# Prefer "var" everywhere
226+
csharp_style_var_for_built_in_types = true:suggestion
227+
csharp_style_var_when_type_is_apparent = true:suggestion
228+
csharp_style_var_elsewhere = true:suggestion
229+
230+
# Prefer method-like constructs to have a block body
231+
csharp_style_expression_bodied_methods = false:none
232+
csharp_style_expression_bodied_constructors = false:none
233+
csharp_style_expression_bodied_operators = false:none
234+
235+
# Prefer property-like constructs to have an expression-body
236+
csharp_style_expression_bodied_properties = true:none
237+
csharp_style_expression_bodied_indexers = true:none
238+
csharp_style_expression_bodied_accessors = true:none
239+
240+
# Suggest more modern language features when available
241+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
242+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
243+
csharp_style_inlined_variable_declaration = true:suggestion
244+
csharp_style_throw_expression = true:suggestion
245+
csharp_style_conditional_delegate_call = true:suggestion
246+
247+
# Space preferences
248+
csharp_space_after_cast = false
249+
csharp_space_after_colon_in_inheritance_clause = true
250+
csharp_space_after_comma = true
251+
csharp_space_after_dot = false
252+
csharp_space_after_keywords_in_control_flow_statements = true
253+
csharp_space_after_semicolon_in_for_statement = true
254+
csharp_space_around_binary_operators = before_and_after
255+
csharp_space_around_declaration_statements = do_not_ignore
256+
csharp_space_before_colon_in_inheritance_clause = true
257+
csharp_space_before_comma = false
258+
csharp_space_before_dot = false
259+
csharp_space_before_open_square_brackets = false
260+
csharp_space_before_semicolon_in_for_statement = false
261+
csharp_space_between_empty_square_brackets = false
262+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
263+
csharp_space_between_method_call_name_and_opening_parenthesis = false
264+
csharp_space_between_method_call_parameter_list_parentheses = false
265+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
266+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
267+
csharp_space_between_method_declaration_parameter_list_parentheses = false
268+
csharp_space_between_parentheses = false
269+
csharp_space_between_square_brackets = false
270+
271+
# Blocks are allowed
272+
csharp_prefer_braces = true:silent
273+
csharp_preserve_single_line_blocks = true
274+
csharp_preserve_single_line_statements = true
275+
276+
[src/CodeStyle/**.cs]
277+
# warning RS0005: Do not use generic CodeAction.Create to create CodeAction
278+
dotnet_diagnostic.RS0005.severity = none
279+
280+
[src/{Analyzers,CodeStyle,Features,Workspaces,EditorFeatures, VisualStudio}/**/*.cs]
281+
282+
# IDE0005: Remove unnecessary import (Remove unnecessary using)
283+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/ide0005
284+
# NOTE: To enable this rule on build, you need to enable XML documentation comments for the project.
285+
# See GitHub issue 41640 for more details:
286+
# https://github.com/dotnet/roslyn/issues/41640
287+
288+
dotnet_diagnostic.IDE0005.severity = warning
289+
290+
# IDE0011: Add braces
291+
csharp_prefer_braces = when_multiline:warning
292+
# NOTE: We need the below severity entry for Add Braces due to https://github.com/dotnet/roslyn/issues/44201
293+
dotnet_diagnostic.IDE0011.severity = warning
294+
295+
# IDE0040: Add accessibility modifiers
296+
dotnet_diagnostic.IDE0040.severity = warning
297+
298+
# CONSIDER: Are IDE0051 and IDE0052 too noisy to be warnings for IDE editing scenarios?
299+
# Should they be made build-only warnings?
300+
# IDE0051: Remove unused private member
301+
dotnet_diagnostic.IDE0051.severity = warning
302+
303+
# IDE0052: Remove unread private member
304+
dotnet_diagnostic.IDE0052.severity = warning
305+
306+
# IDE0059: Unnecessary assignment to a value
307+
dotnet_diagnostic.IDE0059.severity = warning
308+
309+
# IDE0060: Remove unused parameter
310+
dotnet_diagnostic.IDE0060.severity = warning
311+
312+
# CA1822: Make member static
313+
dotnet_diagnostic.CA1822.severity = warning
314+
315+
# Prefer "var" everywhere
316+
dotnet_diagnostic.IDE0007.severity = warning
317+
csharp_style_var_for_built_in_types = true:warning
318+
csharp_style_var_when_type_is_apparent = true:warning
319+
csharp_style_var_elsewhere = true:warning
320+
321+
[src/{VisualStudio}/**/*.cs]
322+
# CA1822: Make member static
323+
# Not enforced as a build 'warning' for 'VisualStudio' layer due to large number
324+
# of false positives from https://github.com/dotnet/roslyn-analyzers/issues/3857
325+
# and https://github.com/dotnet/roslyn-analyzers/issues/3858
326+
# Additionally, there is a risk of accidentally breaking an internal API that
327+
# partners rely on though IVT.
328+
dotnet_diagnostic.CA1822.severity = suggestion

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "nuget"
4+
directory: "/"
5+
schedule:
6+
interval: daily
7+
open-pull-requests-limit: 10
8+
9+
- package-ecosystem: "github-actions"
10+
directory: "/"
11+
schedule:
12+
interval: daily
13+
open-pull-requests-limit: 10

.github/workflows/ci.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches:
6+
- "main"
7+
pull_request:
8+
9+
jobs:
10+
build-dotnet:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
steps:
16+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
17+
- name: Setup .NET Core
18+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9
19+
with:
20+
global-json-file: global.json
21+
- name: Build with dotnet
22+
run: dotnet build --configuration Release
23+
# - name: Test with dotnet
24+
# run: dotnet test

.github/workflows/format.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: dotnet format
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
check-format:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
contents: read
14+
pull-requests: write
15+
16+
steps:
17+
- name: Check out code
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8
19+
20+
- name: Setup .NET Core
21+
uses: actions/setup-dotnet@67a3573c9a986a3f9c594539f4ab511d57bb3ce9
22+
with:
23+
global-json-file: global.json
24+
25+
- name: dotnet format
26+
run: dotnet format --verify-no-changes

0 commit comments

Comments
 (0)