Skip to content

Commit

Permalink
General cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
aelassas committed Jul 23, 2024
1 parent 7084836 commit 184a38f
Show file tree
Hide file tree
Showing 32 changed files with 257 additions and 35 deletions.
129 changes: 129 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,132 @@ dotnet_diagnostic.IDE0160.severity = silent
dotnet_diagnostic.IDE0022.severity = silent

dotnet_diagnostic.CA1310.severity = silent

dotnet_diagnostic.CA1720.severity = silent

dotnet_diagnostic.IDE0210.severity = silent

dotnet_diagnostic.CA1307.severity = silent

dotnet_diagnostic.CA1863.severity = silent

dotnet_diagnostic.CA1859.severity = silent

[*.cs]
#### Styles de nommage ####

# Règles de nommage

dotnet_naming_rule.interface_should_be_begins_with_i.severity = suggestion
dotnet_naming_rule.interface_should_be_begins_with_i.symbols = interface
dotnet_naming_rule.interface_should_be_begins_with_i.style = begins_with_i

dotnet_naming_rule.types_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.types_should_be_pascal_case.symbols = types
dotnet_naming_rule.types_should_be_pascal_case.style = pascal_case

dotnet_naming_rule.non_field_members_should_be_pascal_case.severity = suggestion
dotnet_naming_rule.non_field_members_should_be_pascal_case.symbols = non_field_members
dotnet_naming_rule.non_field_members_should_be_pascal_case.style = pascal_case

# Spécifications de symboles

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
dotnet_naming_symbols.non_field_members.required_modifiers =

# Styles de nommage

dotnet_naming_style.begins_with_i.required_prefix = I
dotnet_naming_style.begins_with_i.required_suffix =
dotnet_naming_style.begins_with_i.word_separator =
dotnet_naming_style.begins_with_i.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_style.pascal_case.required_prefix =
dotnet_naming_style.pascal_case.required_suffix =
dotnet_naming_style.pascal_case.word_separator =
dotnet_naming_style.pascal_case.capitalization = pascal_case
csharp_style_expression_bodied_methods = false:silent
csharp_style_expression_bodied_constructors = false:silent
csharp_style_expression_bodied_operators = false:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:silent
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_prefer_braces = true:silent
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent

[*.vb]
#### Styles de nommage ####

# Règles de nommage

dotnet_naming_rule.interface_should_be_commence_par_i.severity = suggestion
dotnet_naming_rule.interface_should_be_commence_par_i.symbols = interface
dotnet_naming_rule.interface_should_be_commence_par_i.style = commence_par_i

dotnet_naming_rule.types_should_be_casse_pascal.severity = suggestion
dotnet_naming_rule.types_should_be_casse_pascal.symbols = types
dotnet_naming_rule.types_should_be_casse_pascal.style = casse_pascal

dotnet_naming_rule.membres_autres_que_des_champs_should_be_casse_pascal.severity = suggestion
dotnet_naming_rule.membres_autres_que_des_champs_should_be_casse_pascal.symbols = membres_autres_que_des_champs
dotnet_naming_rule.membres_autres_que_des_champs_should_be_casse_pascal.style = casse_pascal

# Spécifications de symboles

dotnet_naming_symbols.interface.applicable_kinds = interface
dotnet_naming_symbols.interface.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.interface.required_modifiers =

dotnet_naming_symbols.types.applicable_kinds = class, struct, interface, enum
dotnet_naming_symbols.types.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.types.required_modifiers =

dotnet_naming_symbols.membres_autres_que_des_champs.applicable_kinds = property, event, method
dotnet_naming_symbols.membres_autres_que_des_champs.applicable_accessibilities = public, friend, private, protected, protected_friend, private_protected
dotnet_naming_symbols.membres_autres_que_des_champs.required_modifiers =

# Styles de nommage

dotnet_naming_style.commence_par_i.required_prefix = I
dotnet_naming_style.commence_par_i.required_suffix =
dotnet_naming_style.commence_par_i.word_separator =
dotnet_naming_style.commence_par_i.capitalization = pascal_case

dotnet_naming_style.casse_pascal.required_prefix =
dotnet_naming_style.casse_pascal.required_suffix =
dotnet_naming_style.casse_pascal.word_separator =
dotnet_naming_style.casse_pascal.capitalization = pascal_case

dotnet_naming_style.casse_pascal.required_prefix =
dotnet_naming_style.casse_pascal.required_suffix =
dotnet_naming_style.casse_pascal.word_separator =
dotnet_naming_style.casse_pascal.capitalization = pascal_case

[*.{cs,vb}]
tab_width = 4
indent_size = 4
1 change: 1 addition & 0 deletions Wexflow.sln
Original file line number Diff line number Diff line change
Expand Up @@ -572,6 +572,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Wexflow.Scripts.LiteDB", "s
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".github", ".github", "{CBF733C9-E197-44FA-837B-1FE4F5923FD9}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.github\azure-pipelines.yml = .github\azure-pipelines.yml
EndProjectSection
EndProject
Expand Down
4 changes: 2 additions & 2 deletions src/net/Wexflow.Scripts.RunAllWorkflows/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace Wexflow.Scripts.RunAllWorkflows
{
internal class Program
internal sealed class Program
{
static void Main()
private static void Main()
{
try
{
Expand Down
2 changes: 2 additions & 0 deletions src/net/Wexflow.Tasks.FilesDiff/FilesDiff.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ private void CheckFiles()
case ChangeType.Modified:
sw.Write("~ ");
break;
case ChangeType.Unchanged:
case ChangeType.Imaginary:
default:
sw.Write(" ");
break;
Expand Down
3 changes: 3 additions & 0 deletions src/net/Wexflow.Tasks.Ftp/Ftp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ public Ftp(XElement xe, Workflow wf) : base(xe, wf)
var passphrase = GetSetting("passphrase", string.Empty);
_plugin = new PluginSftp(this, server, port, user, password, path, privateKeyPath, passphrase);
break;
default:
break;
}
_cmd = (FtpCommad)Enum.Parse(typeof(FtpCommad), GetSetting("command"), true);
_retryCount = int.Parse(GetSetting("retryCount", "3"));
Expand Down Expand Up @@ -173,6 +175,7 @@ private bool DoWork(ref bool atLeastOneSuccess)
_plugin.Delete(file);
_ = Workflow.FilesPerTask[file.TaskId].Remove(file);
break;
case FtpCommad.List:
default:
break;
}
Expand Down
4 changes: 2 additions & 2 deletions src/netcore/Wexflow.Clients.CommandLine/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace Wexflow.Clients.CommandLine
{
internal class Program
internal sealed class Program
{
private enum Operation
{
Expand All @@ -22,7 +22,7 @@ private enum Operation
}

// ReSharper disable once ClassNeverInstantiated.Local
private class Options
private sealed class Options
{
[Option('o', "operation", Required = true, HelpText = "start|suspend|resume|stop|approve|reject")]
// ReSharper disable once UnusedAutoPropertyAccessor.Local
Expand Down
40 changes: 40 additions & 0 deletions src/netcore/Wexflow.Core.Service.Contracts/WorkflowInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,5 +66,45 @@ public int CompareTo(object obj)
var wfi = (WorkflowInfo)obj;
return wfi.Id.CompareTo(Id);
}

public override bool Equals(object obj)
{
return ReferenceEquals(this, obj) || (obj is null ? false : throw new NotImplementedException());
}

public override int GetHashCode()
{
throw new NotImplementedException();
}

public static bool operator ==(WorkflowInfo left, WorkflowInfo right)
{
return left is null ? right is null : left.Equals(right);
}

public static bool operator !=(WorkflowInfo left, WorkflowInfo right)
{
return !(left == right);
}

public static bool operator <(WorkflowInfo left, WorkflowInfo right)
{
return left is null ? right is not null : left.CompareTo(right) < 0;
}

public static bool operator <=(WorkflowInfo left, WorkflowInfo right)
{
return left is null || left.CompareTo(right) <= 0;
}

public static bool operator >(WorkflowInfo left, WorkflowInfo right)
{
return left is not null && left.CompareTo(right) > 0;
}

public static bool operator >=(WorkflowInfo left, WorkflowInfo right)
{
return left is null ? right is null : left.CompareTo(right) >= 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public readonly FileChange[] ToArray()
return result;
}

private class Comparer : IComparer<FileChange>
private sealed class Comparer : IComparer<FileChange>
{
public static readonly IComparer<FileChange> ColumnDefault = new Comparer();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

namespace Wexflow.Core.PollingFileSystemWatcher
{
internal class FileSystemChangeEnumerator : FileSystemEnumerator<string>
internal sealed class FileSystemChangeEnumerator : FileSystemEnumerator<string>
{
private FileChangeList _changes;
private string _currentDirectory;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace Wexflow.Core.PollingFileSystemWatcher
// It has optimized Equals and GetHasCode
// It implements removals by marking values as "removed" (Path==null) and then garbage collecting them when table is resized
[Serializable]
internal class PathToFileStateHashtable(int capacity = 4)
internal sealed class PathToFileStateHashtable(int capacity = 4)
{
private int _nextValuesIndex = 1; // the first Values slot is reserved so that default(Bucket) knows that it is not pointing to any value.
public FileState[] Values { get; private set; } = new FileState[capacity];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,7 @@ public long PollingInterval

public void Start()
{
if (_disposed)
{
throw new ObjectDisposedException(nameof(PollingFileSystemWatcher));
}
ObjectDisposedException.ThrowIf(_disposed, nameof(PollingFileSystemWatcher));

if (_started)
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.Firebird/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.Firebird
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.LiteDB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.LiteDB
{
internal class Program
internal sealed class Program
{
private static IConfiguration? _config;

Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.MariaDB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.MariaDB
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.MongoDB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Wexflow.Scripts.MongoDB
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.MySQL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.MySQL
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.Oracle/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.Oracle
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.PostgreSQL/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.PostgreSQL
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.RavenDB/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Wexflow.Scripts.RavenDB
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.SQLServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Wexflow.Scripts.SQLServer
{
internal class Program
internal sealed class Program
{
private static void Main()
{
Expand Down
2 changes: 1 addition & 1 deletion src/netcore/Wexflow.Scripts.SQLite/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

namespace Wexflow.Scripts.SQLite
{
internal class Program
internal sealed class Program
{
private static IConfiguration _config;

Expand Down
Loading

0 comments on commit 184a38f

Please sign in to comment.