From 81eadf3d35a14aa30750fefd6bce36186764fb18 Mon Sep 17 00:00:00 2001 From: Aaron Franke Date: Fri, 3 Jul 2020 23:04:47 -0400 Subject: [PATCH] Add a formatting script for GitHub Actions --- .github/FUNDING.yml | 2 + .github/ISSUE_TEMPLATE/bug-report.md | 30 +++++++++++++ .../feature---enhancement-request.md | 13 ++++++ .github/workflows/ci.yml | 15 +++++++ GodotAddin/Debugging/GodotDebuggerEngine.cs | 2 +- GodotAddin/Debugging/GodotDebuggerSession.cs | 2 +- .../Debugging/GodotDebuggerStartInfo.cs | 2 +- GodotAddin/Debugging/GodotExecutionCommand.cs | 2 +- GodotAddin/Debugging/GodotSoftDebuggerArgs.cs | 2 +- GodotAddin/GodotMessaging/MessageHandler.cs | 2 +- GodotAddin/GodotOptionsPanel.cs | 2 +- GodotAddin/GodotProjectExtension.cs | 2 +- GodotAddin/MonoDevelopLogger.cs | 2 +- GodotAddin/Properties/AddinInfo.cs | 2 +- GodotAddin/Properties/Manifest.addin.xml | 2 +- GodotAddin/Settings.cs | 2 +- GodotAddin/Utils/ExtensionMethods.cs | 2 +- format.sh | 44 +++++++++++++++++++ 18 files changed, 117 insertions(+), 13 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug-report.md create mode 100644 .github/ISSUE_TEMPLATE/feature---enhancement-request.md create mode 100644 .github/workflows/ci.yml create mode 100755 format.sh diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..0820ab1 --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,2 @@ +patreon: godotengine +custom: https://godotengine.org/donate diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..636a2f7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,30 @@ +--- +name: Bug Report +about: Report a bug with the extension. +title: '' +labels: bug +assignees: neikeq + +--- + + + +**OS/device including version:** + + + +**Issue description:** + + + +**Screenshots of issue:** + diff --git a/.github/ISSUE_TEMPLATE/feature---enhancement-request.md b/.github/ISSUE_TEMPLATE/feature---enhancement-request.md new file mode 100644 index 0000000..f341400 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature---enhancement-request.md @@ -0,0 +1,13 @@ +--- +name: Feature / Enhancement Request +about: Adding new features or improving existing ones. +title: '' +labels: enhancement +assignees: neikeq + +--- + + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e941dfc --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,15 @@ +name: Continuous integration +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-20.04 + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Lint extension + run: | + sudo apt-get update -qq + sudo apt-get install -qq dos2unix recode + bash ./format.sh diff --git a/GodotAddin/Debugging/GodotDebuggerEngine.cs b/GodotAddin/Debugging/GodotDebuggerEngine.cs index 625e93e..e5b9f41 100644 --- a/GodotAddin/Debugging/GodotDebuggerEngine.cs +++ b/GodotAddin/Debugging/GodotDebuggerEngine.cs @@ -1,4 +1,4 @@ -using System.IO; +using System.IO; using System.Net; using System.Text.RegularExpressions; using Mono.Debugging.Client; diff --git a/GodotAddin/Debugging/GodotDebuggerSession.cs b/GodotAddin/Debugging/GodotDebuggerSession.cs index 5ffb617..348737c 100644 --- a/GodotAddin/Debugging/GodotDebuggerSession.cs +++ b/GodotAddin/Debugging/GodotDebuggerSession.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Diagnostics; using System.IO; using System.Net.Sockets; diff --git a/GodotAddin/Debugging/GodotDebuggerStartInfo.cs b/GodotAddin/Debugging/GodotDebuggerStartInfo.cs index 013a543..0c653ed 100644 --- a/GodotAddin/Debugging/GodotDebuggerStartInfo.cs +++ b/GodotAddin/Debugging/GodotDebuggerStartInfo.cs @@ -1,4 +1,4 @@ -using Mono.Debugging.Soft; +using Mono.Debugging.Soft; namespace GodotAddin.Debugging { diff --git a/GodotAddin/Debugging/GodotExecutionCommand.cs b/GodotAddin/Debugging/GodotExecutionCommand.cs index ba9dce4..f898a0d 100644 --- a/GodotAddin/Debugging/GodotExecutionCommand.cs +++ b/GodotAddin/Debugging/GodotExecutionCommand.cs @@ -1,4 +1,4 @@ -using GodotTools.IdeMessaging; +using GodotTools.IdeMessaging; using MonoDevelop.Core.Execution; namespace GodotAddin.Debugging diff --git a/GodotAddin/Debugging/GodotSoftDebuggerArgs.cs b/GodotAddin/Debugging/GodotSoftDebuggerArgs.cs index 400417a..9af971c 100644 --- a/GodotAddin/Debugging/GodotSoftDebuggerArgs.cs +++ b/GodotAddin/Debugging/GodotSoftDebuggerArgs.cs @@ -1,4 +1,4 @@ -using System.Net; +using System.Net; using Mono.Debugging.Soft; namespace GodotAddin.Debugging diff --git a/GodotAddin/GodotMessaging/MessageHandler.cs b/GodotAddin/GodotMessaging/MessageHandler.cs index fc853ef..5b4c815 100644 --- a/GodotAddin/GodotMessaging/MessageHandler.cs +++ b/GodotAddin/GodotMessaging/MessageHandler.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Threading; using System.Threading.Tasks; using GodotTools.IdeMessaging; diff --git a/GodotAddin/GodotOptionsPanel.cs b/GodotAddin/GodotOptionsPanel.cs index 582f629..f8ad254 100644 --- a/GodotAddin/GodotOptionsPanel.cs +++ b/GodotAddin/GodotOptionsPanel.cs @@ -1,4 +1,4 @@ -using MonoDevelop.Ide.Gui.Dialogs; +using MonoDevelop.Ide.Gui.Dialogs; using MonoDevelop.Components; using MonoDevelop.Core; diff --git a/GodotAddin/GodotProjectExtension.cs b/GodotAddin/GodotProjectExtension.cs index bdda0f7..0ef8ac4 100644 --- a/GodotAddin/GodotProjectExtension.cs +++ b/GodotAddin/GodotProjectExtension.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.IO; using System.Runtime.InteropServices; diff --git a/GodotAddin/MonoDevelopLogger.cs b/GodotAddin/MonoDevelopLogger.cs index bbdfce1..308280d 100644 --- a/GodotAddin/MonoDevelopLogger.cs +++ b/GodotAddin/MonoDevelopLogger.cs @@ -1,4 +1,4 @@ -using System; +using System; using MonoDevelop.Core; namespace GodotAddin diff --git a/GodotAddin/Properties/AddinInfo.cs b/GodotAddin/Properties/AddinInfo.cs index d7f1e2e..c6b359f 100644 --- a/GodotAddin/Properties/AddinInfo.cs +++ b/GodotAddin/Properties/AddinInfo.cs @@ -1,4 +1,4 @@ -using Mono.Addins; +using Mono.Addins; using Mono.Addins.Description; [assembly: Addin( diff --git a/GodotAddin/Properties/Manifest.addin.xml b/GodotAddin/Properties/Manifest.addin.xml index e955001..e4ae03f 100644 --- a/GodotAddin/Properties/Manifest.addin.xml +++ b/GodotAddin/Properties/Manifest.addin.xml @@ -1,4 +1,4 @@ - + /dev/null + # Ensures that files have LF line endings. + dos2unix "$f" 2> /dev/null + # Ensures that files do not contain a BOM. + sed -i '1s/^\xEF\xBB\xBF//' "$f" + # Ensures that files end with newline characters. + tail -c1 < "$f" | read -r _ || echo >> "$f"; + # Remove trailing space characters. + sed -z -i 's/\x20\x0A/\x0A/g' "$f" +done + +git diff > patch.patch +FILESIZE="$(stat -c%s patch.patch)" +MAXSIZE=5 + +# If no patch has been generated all is OK, clean up, and exit. +if (( FILESIZE < MAXSIZE )); then + printf "Files in this commit comply with the formatting rules.\n" + rm -f patch.patch + exit 0 +fi + +# A patch has been created, notify the user, clean up, and exit. +printf "\n*** The following differences were found between the code " +printf "and the formatting rules:\n\n" +cat patch.patch +printf "\n*** Aborting, please fix your commit(s) with 'git commit --amend' or 'git rebase -i '\n" +rm -f patch.patch +exit 1