Skip to content

Commit

Permalink
Feature/sonar issues (#30)
Browse files Browse the repository at this point in the history
  • Loading branch information
k3ldar authored Sep 6, 2023
1 parent df15e05 commit 9a3e857
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 170 deletions.
4 changes: 2 additions & 2 deletions src/GCAAnalyser/Analyzers/BaseAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ namespace GSendAnalyzer.Analyzers
{
public class BaseAnalyzer
{
protected bool HasCommandsOnSameLine(IGCodeCommand command, char ignoreCommands)
protected static bool HasCommandsOnSameLine(IGCodeCommand command, char ignoreCommands)
{
var commandsOnLine = CommandsOnSameLine(command);

return commandsOnLine.Exists(c => c.Command != ignoreCommands);
}

protected List<IGCodeCommand> CommandsOnSameLine(IGCodeCommand command)
protected static List<IGCodeCommand> CommandsOnSameLine(IGCodeCommand command)
{
if (command == null)
throw new ArgumentNullException(nameof(command));
Expand Down
18 changes: 4 additions & 14 deletions src/GCSDesktop/Forms/FrmMachine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@

using static GSendShared.Constants;

//using static System.Windows.Forms.VisualStyles.VisualStyleElement.TrayNotify;

namespace GSendDesktop.Forms
{
public partial class FrmMachine : BaseForm, IUiUpdate, IShortcutImplementation
Expand Down Expand Up @@ -200,8 +198,6 @@ private void ClientWebSocket_ProcessMessage(string message)
if (String.IsNullOrWhiteSpace(message))
return;

//Trace.WriteLine($"Client: {message}");

ClientBaseMessage clientMessage = null;
try
{
Expand All @@ -212,9 +208,6 @@ private void ClientWebSocket_ProcessMessage(string message)
return;
}

//Trace.WriteLine(String.Format("Machine {0} Socket Message: {1}", _machine.Name, clientMessage.success));
//Trace.WriteLine(message);

if (clientMessage == null)
return;

Expand All @@ -223,8 +216,6 @@ private void ClientWebSocket_ProcessMessage(string message)
ProcessFailedMessage(clientMessage);
}

string serverCpu = String.Format(GSend.Language.Resources.ServerCpuStateConnected, clientMessage.ServerCpuStatus.ToString("N2"));

switch (clientMessage.request)
{
case "Stop":
Expand Down Expand Up @@ -307,7 +298,7 @@ private void ClientWebSocket_ProcessMessage(string message)

case "ResponseReceived":
case "MessageReceived":
if (clientMessage.message.ToString().StartsWith("<") || _isJogging)
if (clientMessage.message.ToString().StartsWith('<') || _isJogging)
{
_lastMessageWasHiddenCommand = true;
}
Expand Down Expand Up @@ -360,7 +351,7 @@ private void ClientWebSocket_ProcessMessage(string message)
break;

case Constants.MessageLineStatusUpdated:
LineStatusUpdateModel lineStatusUpdateModel = (LineStatusUpdateModel)JsonSerializer.Deserialize<LineStatusUpdateModel>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);
LineStatusUpdateModel lineStatusUpdateModel = JsonSerializer.Deserialize<LineStatusUpdateModel>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);

if (lineStatusUpdateModel != null && _gcodeLines != null)
{
Expand All @@ -384,7 +375,7 @@ private void ClientWebSocket_ProcessMessage(string message)
break;

case Constants.MessageInformationUpdate:
InformationMessageModel informationMessageModel = (InformationMessageModel)JsonSerializer.Deserialize<InformationMessageModel>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);
InformationMessageModel informationMessageModel = JsonSerializer.Deserialize<InformationMessageModel>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);

if (informationMessageModel != null)
{
Expand All @@ -397,7 +388,7 @@ private void ClientWebSocket_ProcessMessage(string message)
break;

case Constants.MessageConfigurationUpdated:
ConfigurationUpdatedMessage updateMessage = (ConfigurationUpdatedMessage)JsonSerializer.Deserialize<ConfigurationUpdatedMessage>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);
ConfigurationUpdatedMessage updateMessage = JsonSerializer.Deserialize<ConfigurationUpdatedMessage>(clientMessage.message.ToString(), Constants.DefaultJsonSerializerOptions);

if (_machine.Name != updateMessage.Name)
{
Expand Down Expand Up @@ -465,7 +456,6 @@ protected override void UpdateEnabledState()
mnuMachineLoadGCode.Enabled = _machineStatusModel?.IsRunning == false;
mnuMachineClearGCode.Enabled = _machineStatusModel?.IsRunning == false && _gCodeAnalyses != null;

//tabPageServiceSchedule.Enabled = _machineConnected && _machineStatusModel?.IsRunning == false;
tabPageSpindle.Enabled = _machineConnected && _machineStatusModel?.IsRunning == false;
}

Expand Down
3 changes: 0 additions & 3 deletions src/GCSDesktop/Forms/StartJobWizard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,6 @@ public StartJobWizard(MachineStateModel machineStatusModel, IGCodeAnalyses gCode
_gCodeAnalyses = gCodeAnalyses ?? throw new ArgumentNullException(nameof(gCodeAnalyses));
_gSendApiWrapper = machineApiWrapper ?? throw new ArgumentNullException(nameof(machineApiWrapper));

if (machineApiWrapper == null)
throw new ArgumentNullException(nameof(machineApiWrapper));

string jobName = DesktopSettings.ReadValue<string>(nameof(StartJobWizard), Constants.StartWizardSelectedJob, String.Empty);

if (!String.IsNullOrEmpty(gCodeAnalyses.JobName))
Expand Down
6 changes: 0 additions & 6 deletions src/GSend.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GSendEditor", "GSendEditor\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GSendControls", "GSendControls\GSendControls.csproj", "{DE225549-B4AA-4A8B-BDEC-496C6B9628D0}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GSendLicenseGenerator", "GSendLicenseGenerator\GSendLicenseGenerator.csproj", "{72B5B9AF-4DF3-406B-87E1-8F3FEFDBB5C4}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "wwwroot", "wwwroot", "{862EFEB6-17A5-4BD5-80BD-0E4F16AC2192}"
ProjectSection(SolutionItems) = preProject
..\wwwroot\Index.html = ..\wwwroot\Index.html
Expand Down Expand Up @@ -105,10 +103,6 @@ Global
{DE225549-B4AA-4A8B-BDEC-496C6B9628D0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DE225549-B4AA-4A8B-BDEC-496C6B9628D0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DE225549-B4AA-4A8B-BDEC-496C6B9628D0}.Release|Any CPU.Build.0 = Release|Any CPU
{72B5B9AF-4DF3-406B-87E1-8F3FEFDBB5C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{72B5B9AF-4DF3-406B-87E1-8F3FEFDBB5C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{72B5B9AF-4DF3-406B-87E1-8F3FEFDBB5C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{72B5B9AF-4DF3-406B-87E1-8F3FEFDBB5C4}.Release|Any CPU.Build.0 = Release|Any CPU
{6B1A0717-A7CC-47E9-8DEC-F19DC1C40932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6B1A0717-A7CC-47E9-8DEC-F19DC1C40932}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6B1A0717-A7CC-47E9-8DEC-F19DC1C40932}.Release|Any CPU.ActiveCfg = Release|Any CPU
Expand Down
14 changes: 0 additions & 14 deletions src/GSendLicenseGenerator/GSendLicenseGenerator.csproj

This file was deleted.

123 changes: 0 additions & 123 deletions src/GSendLicenseGenerator/Program.cs

This file was deleted.

8 changes: 0 additions & 8 deletions src/GSendLicenseGenerator/Properties/launchSettings.json

This file was deleted.

0 comments on commit 9a3e857

Please sign in to comment.