Code formatting. Remove traces of static analysis in drone build
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Jens True 2021-07-03 23:12:20 +02:00
parent 15bedb0c31
commit 8d10da3cc6
7 changed files with 56 additions and 54 deletions

@ -5,13 +5,3 @@ steps:
image: mono image: mono
commands: commands:
- msbuild Tidstagning.sln - msbuild Tidstagning.sln
- name: sca
image: azimarev/mono-sonarqube-scanner
failure: ignore
commands:
- mono /opt/sonar-scanner-msbuild/SonarScanner.MSBuild.exe begin /k:"tidstagning" /d:sonar.host.url="https://sonarqube.jcktrue.dk" /d:sonar.login="$TOKEN"
- msbuild Tidstagning.sln
- mono /opt/sonar-scanner-msbuild/SonarScanner.MSBuild.exe sonarscanner end /d:sonar.login="$TOKEN"
environment:
TOKEN:
from_secret: SONARQUBE_TOKEN

@ -7,7 +7,8 @@ namespace Tidstagning
public partial class Form1 : Form public partial class Form1 : Form
{ {
delegate void SetTextCallback(string text); delegate void SetTextCallback(string text);
BindingList<Entry> entries = new BindingList<Entry> { BindingList<Entry> entries = new BindingList<Entry>
{
}; };
ResultList liste; ResultList liste;
@ -22,13 +23,14 @@ namespace Tidstagning
while ((deltager = deltager_handle.ReadLine()) != null) while ((deltager = deltager_handle.ReadLine()) != null)
{ {
string[] dele = deltager.Split(','); string[] dele = deltager.Split(',');
entries.Add(new Entry(dele[0],dele[1])); entries.Add(new Entry(dele[0], dele[1]));
} }
deltager_handle.Dispose(); deltager_handle.Dispose();
comboSoundTime.SelectedIndex = 0; comboSoundTime.SelectedIndex = 0;
foreach (string port in Relay.GetPorts()) { foreach (string port in Relay.GetPorts())
{
comboComport.Items.Add(port); comboComport.Items.Add(port);
} }
@ -72,7 +74,7 @@ namespace Tidstagning
} }
else else
{ {
this.txtDebug.AppendText( text ); this.txtDebug.AppendText(text);
} }
} }
@ -90,7 +92,8 @@ namespace Tidstagning
grid.CurrentCell = null; grid.CurrentCell = null;
entries.RemoveAt(e.RowIndex); entries.RemoveAt(e.RowIndex);
} }
if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["Complete"].Index) { if (e.RowIndex >= 0 && e.ColumnIndex == grid.Columns["Complete"].Index)
{
entries[e.RowIndex].Complete(); entries[e.RowIndex].Complete();
liste.WriteComplete(entries[e.RowIndex]); liste.WriteComplete(entries[e.RowIndex]);
@ -195,7 +198,7 @@ namespace Tidstagning
private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e) private void grid_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex > -1 ) if (e.RowIndex > -1)
{ {
try try
{ {
@ -213,7 +216,7 @@ namespace Tidstagning
private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e) private void grid_CellMouseLeave(object sender, DataGridViewCellEventArgs e)
{ {
if (e.RowIndex > -1 ) if (e.RowIndex > -1)
{ {
try try
{ {

@ -1,7 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using System.Threading;
namespace Tidstagning namespace Tidstagning
{ {
@ -31,7 +31,8 @@ namespace Tidstagning
procedure_handle.Dispose(); procedure_handle.Dispose();
} }
public void addEntry(string input) { public void addEntry(string input)
{
string input_filtered = input.Trim(); string input_filtered = input.Trim();
if (input_filtered.Length > 0) if (input_filtered.Length > 0)
{ {
@ -41,7 +42,7 @@ namespace Tidstagning
} }
catch catch
{ {
Debug.WriteLine("Failed to parse: "+ input); Debug.WriteLine("Failed to parse: " + input);
} }
signaler.Sort(); signaler.Sort();
} }
@ -76,7 +77,7 @@ namespace Tidstagning
{ {
signaler = new List<DateTime>(); signaler = new List<DateTime>();
idx = 0; idx = 0;
if(timer != null) if (timer != null)
timer.Dispose(); timer.Dispose();
} }
@ -107,7 +108,7 @@ namespace Tidstagning
if (timeToGo < TimeSpan.Zero) if (timeToGo < TimeSpan.Zero)
{ {
if(!next()) if (!next())
{ {
return; return;
} }
@ -118,7 +119,7 @@ namespace Tidstagning
timer = new System.Threading.Timer(x => timer = new System.Threading.Timer(x =>
{ {
this.Alarm(); this.Alarm();
}, null, timeToGo, new System.TimeSpan (0)); }, null, timeToGo, new System.TimeSpan(0));
} }
private void Alarm() private void Alarm()

@ -1,8 +1,8 @@
using System.IO.Ports; using System;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Threading;
using System.Diagnostics; using System.Diagnostics;
using System.IO.Ports;
using System.Threading;
namespace Tidstagning namespace Tidstagning
{ {
class Relay class Relay
@ -61,15 +61,17 @@ namespace Tidstagning
} }
} }
private void Set(int output, byte state) { private void Set(int output, byte state)
byte[] command = {0xff, 0x01, state}; {
byte[] command = { 0xff, 0x01, state };
if (com.IsOpen) if (com.IsOpen)
{ {
Debug.WriteLine("COM: " + com.PortName + " Write: 0x" + Convert.ToString(command[2], 16)); Debug.WriteLine("COM: " + com.PortName + " Write: 0x" + Convert.ToString(command[2], 16));
com.Write(command, 0, 3); com.Write(command, 0, 3);
} }
} }
public void Close() { public void Close()
{
if (com.IsOpen) if (com.IsOpen)
{ {
Off(); //Make sure the horn is off before closing the com port... Off(); //Make sure the horn is off before closing the com port...
@ -87,7 +89,7 @@ namespace Tidstagning
} }
else else
{ {
ports = new string[]{ "N/A" }; ports = new string[] { "N/A" };
} }
return ports; return ports;
} }

@ -12,7 +12,7 @@ namespace Tidstagning
public ResultList(string filename, Tidstagning.Form1 log_object) public ResultList(string filename, Tidstagning.Form1 log_object)
{ {
filename = MakeSafeFilename(filename, '_'); filename = MakeSafeFilename(filename, '_');
filehandle = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename +"_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".txt"); filehandle = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename + "_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".txt");
filehandle2 = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename + "_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".csv"); filehandle2 = new System.IO.StreamWriter(Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "/Tidstagning/" + filename + "_" + DateTime.Now.ToString(" dd-MM-yyyy HH-mm-ss") + ".csv");
parentForm = log_object; parentForm = log_object;
} }
@ -26,7 +26,8 @@ namespace Tidstagning
return filename; return filename;
} }
public void WriteHeader(string header) { public void WriteHeader(string header)
{
this.racenumber = header; this.racenumber = header;
Write("----------------------------"); Write("----------------------------");
Write(header); Write(header);
@ -46,13 +47,13 @@ namespace Tidstagning
public void WriteComplete(Entry Boat) public void WriteComplete(Entry Boat)
{ {
Write("Fuldført! - " + Boat.Name + " - " + Boat.Completed_Time.ToString()); Write("Fuldført! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + Boat.Completed_Time.ToString("HH:mm:ss") + ", ,"); WriteCSV(this.racenumber + "," + Boat.SailNumber + "," + Boat.Completed_Time.ToString("HH:mm:ss") + ", ,");
} }
public void WriteDNF(Entry Boat) public void WriteDNF(Entry Boat)
{ {
Write("Udgået! - " + Boat.Name + " - " + Boat.Completed_Time.ToString()); Write("Udgået! - " + Boat.Name + " - " + Boat.Completed_Time.ToString());
WriteCSV(this.racenumber + "," +Boat.SailNumber + "," + "00:00:00,DNC,"); WriteCSV(this.racenumber + "," + Boat.SailNumber + "," + "00:00:00,DNC,");
} }
public void Write(string textstring) public void Write(string textstring)

@ -1,4 +1,5 @@
namespace Tidstagning.Properties { namespace Tidstagning.Properties
{
// This class allows you to handle specific events on the settings class: // This class allows you to handle specific events on the settings class:
@ -6,9 +7,11 @@
// The PropertyChanged event is raised after a setting's value is changed. // The PropertyChanged event is raised after a setting's value is changed.
// The SettingsLoaded event is raised after the setting values are loaded. // The SettingsLoaded event is raised after the setting values are loaded.
// The SettingsSaving event is raised before the setting values are saved. // The SettingsSaving event is raised before the setting values are saved.
internal sealed partial class Settings { internal sealed partial class Settings
{
public Settings() { public Settings()
{
// // To add event handlers for saving and changing settings, uncomment the lines below: // // To add event handlers for saving and changing settings, uncomment the lines below:
// //
// this.SettingChanging += this.SettingChangingEventHandler; // this.SettingChanging += this.SettingChangingEventHandler;
@ -17,11 +20,13 @@
// //
} }
private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e)
{
// Add code to handle the SettingChangingEvent event here. // Add code to handle the SettingChangingEvent event here.
} }
private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e)
{
// Add code to handle the SettingsSaving event here. // Add code to handle the SettingsSaving event here.
} }
} }