diff --git a/.editorconfig b/.editorconfig index e1fcc81..0e51c5f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -6,3 +6,15 @@ insert_final_newline = true indent_size = 4 indent_style = tab +[*.{yml,yaml}] +indent_size = 2 +indent_style = space + +[*.clang-format] +indent_size = 2 +indent_style = space + +[*.{cc,hh,cpp,hpp,h,cpp}] +# matching .clang-format IndentWidth +indent_size = 2 +indent_style = tab diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..d7d6b2c --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,22 @@ +name: main + +on: + pull_request: + merge_group: + +jobs: + typos-check: + name: Typos Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@cfe759ac8dd421e203cc293a373396fbc6fe0d4b # v1.22.7 + + formatting-check: + name: Formatting Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: greut/eclint-action@v0 + - uses: jidicula/clang-format-action@v4.11.0 + with: { clang-format-version: "18" } diff --git a/Source/EcsactEditor/Private/EcsactEditor.cpp b/Source/EcsactEditor/Private/EcsactEditor.cpp index 2444c68..027b110 100644 --- a/Source/EcsactEditor/Private/EcsactEditor.cpp +++ b/Source/EcsactEditor/Private/EcsactEditor.cpp @@ -212,10 +212,11 @@ auto FEcsactEditorModule::RunCodegen() -> void { auto FEcsactEditorModule::RunBuild() -> void { const auto* settings = GetDefault(); - auto ecsact_runtime_path = FPaths::Combine( - FPaths::ProjectDir(), - TEXT("Binaries/Win64/EcsactRuntime.dll") - ); + + auto ecsact_runtime_path = FPaths::Combine( + FPaths::ProjectDir(), + TEXT("Binaries/Win64/EcsactRuntime.dll") + ); auto temp_dir = FPaths::CreateTempFilename(TEXT("EcsactBuild")); auto ecsact_files = GetAllEcsactFiles(); @@ -290,86 +291,89 @@ auto FEcsactEditorModule::OnReceiveEcsactCliJsonMessage(FString Json) -> void { auto json_object = TSharedPtr{}; auto reader = TJsonReaderFactory<>::Create(Json); - if(FJsonSerializer::Deserialize(reader, json_object) && - json_object.IsValid()) { - auto message_type = json_object->GetStringField(TEXT("type")); - - if(message_type == "info") { - UE_LOG( - EcsactEditor, - Log, - TEXT("%s"), - *json_object->GetStringField(TEXT("content")) - ); - } else if(message_type == "error") { - UE_LOG( - EcsactEditor, - Error, - TEXT("%s"), - *json_object->GetStringField(TEXT("content")) - ); - } else if(message_type == "warning") { - UE_LOG( - EcsactEditor, - Warning, - TEXT("%s"), - *json_object->GetStringField(TEXT("content")) - ); - } else if(message_type == "subcommand_start") { - UE_LOG( - EcsactEditor, - Log, - TEXT("subcommand(%i): %s"), - json_object->GetIntegerField(TEXT("id")), - *json_object->GetStringField(TEXT("executable")) - ); - } else if(message_type == "subcommand_end") { - UE_LOG( - EcsactEditor, - Log, - TEXT("subcommand(%i): exit code %i"), - json_object->GetIntegerField(TEXT("id")), - json_object->GetIntegerField(TEXT("exit_code")) - ); - } else if(message_type == "subcommand_stdout") { - UE_LOG( - EcsactEditor, - Log, - TEXT("subcommand(%i): %s"), - json_object->GetIntegerField(TEXT("id")), - *json_object->GetStringField(TEXT("line")) - ); - } else if(message_type == "subcommand_stderr") { - UE_LOG( - EcsactEditor, - Error, - TEXT("subcommand(%i): %s"), - json_object->GetIntegerField(TEXT("id")), - *json_object->GetStringField(TEXT("line")) - ); - } else if(message_type == "success") { - UE_LOG( - EcsactEditor, - Log, - TEXT("%s"), - *json_object->GetStringField(TEXT("content")) - ); - } else { - UE_LOG( - EcsactEditor, - Warning, - TEXT("Unhandled Message (%s): %s"), - *message_type, - *Json - ); - } - } else { + if(!FJsonSerializer::Deserialize(reader, json_object)) { UE_LOG( EcsactEditor, Error, TEXT("Failed to parse JSON message: %s"), *Json ); + return; + } + if(!json_object.IsValid()) { + return; + } + + auto message_type = json_object->GetStringField(TEXT("type")); + + if(message_type == "info") { + UE_LOG( + EcsactEditor, + Log, + TEXT("%s"), + *json_object->GetStringField(TEXT("content")) + ); + } else if(message_type == "error") { + UE_LOG( + EcsactEditor, + Error, + TEXT("%s"), + *json_object->GetStringField(TEXT("content")) + ); + } else if(message_type == "warning") { + UE_LOG( + EcsactEditor, + Warning, + TEXT("%s"), + *json_object->GetStringField(TEXT("content")) + ); + } else if(message_type == "subcommand_start") { + UE_LOG( + EcsactEditor, + Log, + TEXT("subcommand(%i): %s"), + json_object->GetIntegerField(TEXT("id")), + *json_object->GetStringField(TEXT("executable")) + ); + } else if(message_type == "subcommand_end") { + UE_LOG( + EcsactEditor, + Log, + TEXT("subcommand(%i): exit code %i"), + json_object->GetIntegerField(TEXT("id")), + json_object->GetIntegerField(TEXT("exit_code")) + ); + } else if(message_type == "subcommand_stdout") { + UE_LOG( + EcsactEditor, + Log, + TEXT("subcommand(%i): %s"), + json_object->GetIntegerField(TEXT("id")), + *json_object->GetStringField(TEXT("line")) + ); + } else if(message_type == "subcommand_stderr") { + UE_LOG( + EcsactEditor, + Error, + TEXT("subcommand(%i): %s"), + json_object->GetIntegerField(TEXT("id")), + *json_object->GetStringField(TEXT("line")) + ); + } else if(message_type == "success") { + UE_LOG( + EcsactEditor, + Log, + TEXT("%s"), + *json_object->GetStringField(TEXT("content")) + ); + } else { + UE_LOG( + EcsactEditor, + Warning, + TEXT("Unhandled Message (%s): %s"), + *message_type, + *Json + ); } } diff --git a/Source/EcsactEditor/Private/EcsactSettings.cpp b/Source/EcsactEditor/Private/EcsactSettings.cpp index 654021d..a6006dd 100644 --- a/Source/EcsactEditor/Private/EcsactSettings.cpp +++ b/Source/EcsactEditor/Private/EcsactSettings.cpp @@ -2,4 +2,3 @@ UEcsactSettings::UEcsactSettings() { } - diff --git a/typos.toml b/typos.toml new file mode 100644 index 0000000..aba31d8 --- /dev/null +++ b/typos.toml @@ -0,0 +1,6 @@ +[files] +extend-exclude = ["CHANGELOG.md"] + +[default] +extend-ignore-re = ["(?Rm)^.*(#|//)\\s*typos:disable-line$"] +extend-ignore-words-re = ["UE"]