Skip to content

Commit a8abe4c

Browse files
author
Théo Penavaire
authored
Update formatting config (#5377)
1 parent b6cf854 commit a8abe4c

File tree

4 files changed

+89
-37
lines changed

4 files changed

+89
-37
lines changed

.editorconfig

+49
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,52 @@ indent_size = 4
7474
end_of_line = crlf
7575
trim_trailing_whitespace = true
7676
insert_final_newline = false
77+
78+
# https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/style-rules/formatting-rules
79+
[*.cs]
80+
csharp_new_line_before_open_brace = all
81+
csharp_new_line_before_else = true
82+
csharp_new_line_before_catch = true
83+
csharp_new_line_before_finally = true
84+
csharp_new_line_before_members_in_object_initializers = true
85+
csharp_new_line_before_members_in_anonymous_types = true
86+
csharp_new_line_between_query_expression_clauses = true
87+
# indentation options
88+
csharp_indent_case_contents = true
89+
csharp_indent_switch_labels = true
90+
csharp_indent_labels = one_less_than_current
91+
csharp_indent_block_contents = true
92+
csharp_indent_braces = false
93+
csharp_indent_case_contents_when_block = false
94+
# spacing
95+
csharp_space_after_cast = false
96+
csharp_space_after_keywords_in_control_flow_statements = true
97+
#csharp_space_between_parentheses = control_flow_statements, type_casts, expressions
98+
csharp_space_before_colon_in_inheritance_clause = true
99+
csharp_space_after_colon_in_inheritance_clause = true
100+
csharp_space_around_binary_operators = before_and_after
101+
csharp_space_between_method_declaration_parameter_list_parentheses = false
102+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
103+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
104+
csharp_space_between_method_call_parameter_list_parentheses = false
105+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
106+
csharp_space_between_method_call_name_and_opening_parenthesis = false
107+
csharp_space_after_comma = true
108+
csharp_space_before_comma = false
109+
csharp_space_after_dot = false
110+
csharp_space_before_dot = false
111+
csharp_space_after_semicolon_in_for_statement = true
112+
csharp_space_before_semicolon_in_for_statement = false
113+
csharp_space_around_declaration_statements = false
114+
csharp_space_before_open_square_brackets = false
115+
csharp_space_between_empty_square_brackets = false
116+
csharp_space_between_square_brackets = false
117+
# wrap options
118+
csharp_preserve_single_line_statements = true
119+
csharp_preserve_single_line_blocks = true
120+
# using directives
121+
#csharp_using_directive_placement = outside_namespace
122+
# dotnet options
123+
#dotnet_sort_system_directives_first = true
124+
125+
#dotnet_separate_import_directive_groups = false

.repoconfig

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
[version]
2-
repoconfig=5
2+
repoconfig=7
3+
minimum-unity-meta=47
34

45
[format]
56
path-ignore=<<EOT

.yamato/_formatting.yml

+37-35
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,42 @@
11
# Documentation: https://internaldocs.hq.unity3d.com/unity-meta/
22

33
formatting:
4-
name: Formatting
5-
agent:
6-
type: Unity::VM
7-
image: package-ci/ubuntu:v1.3.1-719011
8-
flavor: b1.small
9-
commands:
10-
- "echo -e \"[extensions]\nlargefiles=\n\" > ~/.hgrc"
11-
- hg clone -u stable http://hg-mirror-slo.hq.unity3d.com/unity-extra/unity-meta ~/unity-meta
12-
- perl ~/unity-meta/Tools/Format/format.pl --reporoot $(pwd) --preview .
13-
- cat ./format.patch
14-
- perl ~/unity-meta/Tools/Format/format.pl --reporoot $(pwd) --dry-run . # Run a 2nd time to actually "fail" the job if there are formatting diffs (--preview always exits with 0)
15-
timeout: 1
16-
triggers:
17-
expression: pull_request.target eq "master"
18-
artifacts:
19-
diff:
20-
paths:
21-
- format.patch
4+
name: Formatting
5+
agent:
6+
type: Unity::VM
7+
image: package-ci/ubuntu:v1.3.1-719011
8+
flavor: b1.small
9+
commands:
10+
- "echo -e \"[extensions]\nlargefiles=\n\" > ~/.hgrc"
11+
- hg clone -u beta http://hg-mirror-slo.hq.unity3d.com/unity-extra/unity-meta ~/unity-meta
12+
- perl ~/unity-meta/Tools/Format/format.pl --nobackups .
13+
- git diff --output ./format.patch
14+
- cat ./format.patch
15+
- | # Checking if there is a diff, to fail the job if yes (-s check means does the file contain something)
16+
if [ -s format.patch ]; then exit 1; fi
17+
timeout: 1
18+
triggers:
19+
expression: pull_request.target eq "master"
20+
artifacts:
21+
diff:
22+
paths:
23+
- format.patch
2224

2325
formatting_apply:
24-
name: Formatting (Apply requested changes)
25-
agent:
26-
type: Unity::VM
27-
image: package-ci/ubuntu:v1.3.1-719011
28-
flavor: b1.small
29-
commands:
30-
- git config --global user.name "[email protected]"
31-
- git config --global user.email "[email protected]"
32-
- git checkout $GIT_BRANCH
33-
- git pull origin $GIT_BRANCH # In case the job was not run on the latest commit, attempt to get it. There may be situations with merge conflicts, in that case wait for everyone to push their changes and then only run the formatting job on HEAD.
34-
- "echo -e \"[extensions]\nlargefiles=\n\" > ~/.hgrc"
35-
- hg clone -u stable http://hg-mirror-slo.hq.unity3d.com/unity-extra/unity-meta ~/unity-meta
36-
- perl ~/unity-meta/Tools/Format/format.pl --reporoot $(pwd) --nobackups .
37-
- git add .
38-
- git commit -m "Apply formatting changes"
39-
- git push --set-upstream origin $GIT_BRANCH
40-
timeout: 1
26+
name: Formatting (Apply requested changes)
27+
agent:
28+
type: Unity::VM
29+
image: package-ci/ubuntu:v1.3.1-719011
30+
flavor: b1.small
31+
commands:
32+
- git config --global user.name "[email protected]"
33+
- git config --global user.email "[email protected]"
34+
- git checkout $GIT_BRANCH
35+
- git pull origin $GIT_BRANCH # In case the job was not run on the latest commit, attempt to get it. There may be situations with merge conflicts, in that case wait for everyone to push their changes and then only run the formatting job on HEAD.
36+
- "echo -e \"[extensions]\nlargefiles=\n\" > ~/.hgrc"
37+
- hg clone -u beta http://hg-mirror-slo.hq.unity3d.com/unity-extra/unity-meta ~/unity-meta
38+
- perl ~/unity-meta/Tools/Format/format.pl --nobackups .
39+
- git add .
40+
- git commit -m "Apply formatting changes"
41+
- git push --set-upstream origin $GIT_BRANCH
42+
timeout: 1

com.unity.render-pipelines.universal/Editor/Converter/ReadonlyMaterialConverter.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public override void OnInitialize(InitializeConverterContext ctx, Action callbac
4848
{
4949
var context = Search.SearchService.CreateContext("asset", "urp:convert-readonly");
5050

51-
Search.SearchService.Request(context, (c, items) =>
51+
Search.SearchService.Request(context, (c, items) =>
5252
{
5353
// we're going to do this step twice in order to get them ordered, but it should be fast
5454
var orderedRequest = items.OrderBy(req =>

0 commit comments

Comments
 (0)