Skip to content

Commit ed85930

Browse files
author
Danielle Jenkins
committed
Initialize Godot Sharp Analyzers project with signal nameof analyzer and GitHub CI
0 parents  commit ed85930

19 files changed

+1295
-0
lines changed

.editorconfig

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Default settings:
7+
[*]
8+
insert_final_newline = true
9+
indent_style = space
10+
indent_size = 4
11+
trim_trailing_whitespace = true
12+
charset = utf-8
13+
14+
# C# files
15+
[*.cs]
16+
17+
# New line preferences
18+
csharp_new_line_before_open_brace = all
19+
csharp_new_line_before_else = true
20+
csharp_new_line_before_catch = true
21+
csharp_new_line_before_finally = true
22+
csharp_new_line_before_members_in_object_initializers = true
23+
csharp_new_line_before_members_in_anonymous_types = true
24+
csharp_new_line_between_query_expression_clauses = true
25+
26+
# Indentation preferences
27+
csharp_indent_block_contents = true
28+
csharp_indent_braces = false
29+
csharp_indent_case_contents = true
30+
csharp_indent_case_contents_when_block = true
31+
csharp_indent_switch_labels = true
32+
csharp_indent_labels = one_less_than_current
33+
34+
# Modifier preferences
35+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
36+
37+
# avoid this. unless absolutely necessary
38+
dotnet_style_qualification_for_field = false:suggestion
39+
dotnet_style_qualification_for_property = false:suggestion
40+
dotnet_style_qualification_for_method = false:suggestion
41+
dotnet_style_qualification_for_event = false:suggestion
42+
43+
# Types: use keywords instead of BCL types, and permit var only when the type is clear
44+
csharp_style_var_for_built_in_types = false:suggestion
45+
csharp_style_var_when_type_is_apparent = false:none
46+
csharp_style_var_elsewhere = false:suggestion
47+
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
48+
dotnet_style_predefined_type_for_member_access = true:suggestion
49+
50+
# name all constant fields using PascalCase
51+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
52+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
53+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
54+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
55+
dotnet_naming_symbols.constant_fields.required_modifiers = const
56+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
57+
58+
# static fields should have s_ prefix
59+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
60+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
61+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
62+
dotnet_naming_symbols.static_fields.applicable_kinds = field
63+
dotnet_naming_symbols.static_fields.required_modifiers = static
64+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal
65+
dotnet_naming_style.static_prefix_style.required_prefix = s_
66+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
67+
68+
# internal and private fields should be _camelCase
69+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
70+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
71+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
72+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
73+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
74+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
75+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
76+
77+
# Code style defaults
78+
csharp_using_directive_placement = outside_namespace:suggestion
79+
dotnet_sort_system_directives_first = true
80+
csharp_prefer_braces = true:silent
81+
csharp_preserve_single_line_blocks = true:none
82+
csharp_preserve_single_line_statements = false:none
83+
csharp_prefer_static_local_function = true:suggestion
84+
csharp_prefer_simple_using_statement = false:none
85+
csharp_style_prefer_switch_expression = true:suggestion
86+
dotnet_style_readonly_field = true:suggestion
87+
88+
# Expression preferences
89+
dotnet_style_object_initializer = true:suggestion
90+
dotnet_style_collection_initializer = true:suggestion
91+
dotnet_style_explicit_tuple_names = true:suggestion
92+
dotnet_style_coalesce_expression = true:suggestion
93+
dotnet_style_null_propagation = true:suggestion
94+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
95+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
96+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
97+
dotnet_style_prefer_auto_properties = true:suggestion
98+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
99+
dotnet_style_prefer_conditional_expression_over_return = true:silent
100+
csharp_prefer_simple_default_expression = true:suggestion
101+
102+
# Expression-bodied members
103+
csharp_style_expression_bodied_methods = true:silent
104+
csharp_style_expression_bodied_constructors = true:silent
105+
csharp_style_expression_bodied_operators = true:silent
106+
csharp_style_expression_bodied_properties = true:silent
107+
csharp_style_expression_bodied_indexers = true:silent
108+
csharp_style_expression_bodied_accessors = true:silent
109+
csharp_style_expression_bodied_lambdas = true:silent
110+
csharp_style_expression_bodied_local_functions = true:silent
111+
112+
# Pattern matching
113+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
114+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
115+
csharp_style_inlined_variable_declaration = true:suggestion
116+
117+
# Null checking preferences
118+
csharp_style_throw_expression = true:suggestion
119+
csharp_style_conditional_delegate_call = true:suggestion
120+
121+
# Other features
122+
csharp_style_prefer_index_operator = false:none
123+
csharp_style_prefer_range_operator = false:none
124+
csharp_style_pattern_local_over_anonymous_function = false:none
125+
126+
# Space preferences
127+
csharp_space_after_cast = false
128+
csharp_space_after_colon_in_inheritance_clause = true
129+
csharp_space_after_comma = true
130+
csharp_space_after_dot = false
131+
csharp_space_after_keywords_in_control_flow_statements = true
132+
csharp_space_after_semicolon_in_for_statement = true
133+
csharp_space_around_binary_operators = before_and_after
134+
csharp_space_around_declaration_statements = do_not_ignore
135+
csharp_space_before_colon_in_inheritance_clause = true
136+
csharp_space_before_comma = false
137+
csharp_space_before_dot = false
138+
csharp_space_before_open_square_brackets = false
139+
csharp_space_before_semicolon_in_for_statement = false
140+
csharp_space_between_empty_square_brackets = false
141+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
142+
csharp_space_between_method_call_name_and_opening_parenthesis = false
143+
csharp_space_between_method_call_parameter_list_parentheses = false
144+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
145+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
146+
csharp_space_between_method_declaration_parameter_list_parentheses = false
147+
csharp_space_between_parentheses = false
148+
csharp_space_between_square_brackets = false
149+
150+
# C++ Files
151+
[*.{cpp,h,in}]
152+
curly_bracket_next_line = true
153+
indent_brace_style = Allman
154+
155+
# Xml project files
156+
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
157+
indent_size = 2
158+
159+
[*.{csproj,vbproj,proj,nativeproj,locproj}]
160+
charset = utf-8
161+
162+
# Xml files
163+
[*.{xml,stylecop,resx,ruleset}]
164+
indent_size = 2
165+
166+
# Xml config files
167+
[*.{props,targets,config,nuspec}]
168+
indent_size = 2
169+
170+
# YAML config files
171+
[*.{yml,yaml}]
172+
indent_size = 2
173+
174+
# Shell scripts
175+
[*.sh]
176+
end_of_line = lf
177+
[*.{cmd,bat}]
178+
end_of_line = crlf

.github/workflows/ci.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
tags: [ 'v*' ]
7+
pull_request:
8+
branches: [ main ]
9+
workflow_dispatch:
10+
11+
env:
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
13+
DOTNET_NOLOGO: true
14+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
15+
16+
jobs:
17+
build:
18+
runs-on: ${{ matrix.os }}
19+
strategy:
20+
matrix:
21+
os: [ubuntu-latest, windows-latest, macos-latest]
22+
dotnet: ['8.0.x']
23+
include:
24+
- os: ubuntu-latest
25+
dotnet: '9.0.x'
26+
27+
name: Build - ${{ matrix.os }} - .NET ${{ matrix.dotnet }}
28+
29+
steps:
30+
- uses: actions/checkout@v4
31+
with:
32+
fetch-depth: 0
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: ${{ matrix.dotnet }}
38+
39+
- name: Restore dependencies
40+
run: dotnet restore
41+
42+
- name: Build
43+
run: dotnet build --no-restore --configuration Release
44+
45+
- name: Test
46+
run: dotnet test --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx"
47+
48+
- name: Upload test results
49+
uses: actions/upload-artifact@v4
50+
if: always()
51+
with:
52+
name: test-results-${{ matrix.os }}-${{ matrix.dotnet }}
53+
path: '**/test-results.trx'
54+
55+
- name: Pack
56+
if: matrix.os == 'ubuntu-latest' && matrix.dotnet == '8.0.x'
57+
run: dotnet pack --no-build --configuration Release --output ./artifacts
58+
59+
- name: Upload NuGet packages
60+
if: matrix.os == 'ubuntu-latest' && matrix.dotnet == '8.0.x'
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: nuget-packages
64+
path: ./artifacts/*.nupkg
65+
66+
publish:
67+
needs: build
68+
runs-on: ubuntu-latest
69+
if: startsWith(github.ref, 'refs/tags/v')
70+
71+
steps:
72+
- name: Download NuGet packages
73+
uses: actions/download-artifact@v4
74+
with:
75+
name: nuget-packages
76+
path: ./artifacts
77+
78+
- name: Setup .NET
79+
uses: actions/setup-dotnet@v4
80+
with:
81+
dotnet-version: '8.0.x'
82+
83+
- name: Publish to NuGet
84+
run: |
85+
dotnet nuget push "./artifacts/*.nupkg" \
86+
--api-key ${{ secrets.NUGET_API_KEY }} \
87+
--source https://api.nuget.org/v3/index.json \
88+
--skip-duplicate
89+
90+
- name: Create GitHub Release
91+
uses: softprops/action-gh-release@v1
92+
with:
93+
files: ./artifacts/*.nupkg
94+
generate_release_notes: true
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)