Skip to content

Commit e244141

Browse files
committed
add editorconfig and reformat all code
1 parent b5c2a9f commit e244141

File tree

115 files changed

+17045
-10471
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+17045
-10471
lines changed

.editorconfig

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
[*.cs]
2+
indent_style = tab
3+
csharp_new_line_before_catch = true
4+
csharp_new_line_before_else = true
5+
csharp_new_line_before_open_brace = all
6+
7+
csharp_preserve_single_line_blocks = true
8+
csharp_preserve_single_line_statements = true
9+
10+
csharp_prefer_braces = true:warning
11+
csharp_indent_labels = one_less_than_current
12+
csharp_space_around_binary_operators = before_and_after
13+
csharp_using_directive_placement = outside_namespace:silent
14+
csharp_prefer_simple_using_statement = true:suggestion
15+
csharp_style_namespace_declarations = block_scoped:silent
16+
csharp_style_prefer_method_group_conversion = true:silent
17+
csharp_style_prefer_top_level_statements = true:silent
18+
csharp_style_prefer_primary_constructors = true:suggestion
19+
csharp_style_expression_bodied_methods = false:silent
20+
csharp_style_expression_bodied_constructors = false:silent
21+
csharp_style_expression_bodied_operators = false:silent
22+
csharp_style_expression_bodied_properties = true:silent
23+
csharp_style_expression_bodied_indexers = true:silent
24+
csharp_style_expression_bodied_accessors = true:silent
25+
csharp_style_expression_bodied_lambdas = true:silent
26+
csharp_style_expression_bodied_local_functions = false:silent
27+
csharp_style_throw_expression = true:suggestion
28+
csharp_style_prefer_null_check_over_type_check = true:suggestion
29+
csharp_prefer_simple_default_expression = true:suggestion
30+
csharp_style_prefer_local_over_anonymous_function = true:suggestion
31+
csharp_style_prefer_index_operator = true:suggestion
32+
csharp_style_prefer_range_operator = true:suggestion
33+
csharp_style_implicit_object_creation_when_type_is_apparent = true:suggestion
34+
csharp_style_prefer_tuple_swap = true:suggestion
35+
csharp_style_prefer_utf8_string_literals = true:suggestion
36+
csharp_style_inlined_variable_declaration = true:suggestion
37+
csharp_style_deconstructed_variable_declaration = true:suggestion
38+
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
39+
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
40+
csharp_prefer_static_local_function = true:suggestion
41+
csharp_prefer_static_anonymous_function = true:suggestion
42+
csharp_style_prefer_readonly_struct = true:suggestion
43+
csharp_style_prefer_readonly_struct_member = true:suggestion
44+
csharp_style_allow_embedded_statements_on_same_line_experimental = true:silent
45+
csharp_style_allow_blank_lines_between_consecutive_braces_experimental = true:silent
46+
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
47+
csharp_style_allow_blank_line_after_token_in_conditional_expression_experimental = true:silent
48+
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
49+
csharp_style_conditional_delegate_call = true:suggestion
50+
[*.{cs,vb}]
51+
#### Naming styles ####
52+
53+
# Naming rules
54+
55+
dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
56+
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
57+
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i
58+
59+
dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
60+
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
61+
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case
62+
63+
dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
64+
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
65+
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case
66+
67+
# Symbol specifications
68+
69+
dotnet_naming_symbols.interface.applicable_kinds = interface
70+
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
71+
dotnet_naming_symbols.interface.required_modifiers =
72+
73+
dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
74+
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
75+
dotnet_naming_symbols.types.required_modifiers =
76+
77+
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
78+
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
79+
dotnet_naming_symbols.non_field_members.required_modifiers =
80+
81+
# Naming styles
82+
83+
dotnet_naming_style.begins_with_i.required_prefix = I
84+
dotnet_naming_style.begins_with_i.required_suffix =
85+
dotnet_naming_style.begins_with_i.word_separator =
86+
dotnet_naming_style.begins_with_i.capitalization = pascal_case
87+
88+
dotnet_naming_style.pascal_case.required_prefix =
89+
dotnet_naming_style.pascal_case.required_suffix =
90+
dotnet_naming_style.pascal_case.word_separator =
91+
dotnet_naming_style.pascal_case.capitalization = pascal_case
92+
93+
dotnet_naming_style.pascal_case.required_prefix =
94+
dotnet_naming_style.pascal_case.required_suffix =
95+
dotnet_naming_style.pascal_case.word_separator =
96+
dotnet_naming_style.pascal_case.capitalization = pascal_case
97+
dotnet_style_operator_placement_when_wrapping = beginning_of_line
98+
tab_width = 4
99+
indent_size = 4
100+
end_of_line = crlf
101+
dotnet_style_coalesce_expression = false:suggestion
102+
dotnet_style_null_propagation = false:suggestion
103+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
104+
dotnet_style_prefer_auto_properties = true:silent
105+
dotnet_style_object_initializer = true:suggestion
106+
dotnet_style_collection_initializer = true:suggestion
107+
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
108+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
109+
dotnet_style_prefer_conditional_expression_over_return = true:silent
110+
dotnet_style_explicit_tuple_names = true:suggestion
111+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
112+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
113+
dotnet_style_prefer_compound_assignment = true:suggestion
114+
dotnet_style_prefer_simplified_interpolation = true:suggestion
115+
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
116+
dotnet_style_namespace_match_folder = true:suggestion
117+
dotnet_style_readonly_field = true:suggestion
118+
dotnet_style_predefined_type_for_locals_parameters_members = true:silent
119+
dotnet_style_predefined_type_for_member_access = true:silent
120+
dotnet_style_require_accessibility_modifiers = for_non_interface_members:silent
121+
dotnet_style_allow_statement_immediately_after_block_experimental = true:silent
122+
dotnet_style_allow_multiple_blank_lines_experimental = true:silent
123+
dotnet_code_quality_unused_parameters = all:suggestion

SCANmechjeb/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020

2121
// ideally this should get generated from KSPBuildTools
2222
// https://github.com/KSPModdingLibs/KSPBuildTools/issues/46
23-
[assembly: KSPAssemblyDependency ("SCANsat", 21, 0)]
23+
[assembly: KSPAssemblyDependency("SCANsat", 21, 0)]

SCANmechjeb/SCANmechStarter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ private void Start()
2828
SCANmechjebInt = gameObject.AddComponent<SCANmechjeb>();
2929
}
3030
else
31+
{
3132
Destroy(gameObject);
33+
}
3234
}
3335
}
3436
}

SCANmechjeb/SCANmechjeb.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,16 @@ private IEnumerator WaitForReady()
5151
shutdown = true;
5252

5353
while (!FlightGlobals.ready || FlightGlobals.ActiveVessel == null)
54+
{
5455
yield return null;
56+
}
5557

5658
vessel = FlightGlobals.ActiveVessel;
5759

5860
if (vessel == null)
61+
{
5962
yield break;
63+
}
6064

6165
VesselChange(vessel);
6266

@@ -65,9 +69,13 @@ private IEnumerator WaitForReady()
6569
data = SCANUtil.getData(body);
6670

6771
if (data == null)
72+
{
6873
shutdown = true;
74+
}
6975
else
76+
{
7077
shutdown = false;
78+
}
7179
}
7280

7381
private void OnDestroy()
@@ -81,36 +89,54 @@ private void OnDestroy()
8189
private void LateUpdate()
8290
{
8391
if (shutdown || !mjOnboard || mjTechTreeLocked || body == null || vessel == null || data == null)
92+
{
8493
return;
94+
}
8595

8696
if (!HighLogic.LoadedSceneIsFlight || !FlightGlobals.ready)
97+
{
8798
return;
99+
}
88100

89101
way = null;
90102

91103
if (!SCAN_Settings_Config.Instance.MechJebTarget)
104+
{
92105
return;
106+
}
93107

94108
if (SCANcontroller.controller == null)
109+
{
95110
return;
111+
}
96112

97113
if (!SCANcontroller.controller.MechJebLoaded)
114+
{
98115
SCANcontroller.controller.MechJebLoaded = true;
116+
}
99117

100118
if (target.Target == null)
119+
{
101120
return;
121+
}
102122

103123
if (target.targetBody != body)
124+
{
104125
return;
126+
}
105127

106128
if ((target.Target is DirectionTarget))
129+
{
107130
return;
131+
}
108132

109133
coords.x = target.targetLongitude;
110134
coords.y = target.targetLatitude;
111135

112136
if (SCANcontroller.controller.LandingTarget != null)
137+
{
113138
way = SCANcontroller.controller.LandingTarget;
139+
}
114140

115141
if (way != null)
116142
{
@@ -132,31 +158,41 @@ private void LateUpdate()
132158
private void OnTargetSet(Vector2d pos, CelestialBody b)
133159
{
134160
if (!mjOnboard || target == null)
161+
{
135162
return;
163+
}
136164

137165
target.SetPositionTarget(b, pos.y, pos.x);
138166
}
139167

140168
private void SOIChange(GameEvents.HostedFromToAction<Vessel, CelestialBody> action)
141169
{
142170
if (vessel == null)
171+
{
143172
return;
173+
}
144174

145175
if (vessel != action.host)
176+
{
146177
return;
178+
}
147179

148180
body = action.to;
149181

150182
data = SCANUtil.getData(body);
151183

152184
if (data == null)
185+
{
153186
shutdown = true;
187+
}
154188
}
155189

156190
private void VesselChange(Vessel v)
157191
{
158192
if (vessel != v)
193+
{
159194
return;
195+
}
160196

161197
body = v.mainBody;
162198

@@ -192,7 +228,9 @@ private void VesselChange(Vessel v)
192228
if (HighLogic.CurrentGame.Mode != Game.Modes.SANDBOX)
193229
{
194230
if (guidanceModule == null)
231+
{
195232
guidanceModule = (DisplayModule)mjCore.GetComputerModule("MechJebModuleLandingGuidance");
233+
}
196234

197235
if (guidanceModule == null)
198236
{

SCANmechjeb/SCANmechjebMainMenu.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,30 +46,42 @@ private bool checkLoaded()
4646
var SCANassembly = AssemblyLoader.loadedAssemblies.FirstOrDefault(a => a.assembly.GetName().Name == SCANsatName);
4747

4848
if (SCANassembly == null)
49+
{
4950
return false;
51+
}
5052

5153
var infoV = Attribute.GetCustomAttribute(SCANassembly.assembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
5254

5355
if (infoV == null)
56+
{
5457
return false;
58+
}
5559

5660
var SCANmechjebAssembly = Assembly.GetExecutingAssembly();
5761

5862
if (SCANmechjebAssembly == null)
63+
{
5964
return false;
65+
}
6066

6167
var SMinfoV = Attribute.GetCustomAttribute(SCANmechjebAssembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute;
6268

6369
if (SMinfoV == null)
70+
{
6471
return false;
72+
}
6573

6674
if (infoV.InformationalVersion != SMinfoV.InformationalVersion)
75+
{
6776
return false;
77+
}
6878

6979
var MechJebAssembly = AssemblyLoader.loadedAssemblies.FirstOrDefault(a => a.assembly.GetName().Name == MechJeb);
7080

7181
if (MechJebAssembly == null)
82+
{
7283
return false;
84+
}
7385

7486
if (MechJebAssembly.assembly.GetName().Version == MechJebVersion)
7587
{

SCANsat.Unity/CanvasFader.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,19 @@ protected virtual void Awake()
3838
protected void Fade(float to, bool fast, Action call = null, bool interrupt = true, bool overrule = false)
3939
{
4040
if (canvas == null)
41+
{
4142
return;
43+
}
4244

4345
Fade(canvas.alpha, to, fast ? FastRate : SlowRate, call, interrupt, overrule);
4446
}
4547

4648
protected void Alpha(float to)
4749
{
4850
if (canvas == null)
51+
{
4952
return;
53+
}
5054

5155
to = Mathf.Clamp01(to);
5256
canvas.alpha = to;
@@ -55,10 +59,14 @@ protected void Alpha(float to)
5559
private void Fade(float from, float to, float duration, Action call, bool interrupt, bool overrule)
5660
{
5761
if (!allowInterrupt && !overrule)
62+
{
5863
return;
64+
}
5965

6066
if (fader != null)
67+
{
6168
StopCoroutine(fader);
69+
}
6270

6371
fader = FadeRoutine(from, to, duration, call, interrupt);
6472
StartCoroutine(fader);
@@ -80,7 +88,9 @@ private IEnumerator FadeRoutine(float from, float to, float duration, Action cal
8088
}
8189

8290
if (call != null)
91+
{
8392
call.Invoke();
93+
}
8494

8595
allowInterrupt = true;
8696

SCANsat.Unity/HSVPicker/Events/ColorChangedEvent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ namespace SCANsat.Unity.HSVPicker.Events
77
[Serializable]
88
public class ColorChangedEvent : UnityEvent<Color>
99
{
10-
10+
1111
}
1212
}

SCANsat.Unity/HSVPicker/UI/ColorImage.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ private void OnDestroy()
3737
private void ColorChanged(Color newColor)
3838
{
3939
if (_isActive)
40+
{
4041
image.color = newColor;
42+
}
4143
}
4244

4345
public void SetColor(Color newColor)

0 commit comments

Comments
 (0)