Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/trailing-whitespace-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Trailing Whitespace Check

on:
pull_request:
types: [opened, synchronize, reopened]

jobs:
check-trailing-whitespace:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0

Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The checkout action should also fetch the base branch to ensure accurate diff comparison. Consider adding:

- name: Fetch base branch
  run: git fetch origin ${{ github.event.pull_request.base.ref }}

before the "Check for trailing whitespace" step, or use fetch-depth: 2 instead of 0 for better performance.

Suggested change
- name: Fetch base branch
run: git fetch origin ${{ github.event.pull_request.base.ref }}

Copilot uses AI. Check for mistakes.
- name: Check for trailing whitespace
run: |
echo "Checking for trailing whitespace in changed files..."

# Get the base branch
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"

# Get list of changed files (excluding deleted files)
CHANGED_FILES=$(git diff --name-only --diff-filter=d "$BASE_SHA" "$HEAD_SHA")

if [ -z "$CHANGED_FILES" ]; then
echo "No files to check."
exit 0
fi

# File patterns to check (text files)
PATTERNS="\.cs$|\.csproj$|\.sln$|\.ts$|\.html$|\.css$|\.scss$"
Copy link

Copilot AI Nov 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The pattern .sln$ is included in the check patterns, but the .DotSettings file being added in this PR is not covered. Consider adding \.DotSettings$ to the patterns if you want to check these configuration files for trailing whitespace as well.

Suggested change
PATTERNS="\.cs$|\.csproj$|\.sln$|\.ts$|\.html$|\.css$|\.scss$"
PATTERNS="\.cs$|\.csproj$|\.sln$|\.DotSettings$|\.ts$|\.html$|\.css$|\.scss$"

Copilot uses AI. Check for mistakes.

# Directories and file patterns to exclude
EXCLUDE_PATTERNS="(^|\/)(\.|node_modules|bin|obj|artifacts|packages|\.vs|\.nuke\/temp)($|\/)"

ERRORS_FOUND=0
TEMP_FILE=$(mktemp)

while IFS= read -r file; do
# Skip if file doesn't exist (shouldn't happen with --diff-filter=d, but just in case)
if [ ! -f "$file" ]; then
continue
fi

# Check if file matches patterns to check
if ! echo "$file" | grep -qE "$PATTERNS"; then
continue
fi

# Check if file should be excluded
if echo "$file" | grep -qE "$EXCLUDE_PATTERNS"; then
continue
fi

# Find trailing whitespace lines, excluding XML doc placeholder lines that are exactly "/// " (one space)
MATCHES=$(grep -n '[[:space:]]$' "$file" | grep -vE '^[0-9]+:[[:space:]]*/// $' || true)

if [ -n "$MATCHES" ]; then
echo "❌ Trailing whitespace found in: $file"
echo "$MATCHES" | head -10
TOTAL=$(echo "$MATCHES" | wc -l)
if [ "$TOTAL" -gt 10 ]; then
echo " ... and $(($TOTAL - 10)) more lines"
fi
echo "1" >> "$TEMP_FILE"
fi
done <<< "$CHANGED_FILES"

ERRORS_FOUND=$(wc -l < "$TEMP_FILE" 2>/dev/null || echo "0")
rm -f "$TEMP_FILE"

if [ "$ERRORS_FOUND" -gt 0 ]; then
echo ""
echo "❌ Found trailing whitespace in $ERRORS_FOUND file(s)."
echo "Please remove trailing whitespace from the files listed above."
exit 1
else
echo "✅ No trailing whitespace found in changed files."
exit 0
fi
2 changes: 1 addition & 1 deletion nuke/ReleaseNotesParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private IReadOnlyList<ReleaseNotes> ParseComplexFormat(string[] lines)

// Parse content.
var notes = new List<string>();

while (true)
{
// Sanity checks.
Expand Down
4 changes: 3 additions & 1 deletion src/ElectronNET.API/API/ApiBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// ReSharper disable InconsistentNaming

namespace ElectronNET.API
{
using Common;
Expand All @@ -17,6 +18,7 @@ protected enum SocketTaskEventNameTypes
DashesLowerFirst,
NoDashUpperFirst
}

protected enum SocketTaskMessageNameTypes
{
DashesLowerFirst,
Expand Down Expand Up @@ -370,4 +372,4 @@ public bool Unregister<T>(Action<T> receiver)
}
}
}
}
}
9 changes: 4 additions & 5 deletions src/ElectronNET.API/API/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public event Action WindowAllClosed
private event Action _windowAllClosed;

/// <summary>
/// Emitted before the application starts closing its windows.
/// Emitted before the application starts closing its windows.
/// <para/>
/// Note: If application quit was initiated by <see cref="AutoUpdater.QuitAndInstall"/> then <see cref="BeforeQuit"/>
/// is emitted after emitting close event on all windows and closing them.
Expand Down Expand Up @@ -399,7 +399,6 @@ internal static App Instance
private static object _syncRoot = new object();



/// <summary>
/// Try to close all windows. The <see cref="BeforeQuit"/> event will be emitted first. If all windows are successfully
/// closed, the <see cref="WillQuit"/> event will be emitted and by default the application will terminate. This method
Expand Down Expand Up @@ -558,7 +557,7 @@ public void SetPath(PathName name, string path)
}

/// <summary>
/// The version of the loaded application. If no version is found in the application’s package.json file,
/// The version of the loaded application. If no version is found in the application’s package.json file,
/// the version of the current bundle or executable is returned.
/// </summary>
/// <returns>The version of the loaded application.</returns>
Expand Down Expand Up @@ -1245,7 +1244,7 @@ public Task<string> UserAgentFallbackAsync
return Task.Run(() =>
{
var taskCompletionSource = new TaskCompletionSource<string>();

BridgeConnector.Socket.Once<string>("appGetUserAgentFallbackCompleted", taskCompletionSource.SetResult);
BridgeConnector.Socket.Emit("appGetUserAgentFallback");

Expand Down Expand Up @@ -1295,4 +1294,4 @@ public void Once(string eventName, Action action)
public async Task Once(string eventName, Action<object> action)
=> await Events.Instance.Once(ModuleName, eventName, action).ConfigureAwait(false);
}
}
}
30 changes: 13 additions & 17 deletions src/ElectronNET.API/API/AutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace ElectronNET.API
/// <summary>
/// Enable apps to automatically update themselves. Based on electron-updater.
/// </summary>
public sealed class AutoUpdater: ApiBase
public sealed class AutoUpdater : ApiBase
{
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;
Expand Down Expand Up @@ -49,7 +49,7 @@ public bool AutoInstallOnAppQuit
}

/// <summary>
/// *GitHub provider only.* Whether to allow update to pre-release versions.
/// *GitHub provider only.* Whether to allow update to pre-release versions.
/// Defaults to "true" if application version contains prerelease components (e.g. "0.12.1-alpha.1", here "alpha" is a prerelease component), otherwise "false".
///
/// If "true", downgrade will be allowed("allowDowngrade" will be set to "true").
Expand All @@ -67,7 +67,7 @@ public bool AllowPrerelease
}

/// <summary>
/// *GitHub provider only.*
/// *GitHub provider only.*
/// Get all release notes (from current version to latest), not just the latest (Default is false).
/// </summary>
public bool FullChangelog
Expand Down Expand Up @@ -122,7 +122,7 @@ public Task<SemVer> CurrentVersionAsync
}

/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Get the update channel. Not applicable for GitHub.
/// Doesn’t return channel from the update configuration, only if was previously set.
/// </summary>
[Obsolete("Use the asynchronous version ChannelAsync instead")]
Expand All @@ -135,7 +135,7 @@ public string Channel
}

/// <summary>
/// Get the update channel. Not applicable for GitHub.
/// Get the update channel. Not applicable for GitHub.
/// Doesn’t return channel from the update configuration, only if was previously set.
/// </summary>
public Task<string> ChannelAsync
Expand All @@ -147,7 +147,7 @@ public Task<string> ChannelAsync
}

/// <summary>
/// Set the update channel. Not applicable for GitHub.
/// Set the update channel. Not applicable for GitHub.
/// </summary>
public string SetChannel
{
Expand Down Expand Up @@ -199,7 +199,7 @@ public event Action OnCheckingForUpdate
}

/// <summary>
/// Emitted when there is an available update.
/// Emitted when there is an available update.
/// The update is downloaded automatically if AutoDownload is true.
/// </summary>
public event Action<UpdateInfo> OnUpdateAvailable
Expand Down Expand Up @@ -332,11 +332,11 @@ public Task<UpdateCheckResult> CheckForUpdatesAndNotifyAsync()
}

/// <summary>
/// Restarts the app and installs the update after it has been downloaded.
/// It should only be called after `update-downloaded` has been emitted.
///
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
/// This is different from the normal quit event sequence.
/// Restarts the app and installs the update after it has been downloaded.
/// It should only be called after `update-downloaded` has been emitted.
///
/// Note: QuitAndInstall() will close all application windows first and only emit `before-quit` event on `app` after that.
/// This is different from the normal quit event sequence.
/// </summary>
/// <param name="isSilent">*windows-only* Runs the installer in silent mode. Defaults to `false`.</param>
/// <param name="isForceRunAfter">Run the app after finish even on silent install. Not applicable for macOS. Ignored if `isSilent` is set to `false`.</param>
Expand Down Expand Up @@ -374,9 +374,5 @@ public Task<string> GetFeedURLAsync()

return tcs.Task;
}


}
}


}
6 changes: 3 additions & 3 deletions src/ElectronNET.API/API/BrowserView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ namespace ElectronNET.API
/// It is like a child window, except that it is positioned relative to its owning window.
/// It is meant to be an alternative to the webview tag.
/// </summary>
public class BrowserView: ApiBase
public class BrowserView : ApiBase
{
protected override SocketTaskEventNameTypes SocketTaskEventNameType => SocketTaskEventNameTypes.DashesLowerFirst;
protected override SocketTaskMessageNameTypes SocketTaskMessageNameType => SocketTaskMessageNameTypes.DashesLowerFirst;

/// <summary>
/// Gets the identifier.
/// </summary>
Expand Down Expand Up @@ -69,5 +70,4 @@ public void SetBackgroundColor(string color)
BridgeConnector.Socket.Emit("browserView-setBackgroundColor", Id, color);
}
}
}

}
Loading