Skip to content

Commit

Permalink
Add a simple C# .editorconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronfranke committed Jul 23, 2021
1 parent b918c4c commit 5f8275d
Show file tree
Hide file tree
Showing 30 changed files with 110 additions and 124 deletions.
6 changes: 1 addition & 5 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,11 @@ trim_trailing_whitespace = true
indent_style = space
indent_size = 4

[{*.{py,cs},SConstruct,SCsub}]
[{*.py,SConstruct,SCsub}]
indent_style = space
indent_size = 4

# YAML requires indentation with spaces instead of tabs.
[*.{yml,yaml}]
indent_style = space
indent_size = 2

[*.{csproj,props,targets,nuspec}]
indent_style = space
indent_size = 2
14 changes: 14 additions & 0 deletions modules/mono/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[*.sln]
indent_style = tab

[*.{csproj,props,targets,nuspec,resx}]
indent_style = space
indent_size = 2

[*.cs]
indent_style = space
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
max_line_length = 120
csharp_indent_case_contents_when_block = false
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@
<PackageProjectUrl>$(RepositoryUrl)</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <!-- Generates a package at build -->
<IncludeBuildOutput>false</IncludeBuildOutput> <!-- Do not include the generator as a lib dependency -->
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<!-- Do not include the generator as a lib dependency -->
<IncludeBuildOutput>false</IncludeBuildOutput>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.8.0" PrivateAssets="all" />
Expand Down
1 change: 0 additions & 1 deletion modules/mono/editor/GodotTools/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,3 @@ healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,7 @@ private static async Task<int> StartAsync(string[] args, Stream inputStream, Str
}
}

ExitMainLoop:

ExitMainLoop:
await forwarder.WriteLineToOutput("Event=Quit");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public static void MigrateFromOldConfigNames(string slnPath)
{"Tools|Any CPU", "ExportRelease|Any CPU"}
};

var regex = new Regex(string.Join("|",dict.Keys.Select(Regex.Escape)));
var result = regex.Replace(input,m => dict[m.Value]);
var regex = new Regex(string.Join("|", dict.Keys.Select(Regex.Escape)));
var result = regex.Replace(input, m => dict[m.Value]);

if (result != input)
{
Expand Down
34 changes: 17 additions & 17 deletions modules/mono/editor/GodotTools/GodotTools/Export/AotBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -577,27 +577,27 @@ private static string GetMonoCrossDesktopDirName(string platform, string bits)
{
case OS.Platforms.Windows:
case OS.Platforms.UWP:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"windows-{arch}";
}
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"windows-{arch}";
}
case OS.Platforms.MacOS:
{
Debug.Assert(bits == null || bits == "64");
string arch = "x86_64";
return $"{platform}-{arch}";
}
{
Debug.Assert(bits == null || bits == "64");
string arch = "x86_64";
return $"{platform}-{arch}";
}
case OS.Platforms.LinuxBSD:
case OS.Platforms.Server:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"linux-{arch}";
}
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"linux-{arch}";
}
case OS.Platforms.Haiku:
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"{platform}-{arch}";
}
{
string arch = bits == "64" ? "x86_64" : "i686";
return $"{platform}-{arch}";
}
default:
throw new NotSupportedException($"Platform not supported: {platform}");
}
Expand Down
3 changes: 2 additions & 1 deletion modules/mono/editor/GodotTools/GodotTools/GodotTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
<ProjectGuid>{27B00618-A6F2-4828-B922-05CAEB08C286}</ProjectGuid>
<TargetFramework>net472</TargetFramework>
<LangVersion>7.2</LangVersion>
<GodotApiConfiguration>Debug</GodotApiConfiguration> <!-- The Godot editor uses the Debug Godot API assemblies -->
<!-- The Godot editor uses the Debug Godot API assemblies -->
<GodotApiConfiguration>Debug</GodotApiConfiguration>
<GodotSourceRootPath>$(SolutionDir)/../../../../</GodotSourceRootPath>
<GodotOutputDataDir>$(GodotSourceRootPath)/bin/GodotSharp</GodotOutputDataDir>
<GodotApiAssembliesDir>$(GodotOutputDataDir)/Api/$(GodotApiConfiguration)</GodotApiAssembliesDir>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static void Initialize()

public static bool IsExternalEditorSetToRider(EditorSettings editorSettings)
{
return editorSettings.HasSetting(EditorPathSettingName) && IsRider((string) editorSettings.GetSetting(EditorPathSettingName));
return editorSettings.HasSetting(EditorPathSettingName) && IsRider((string)editorSettings.GetSetting(EditorPathSettingName));
}

public static bool IsRider(string path)
Expand Down
10 changes: 2 additions & 8 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/AABB.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
// file: core/math/aabb.h
// commit: 7ad14e7a3e6f87ddc450f7e34621eb5200808451
// file: core/math/aabb.cpp
// commit: bd282ff43f23fe845f29a3e25c8efc01bd65ffb0
// file: core/variant_call.cpp
// commit: 5ad9be4c24e9d7dc5672fdc42cea896622fe5685
using System;
using System.Runtime.InteropServices;
#if REAL_T_IS_DOUBLE
using real_t = System.Double;
#else
using real_t = System.Single;
#endif
using System;
using System.Runtime.InteropServices;

namespace Godot
{
Expand Down
4 changes: 2 additions & 2 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/Basis.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using System.Runtime.InteropServices;
#if REAL_T_IS_DOUBLE
using real_t = System.Double;
#else
using real_t = System.Single;
#endif
using System;
using System.Runtime.InteropServices;

namespace Godot
{
Expand Down
1 change: 0 additions & 1 deletion modules/mono/glue/GodotSharp/GodotSharp/Core/Colors.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Collections.Generic;

namespace Godot
Expand Down
24 changes: 12 additions & 12 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/DelegateUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private static bool TrySerializeSingleDelegate(Delegate @delegate, out byte[] bu
using (var stream = new MemoryStream())
using (var writer = new BinaryWriter(stream))
{
writer.Write((ulong) TargetKind.Static);
writer.Write((ulong)TargetKind.Static);

SerializeType(writer, @delegate.GetType());

Expand All @@ -77,8 +77,8 @@ private static bool TrySerializeSingleDelegate(Delegate @delegate, out byte[] bu
using (var stream = new MemoryStream())
using (var writer = new BinaryWriter(stream))
{
writer.Write((ulong) TargetKind.GodotObject);
writer.Write((ulong) godotObject.GetInstanceId());
writer.Write((ulong)TargetKind.GodotObject);
writer.Write((ulong)godotObject.GetInstanceId());

SerializeType(writer, @delegate.GetType());

Expand All @@ -100,7 +100,7 @@ private static bool TrySerializeSingleDelegate(Delegate @delegate, out byte[] bu
using (var stream = new MemoryStream())
using (var writer = new BinaryWriter(stream))
{
writer.Write((ulong) TargetKind.CompilerGenerated);
writer.Write((ulong)TargetKind.CompilerGenerated);
SerializeType(writer, targetType);

SerializeType(writer, @delegate.GetType());
Expand Down Expand Up @@ -149,14 +149,14 @@ private static bool TrySerializeMethodInfo(BinaryWriter writer, MethodInfo metho
int flags = 0;

if (methodInfo.IsPublic)
flags |= (int) BindingFlags.Public;
flags |= (int)BindingFlags.Public;
else
flags |= (int) BindingFlags.NonPublic;
flags |= (int)BindingFlags.NonPublic;

if (methodInfo.IsStatic)
flags |= (int) BindingFlags.Static;
flags |= (int)BindingFlags.Static;
else
flags |= (int) BindingFlags.Instance;
flags |= (int)BindingFlags.Instance;

writer.Write(flags);

Expand Down Expand Up @@ -238,7 +238,7 @@ private static bool TryDeserializeDelegate(Collections.Array serializedData, out
}
else
{
if (TryDeserializeSingleDelegate((byte[]) elem, out Delegate oneDelegate))
if (TryDeserializeSingleDelegate((byte[])elem, out Delegate oneDelegate))
delegates.Add(oneDelegate);
}
}
Expand All @@ -257,7 +257,7 @@ private static bool TryDeserializeSingleDelegate(byte[] buffer, out Delegate @de
using (var stream = new MemoryStream(buffer, writable: false))
using (var reader = new BinaryReader(stream))
{
var targetKind = (TargetKind) reader.ReadUInt64();
var targetKind = (TargetKind)reader.ReadUInt64();

switch (targetKind)
{
Expand Down Expand Up @@ -353,11 +353,11 @@ private static bool TryDeserializeMethodInfo(BinaryReader reader, out MethodInfo
parameterTypes[i] = parameterType;
}

methodInfo = declaringType.GetMethod(methodName, (BindingFlags) flags, null, parameterTypes, null);
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags, null, parameterTypes, null);
return methodInfo != null && methodInfo.ReturnType == returnType;
}

methodInfo = declaringType.GetMethod(methodName, (BindingFlags) flags);
methodInfo = declaringType.GetMethod(methodName, (BindingFlags)flags);
return methodInfo != null && methodInfo.ReturnType == returnType;
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

using System;
using System.Collections.Generic;
using System.Dynamic;
Expand Down
21 changes: 10 additions & 11 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/GD.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
#if REAL_T_IS_DOUBLE
using real_t = System.Double;
#else
using real_t = System.Single;

#endif
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

// TODO: Add comments describing what this class does. It is not obvious.

Expand All @@ -26,7 +25,7 @@ public static object Convert(object what, Variant.Type type)

public static real_t Db2Linear(real_t db)
{
return (real_t) Math.Exp(db * 0.11512925464970228420089957273422);
return (real_t)Math.Exp(db * 0.11512925464970228420089957273422);
}

public static real_t DecTime(real_t value, real_t amount, real_t step)
Expand All @@ -51,7 +50,7 @@ public static Object InstanceFromId(ulong instanceId)

public static real_t Linear2Db(real_t linear)
{
return (real_t) (Math.Log(linear) * 8.6858896380650365530225783783321);
return (real_t)(Math.Log(linear) * 8.6858896380650365530225783783321);
}

public static Resource Load(string path)
Expand All @@ -76,7 +75,7 @@ public static void PushWarning(string message)

public static void Print(params object[] what)
{
godot_icall_GD_print(Array.ConvertAll(what ?? new object[]{"null"}, x => x != null ? x.ToString() : "null"));
godot_icall_GD_print(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
}

public static void PrintStack()
Expand All @@ -86,22 +85,22 @@ public static void PrintStack()

public static void PrintErr(params object[] what)
{
godot_icall_GD_printerr(Array.ConvertAll(what ?? new object[]{"null"}, x => x != null ? x.ToString() : "null"));
godot_icall_GD_printerr(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
}

public static void PrintRaw(params object[] what)
{
godot_icall_GD_printraw(Array.ConvertAll(what ?? new object[]{"null"}, x => x != null ? x.ToString() : "null"));
godot_icall_GD_printraw(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
}

public static void PrintS(params object[] what)
{
godot_icall_GD_prints(Array.ConvertAll(what ?? new object[]{"null"}, x => x != null ? x.ToString() : "null"));
godot_icall_GD_prints(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
}

public static void PrintT(params object[] what)
{
godot_icall_GD_printt(Array.ConvertAll(what ?? new object[]{"null"}, x => x != null ? x.ToString() : "null"));
godot_icall_GD_printt(Array.ConvertAll(what ?? new object[] { "null" }, x => x != null ? x.ToString() : "null"));
}

public static float Randf()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System;
using System.Diagnostics;

namespace Godot
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Godot
{
Expand Down
4 changes: 0 additions & 4 deletions modules/mono/glue/GodotSharp/GodotSharp/Core/MarshalUtils.cs
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
using System;
using System.Collections;
using System.Collections.Generic;

namespace Godot
{
using Array = Godot.Collections.Array;
using Dictionary = Godot.Collections.Dictionary;

static class MarshalUtils
{
/// <summary>
Expand Down
Loading

0 comments on commit 5f8275d

Please sign in to comment.