Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lint/Format check in CI #97

Merged
merged 5 commits into from
Sep 23, 2024
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
19 changes: 19 additions & 0 deletions .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Code Style Checks

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3

- name: Check Formatting
run: dotnet format ./src/ --verify-no-changes -v:diag

4 changes: 2 additions & 2 deletions src/Cody.AgentTester/AssemblyLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ private static string SelectInstallPath()
private static string finalPath = null;
private static string SelectStreamJsonRpcPath()
{
if(!string.IsNullOrEmpty(finalPath)) return finalPath;
if (!string.IsNullOrEmpty(finalPath)) return finalPath;

var vsPath = SelectInstallPath();
foreach(var folder in folders)
foreach (var folder in folders)
{
var path = Path.Combine(vsPath, folder);
var libPath = Path.Combine(path, "StreamJsonRpc.dll");
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.AgentTester/ConsoleLogger.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cody.Core.Logging;
using Cody.Core.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
Expand Down Expand Up @@ -43,7 +43,7 @@ public void Warn(string message, [CallerMemberName] string callerName = "")
private void WriteToConsole(string prefix, string message, string callerName, Exception ex = null)
{
Console.WriteLine($"{prefix.ToUpper()} {callerName}: {message}");
if(ex != null) Console.WriteLine(ex.ToString());
if (ex != null) Console.WriteLine(ex.ToString());
}
}
}
2 changes: 1 addition & 1 deletion src/Cody.AgentTester/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down
8 changes: 4 additions & 4 deletions src/Cody.Core/Agent/NotificationHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@ public async Task SendWebviewMessage(string handle, string message)
bool handled = _messageFilter.HandleMessage(message);
if (!handled)
await agentClient.ReceiveMessageStringEncoded(new ReceiveMessageStringEncodedParams
{
Id = handle,
MessageStringEncoded = message
});
{
Id = handle,
MessageStringEncoded = message
});
}

[AgentCallback("debug/message")]
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/ProgressNotificationHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ProgressNotificationHandlers(IProgressService progressService)
public void Start(ProgressStartParams progressStart)
{
Action cancelAction = null;
if(progressStart.Options.Cancellable == true)
if (progressStart.Options.Cancellable == true)
{
cancelAction = () => agentService.CancelProgress(progressStart.Id);
};
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/AuthStatus.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/ChatPanelInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cody.Core.Agent.Protocol
namespace Cody.Core.Agent.Protocol
{
public class ChatPanelInfo
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/CodyFilePath.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cody.Core.Agent.Protocol
namespace Cody.Core.Agent.Protocol
{
public class CodyFilePath
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/ConfigOverwrites.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/Position.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/ProtocolTextDocument.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/Range.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cody.Core.Agent.Protocol
namespace Cody.Core.Agent.Protocol
{
public class ReceiveMessageStringEncodedParams
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/ResolveWebviewViewParams.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Cody.Core.Agent.Protocol
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/ServerInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Agent/Protocol/TextDocumentShowParams.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cody.Core.Agent.Protocol
namespace Cody.Core.Agent.Protocol
{
public class TextDocumentShowParams
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.Core/Agent/SetHtmlEvent.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Cody.Core.Agent
{
Expand All @@ -20,4 +20,4 @@ public class AgentResponseEvent : EventArgs
public string Id { get; set; }
public string StringEncodedMessage { get; set; }
}
}
}
2 changes: 1 addition & 1 deletion src/Cody.Core/DocumentSync/DocumentSyncCallback.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Cody.Core.Agent;
using Cody.Core.Agent;
using Cody.Core.Agent.Protocol;
using Cody.Core.Logging;
using System;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/DocumentSync/IDocumentSyncActions.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Ide/IVsVersionService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Cody.Core.Ide
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Infrastructure/IStatusbarService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.Core/Infrastructure/IVersionService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace Cody.Core.Inf
{
Expand All @@ -11,4 +11,4 @@ public interface IVersionService
DateTime BuildDate { get; }
void AddBuildMetadata(string build, bool isDebug);
}
}
}
2 changes: 1 addition & 1 deletion src/Cody.Core/Infrastructure/VersionService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Reflection;

namespace Cody.Core.Inf
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.Core/Infrastructure/WebViewsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public WebViewEvent(WebViewsEventTypes type, string viewId = null)
ViewId = viewId;
}

public WebViewsEventTypes Type { get;}
public WebViewsEventTypes Type { get; }
public string ViewId { get; }
}

Expand Down Expand Up @@ -181,5 +181,5 @@ public void Dispose()
_events?.Dispose();
}
}

}
2 changes: 1 addition & 1 deletion src/Cody.Core/Logging/ILog.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Runtime.CompilerServices;

namespace Cody.Core.Logging
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Logging/IOutputWindowPane.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Cody.Core.Logging
namespace Cody.Core.Logging
{
public interface IOutputWindowPane
{
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down
2 changes: 1 addition & 1 deletion src/Cody.Core/Settings/IUserSettingsProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
6 changes: 3 additions & 3 deletions src/Cody.UI/Controls/WebView2Dev.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ private async Task InitializeWebView()

Logger?.Error("Failed.", ex);
}

}

private async void WebView_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e)
Expand Down Expand Up @@ -118,7 +118,7 @@ public static async Task PostWebMessageAsJson(string message)

public static readonly DependencyProperty HtmlProperty = DependencyProperty.Register(
"Html", typeof(string), typeof(WebView2Dev),
new PropertyMetadata(null, async (d, e) =>
new PropertyMetadata(null, (d, e) =>
{
_controller.SetHtml(e.NewValue as string);
}));
Expand Down Expand Up @@ -159,7 +159,7 @@ public ICommand SendMessage

public static readonly DependencyProperty LoggerProperty = DependencyProperty.Register(
"Logger", typeof(ILog), typeof(WebView2Dev),
new PropertyMetadata(null, async (d, e) =>
new PropertyMetadata(null, (d, e) =>
{
var logger = e.NewValue as ILog;
if (logger != null)
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UI/MVVM/DelegateCommand.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Windows.Input;

Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UI/MVVM/NotifyPropertyChangedBase.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Runtime.CompilerServices;
Expand Down
4 changes: 2 additions & 2 deletions src/Cody.UI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

Expand Down Expand Up @@ -29,4 +29,4 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
// [assembly: AssemblyVersion("1.0.*")]
4 changes: 2 additions & 2 deletions src/Cody.UI/ViewModels/GeneralOptionsViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Cody.UI.ViewModels
{
public class GeneralOptionsViewModel: NotifyPropertyChangedBase
public class GeneralOptionsViewModel : NotifyPropertyChangedBase
{
private readonly ILog _logger;

Expand All @@ -31,7 +31,7 @@ private void GetHelpCommandHandler()
uri = new Uri("https://community.sourcegraph.com/").AbsoluteUri;
Process.Start(new ProcessStartInfo(uri));
}
catch(Exception ex)
catch (Exception ex)
{
_logger.Error($"Opening '{uri}' failed.", ex);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UI/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ private void OnPostMessageHandler(object sender, AgentResponseEvent e)
};
}

private async void OnWebviewRequestHandler(object sender, SetWebviewRequestEvent e)
private void OnWebviewRequestHandler(object sender, SetWebviewRequestEvent e)
{
NotificationHandlers.SendWebviewMessage(e.Handle, e.Messsage);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UI/Views/MainView.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UITester/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UITester/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.UITester/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Reflection;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
Expand Down
2 changes: 1 addition & 1 deletion src/Cody.VisualStudio.Tests/ChatLoggedBasicTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace Cody.VisualStudio.Tests
{
public class ChatLoggedBasicTests: PlaywrightInitializationTests
public class ChatLoggedBasicTests : PlaywrightInitializationTests
{
public ChatLoggedBasicTests(ITestOutputHelper output) : base(output)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Cody.VisualStudio.Tests/PlaywrightTestsBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Cody.VisualStudio.Tests
{
public abstract class PlaywrightTestsBase: TestsBase
public abstract class PlaywrightTestsBase : TestsBase
{
protected string CdpAddress = $"http://localhost:{9222}";

Expand Down Expand Up @@ -145,10 +145,10 @@ protected async Task<IReadOnlyCollection<ContextTag>> GetChatContextTags()
var content = await item.TextContentAsync();
var parts = content.Split(':');
tag.Name = parts.First();
if(parts.Length > 1)
if (parts.Length > 1)
{
var lines = parts[1].Split('-');
if(lines.Length > 1)
if (lines.Length > 1)
{
tag.StartLine = int.Parse(lines[0]);
tag.EndLine = int.Parse(lines[1]);
Expand Down
Loading
Loading